lib/asciidoctor/gb/converter.rb in metanorma-gb-1.3.13 vs lib/asciidoctor/gb/converter.rb in metanorma-gb-1.3.14
- old
+ new
@@ -159,20 +159,20 @@
"HJ|HS|HY|JB|JC|JG|JR|JT|JY|LB|LD|LS|LY|MH|MT|MZ|NY|QB|QC|QJ|"\
"QZ|SB|SC|SH|SJ|SN|SY|TB|TD|TJ|TY|WB|WH|WJ|WM|WS|WW|XB|YB|YC|"\
"YD|YS|YY|YZ|ZY|GB|GBZ|GJB|GBn|GHZB|GWKB|GWPB|JJF|JJG|Q|T)(/Z|/T)?)"
ISO_REF = %r{^<ref\sid="(?<anchor>[^"]+)">
- \[(?<code>(ISO|IEC|#{GBCODE})[^0-9]*\s[0-9-]+?)
+ \[(?<usrlbl>\([^)]+\))?(?<code>(ISO|IEC|#{GBCODE})[^0-9]*\s[0-9-]+?)
([:-](?<year>(19|20)[0-9][0-9]))?\]</ref>,?\s
(?<text>.*)$}xm
ISO_REF_NO_YEAR = %r{^<ref\sid="(?<anchor>[^"]+)">
- \[(?<code>(ISO|IEC|#{GBCODE})[^0-9]*\s[0-9-]+):--\]</ref>,?\s?
+ \[(?<usrlbl>\([^)]+\))?(?<code>(ISO|IEC|#{GBCODE})[^0-9]*\s[0-9-]+):--\]</ref>,?\s?
<fn[^>]*>\s*<p>(?<fn>[^\]]+)</p>\s*</fn>,?\s?(?<text>.*)$}xm
ISO_REF_ALL_PARTS = %r{^<ref\sid="(?<anchor>[^"]+)">
- \[(?<code>(ISO|IEC|#{GBCODE})[^0-9]*\s[0-9]+)\s
+ \[(?<usrlbl>\([^)]+\))?(?<code>(ISO|IEC|#{GBCODE})[^0-9]*\s[0-9]+)\s
\(all\sparts\)\]</ref>(<p>)?,?\s?
(?<text>.*)(</p>)?$}xm
def reference1_matches(item)
matched = ISO_REF.match item
@@ -240,14 +240,19 @@
def omit_docid_prefix(prefix)
IsoDoc::Gb::HtmlConvert.new({}).omit_docid_prefix(prefix)
end
def boilerplate_cleanup(xmldoc)
+ isodoc = boilerplate_isodoc(xmldoc)
+ initial_boilerplate(xmldoc, isodoc)
return if @keepboilerplate
- super
- end
-
- def initial_boilerplate(xmldoc)
+ f = xmldoc.at(self.class::TERM_CLAUSE) and
+ term_defs_boilerplate(f.at("./title"),
+ xmldoc.xpath(".//termdocsource"),
+ f.at(".//term"), f.at(".//p"), isodoc)
+ f = xmldoc.at(self.class::NORM_REF) and
+ norm_ref_preface(f)
+ initial_boilerplate(xmldoc, isodoc)
end
end
end
end