History

C/Cpp: improve format of fractions

Enoc committed 5 years ago

Commit ef449851 parent fdfcf3d1 file · +14 −0Browse files

Unified · Split

lib/docs/filters/cppref/clean_html.rb+14−0
@@ -109,6 +109,20 @@ module Docs · 108 unmodified lines
109109 node['src'] = node['src'].sub! %r{http://en.cppreference.com/common/([^"']+?)\.svg}, 'http://upload.cppreference.com/mwiki/\1.svg'
110110 end
111111
112+ # temporary solution due lack of mathjax/mathml support
113+ css('.t-mfrac').each do |node|
114+ fraction = Nokogiri::XML::Node.new('span', doc)
115+
116+ node.css('td').each do |node|
117+ fraction.add_child("<span>#{node.content}</span>")
118+ end
119+
120+ fraction.last_element_child().before("<span>/</span>")
121+
122+ node.before(fraction)
123+ node.remove
124+ end
125+
112126 doc
113127 end
114128 end