lib/asciidoctor/iso/cleanup.rb in metanorma-iso-1.3.23 vs lib/asciidoctor/iso/cleanup.rb in metanorma-iso-1.3.24

- old
+ new

@@ -3,24 +3,25 @@ require "htmlentities" require "json" require "pathname" require "open-uri" require "pp" +require "asciidoctor/iso/term_lookup_cleanup" module Asciidoctor module ISO class Converter < Standoc::Converter PRE_NORMREF_FOOTNOTES = "//preface//fn | "\ "//clause[title = 'Scope']//fn".freeze NORMREF_FOOTNOTES = - "//references[title = 'Normative References']//fn".freeze + "//references[@normative = 'true']//fn".freeze POST_NORMREF_FOOTNOTES = "//sections//clause[not(title = 'Scope')]//fn | "\ "//annex//fn | "\ - "//references[title = 'Bibliography']//fn".freeze + "//references[@normative = 'false']//fn".freeze def other_footnote_renumber(xmldoc) seen = {} i = 0 xmldoc.xpath(PRE_NORMREF_FOOTNOTES).each do |fn| @@ -55,10 +56,12 @@ id.content = id_prefix(prefix, id) id = xmldoc.at("//bibdata/ext/structuredidentifier/project-number") and id.content = id_prefix(prefix, id) id = xmldoc.at("//bibdata/docidentifier[@type = 'iso-with-lang']") and id.content = id_prefix(prefix, id) + id = xmldoc.at("//bibdata/docidentifier[@type = 'iso-reference']") and + id.content = id_prefix(prefix, id) end def format_ref(ref, type, isopub) ref = ref.sub(/ \(All Parts\)/i, "") super @@ -82,9 +85,14 @@ def sort_biblio(bib) bib.sort do |a, b| sort_biblio_key(a) <=> sort_biblio_key(b) end + end + + def termdef_cleanup(xmldoc) + Asciidoctor::ISO::TermLookupCleanup.new(xmldoc, @log).call + super end # TODO sort by authors # sort by: doc class (ISO, IEC, other standard (not DOI &c), other # then standard class (docid class other than DOI &c)