Sha256: 06f6b79dd7ed07555a2aca24a24dfaf64b9cb46f496f0d6f3e542df910fb8981
Contents?: true
Size: 1.36 KB
Versions: 57
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
57 entries across 57 versions & 1 rubygems