From 5660baa390f62c57f879982edc70bb180e7f9921 Mon Sep 17 00:00:00 2001 From: Tim Lim Date: Mon, 23 Oct 2023 19:49:12 +0800 Subject: [PATCH] Fix CPP - Add support for super/subscript --- lib/docs/filters/cppref/clean_html.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/docs/filters/cppref/clean_html.rb b/lib/docs/filters/cppref/clean_html.rb index d7f564ff..cb1e880f 100644 --- a/lib/docs/filters/cppref/clean_html.rb +++ b/lib/docs/filters/cppref/clean_html.rb @@ -109,6 +109,16 @@ module Docs node['src'] = node['src'].sub! %r{https://upload.cppreference.com/mwiki/(images/[^"']+?)}, 'http://upload.cppreference.com/mwiki/\1' end + css('.t-su.t-su-b').each do |node| + node.inner_html = node.inner_html.gsub('
', '') + node.name = 'sub' + end + + css('.t-su:not(.t-su-b)').each do |node| + node.inner_html = node.inner_html.gsub('
', '') + node.name = 'sup' + end + # temporary solution due lack of mathjax/mathml support css('.t-mfrac').each do |node| fraction = Nokogiri::XML::Node.new('span', doc.document)