Method: IsoDoc::HtmlFunction::Html#sourcecode_cleanup
- Defined in:
- lib/isodoc/html_function/postprocess.rb
#sourcecode_cleanup(html) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/isodoc/html_function/postprocess.rb', line 34 def sourcecode_cleanup(html) ann = ".//div[@class = 'annotation']" html.xpath("//pre[#{ann}] | //div[@class = 'sourcecode'][#{ann}]") .each do |p| ins = p.after("<pre class='sourcecode'/>").next_element p.xpath(ann).each do |d| ins << d.remove.children end end html end |