Sha256: b4112f3e158b682d8dd242981a4cbb4fe121f4d190ebfda4bee114b2ed3c0a85
Contents?: true
Size: 1.36 KB
Versions: 24
Compression:
Stored size: 1.36 KB
Contents
module IsoDoc module ITU module BaseConvert def cleanup(docxml) super term_cleanup(docxml) refs_cleanup(docxml) title_cleanup(docxml) end def title_cleanup(docxml) docxml.xpath("//h1[@class = 'RecommendationAnnex']").each do |h| h.name = "p" h["class"] = "h1Annex" end docxml end def term_cleanup(docxml) term_cleanup1(docxml) term_cleanup2(docxml) docxml end def term_cleanup1(docxml) docxml.xpath("//p[@class = 'Terms']").each do |d| h2 = d.at("./preceding-sibling::*[@class = 'TermNum'][1]") d.children.first.previous = "<b>#{h2.children.to_xml}</b> " d["id"] = h2["id"] h2.remove end end def term_cleanup2(docxml) docxml.xpath("//p[@class = 'TermNum']").each do |d| d1 = d.next_element and d1.name == "p" or next d1.children.each { |e| e.parent = d } d1.remove end end def refs_cleanup(docxml) docxml.xpath("//tx[following-sibling::tx]").each do |tx| tx << tx.next_element.remove.children end docxml.xpath("//tx").each do |tx| tx.name = "td" tx["colspan"] = "2" tx.wrap("<tr></tr>") end docxml end end end end
Version data entries
24 entries across 24 versions & 1 rubygems