Sha256: b5b8896b8e2defd275e2f838fd5fcb2209a78913d069f7b76a49b6cc01ecc71d
Contents?: true
Size: 1.84 KB
Versions: 11
Compression:
Stored size: 1.84 KB
Contents
module Metanorma module JIS class Converter < ISO::Converter def norm_ref_preface(ref) if ref.at("./note[@type = 'boilerplate']") unwrap_boilerplate_clauses(ref, ".") else pref = if ref_empty?(ref) then @i18n.norm_empty_pref else @i18n.get[ref_dated(ref)] end ref.at("./title").next = "<p>#{pref}</p>" end end def ref_empty?(ref) ref.xpath(".//bibitem").empty? end def ref_dated(ref) refs = ref.xpath("./bibitem").each_with_object({}) do |e, m| if e.at("./date") then m[:dated] = true else m[:undated] = true end end refs[:dated] && refs[:undated] and return "norm_with_refs_pref" refs[:dated] and return "norm_with_refs_pref_all_dated" "norm_with_refs_pref_none_dated" end def table_footnote_renumber(xmldoc) xmldoc.xpath("//table | //figure").each do |t| seen = {} i = 0 t.xpath(".//fn").each do |fn| i, seen = table_footnote_renumber1(fn, i, seen) end end end def docidentifier_cleanup(xmldoc); end def note_cleanup(xmldoc) note_example_to_table(xmldoc) super clean_example_keep_separate(xmldoc) end def note_example_to_table(xmldoc) xmldoc.xpath("//table").each do |t| t.xpath("./following-sibling::*").each do |n| %w(note example).include?(n.name) or break n["keep-separate"] == "true" and break n.parent = t end end end def clean_example_keep_separate(xmldoc) xmldoc.xpath("//example[@keep-separate] | " \ "//termexample[@keep-separate]").each do |n| n.delete("keep-separate") end end end end end
Version data entries
11 entries across 11 versions & 1 rubygems