From ef449857d534403caa2656eec5744b3e8e1830cf Mon Sep 17 00:00:00 2001 From: Enoc Date: Wed, 13 Oct 2021 00:14:41 -0600 Subject: [PATCH] C/Cpp: improve format of fractions --- lib/docs/filters/cppref/clean_html.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/docs/filters/cppref/clean_html.rb b/lib/docs/filters/cppref/clean_html.rb index ced30f4d..07acfd45 100644 --- a/lib/docs/filters/cppref/clean_html.rb +++ b/lib/docs/filters/cppref/clean_html.rb @@ -109,6 +109,20 @@ module Docs node['src'] = node['src'].sub! %r{http://en.cppreference.com/common/([^"']+?)\.svg}, 'http://upload.cppreference.com/mwiki/\1.svg' end + # temporary solution due lack of mathjax/mathml support + css('.t-mfrac').each do |node| + fraction = Nokogiri::XML::Node.new('span', doc) + + node.css('td').each do |node| + fraction.add_child("#{node.content}") + end + + fraction.last_element_child().before("/") + + node.before(fraction) + node.remove + end + doc end end