[devdocsgjs/main: 5/76] C/Cpp: improve format of fractions




commit ef449857d534403caa2656eec5744b3e8e1830cf
Author: Enoc <brianhernandez222 hotmail com>
Date:   Wed Oct 13 00:14:41 2021 -0600

    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("<span>#{node.content}</span>")
+          end
+
+          fraction.last_element_child().before("<span>/</span>")
+
+          node.before(fraction)
+          node.remove
+        end
+
         doc
       end
     end


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]