metanorma-standoc 2.0.5.2 → 2.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. checksums.yaml +4 -4
  2. data/lib/asciidoctor/standoc/base.rb +0 -1
  3. data/lib/asciidoctor/standoc/blocks.rb +0 -1
  4. data/lib/asciidoctor/standoc/blocks_notes.rb +0 -1
  5. data/lib/asciidoctor/standoc/cleanup.rb +0 -1
  6. data/lib/asciidoctor/standoc/cleanup_amend.rb +0 -1
  7. data/lib/asciidoctor/standoc/cleanup_block.rb +0 -1
  8. data/lib/asciidoctor/standoc/cleanup_boilerplate.rb +0 -1
  9. data/lib/asciidoctor/standoc/cleanup_footnotes.rb +0 -1
  10. data/lib/asciidoctor/standoc/cleanup_image.rb +0 -1
  11. data/lib/asciidoctor/standoc/cleanup_inline.rb +0 -1
  12. data/lib/asciidoctor/standoc/cleanup_maths.rb +0 -1
  13. data/lib/asciidoctor/standoc/cleanup_ref.rb +0 -1
  14. data/lib/asciidoctor/standoc/cleanup_ref_dl.rb +0 -1
  15. data/lib/asciidoctor/standoc/cleanup_reqt.rb +0 -1
  16. data/lib/asciidoctor/standoc/cleanup_section.rb +0 -1
  17. data/lib/asciidoctor/standoc/cleanup_section_names.rb +0 -1
  18. data/lib/asciidoctor/standoc/cleanup_symbols.rb +0 -1
  19. data/lib/asciidoctor/standoc/cleanup_table.rb +0 -1
  20. data/lib/asciidoctor/standoc/cleanup_terms.rb +0 -1
  21. data/lib/asciidoctor/standoc/cleanup_terms_designations.rb +0 -1
  22. data/lib/asciidoctor/standoc/cleanup_text.rb +0 -1
  23. data/lib/asciidoctor/standoc/cleanup_toc.rb +0 -1
  24. data/lib/asciidoctor/standoc/cleanup_xref.rb +0 -1
  25. data/lib/asciidoctor/standoc/converter.rb +0 -1
  26. data/lib/asciidoctor/standoc/deprecated.rb +4 -2
  27. data/lib/asciidoctor/standoc/front.rb +0 -1
  28. data/lib/asciidoctor/standoc/front_contributor.rb +0 -1
  29. data/lib/asciidoctor/standoc/inline.rb +0 -1
  30. data/lib/asciidoctor/standoc/lists.rb +0 -1
  31. data/lib/asciidoctor/standoc/macros.rb +0 -1
  32. data/lib/asciidoctor/standoc/macros_form.rb +0 -1
  33. data/lib/asciidoctor/standoc/macros_note.rb +0 -1
  34. data/lib/asciidoctor/standoc/macros_plantuml.rb +0 -1
  35. data/lib/asciidoctor/standoc/macros_terms.rb +0 -1
  36. data/lib/asciidoctor/standoc/render.rb +0 -1
  37. data/lib/asciidoctor/standoc/reqt.rb +0 -1
  38. data/lib/asciidoctor/standoc/section.rb +0 -1
  39. data/lib/asciidoctor/standoc/table.rb +0 -1
  40. data/lib/asciidoctor/standoc/term_lookup_cleanup.rb +0 -1
  41. data/lib/asciidoctor/standoc/terms.rb +0 -1
  42. data/lib/asciidoctor/standoc/utils.rb +0 -1
  43. data/lib/asciidoctor/standoc/validate.rb +0 -1
  44. data/lib/asciidoctor/standoc/validate_section.rb +0 -1
  45. data/lib/isodoc/pdf_convert.rb +2 -3
  46. data/lib/metanorma/standoc/biblio.rng +25 -2
  47. data/lib/metanorma/standoc/blocks.rb +10 -0
  48. data/lib/metanorma/standoc/cleanup_boilerplate.rb +16 -8
  49. data/lib/metanorma/standoc/cleanup_ref.rb +2 -4
  50. data/lib/metanorma/standoc/cleanup_xref.rb +3 -4
  51. data/lib/metanorma/standoc/inline.rb +11 -8
  52. data/lib/metanorma/standoc/macros_embed.rb +1 -3
  53. data/lib/metanorma/standoc/macros_terms.rb +1 -1
  54. data/lib/metanorma/standoc/processor.rb +2 -1
  55. data/lib/metanorma/standoc/ref.rb +7 -6
  56. data/lib/metanorma/standoc/render.rb +6 -1
  57. data/lib/metanorma/standoc/term_lookup_cleanup.rb +1 -1
  58. data/lib/metanorma/standoc/validate.rb +3 -3
  59. data/lib/metanorma/standoc/version.rb +1 -1
  60. data/metanorma-standoc.gemspec +2 -0
  61. data/spec/assets/iso.adoc +10 -0
  62. data/spec/metanorma/blocks_spec.rb +113 -72
  63. data/spec/metanorma/cleanup_sections_spec.rb +6 -6
  64. data/spec/metanorma/cleanup_spec.rb +5 -5
  65. data/spec/metanorma/cleanup_terms_spec.rb +93 -19
  66. data/spec/metanorma/inline_spec.rb +1 -1
  67. data/spec/metanorma/macros_spec.rb +216 -45
  68. data/spec/metanorma/refs_dl_spec.rb +11 -6
  69. data/spec/metanorma/refs_spec.rb +2 -2
  70. data/spec/metanorma/section_spec.rb +15 -15
  71. data/spec/metanorma/table_spec.rb +339 -342
  72. data/spec/spec_helper.rb +2 -5
  73. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +46 -58
  74. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec1.yml +13 -16
  75. data/spec/vcr_cassettes/hide_refs.yml +179 -191
  76. data/spec/vcr_cassettes/isobib_get_123.yml +15 -18
  77. data/spec/vcr_cassettes/isobib_get_123_1.yml +97 -103
  78. data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +111 -119
  79. data/spec/vcr_cassettes/isobib_get_123_2001.yml +13 -16
  80. data/spec/vcr_cassettes/isobib_get_124.yml +14 -17
  81. data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +19 -17
  82. data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +66 -96
  83. metadata +17 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 75c1f0434e53ee6bfe52bd329b1ddc84f08386c39da60ff1a00f6a34914b7709
4
- data.tar.gz: c7ff940d7544e1d81b4a9ac7e3d0f42bc0398a34b8a5e7036ffe4806a2776615
3
+ metadata.gz: 9e678173d52fd8197d0127f397b7f65349b72d26242d62c3cee8005e3057068b
4
+ data.tar.gz: 4a5548452c906db7df68ead74453f49d484fe601791a35aeb22360e9abb0b2ea
5
5
  SHA512:
6
- metadata.gz: 965db9580243b582af5051840e1a258e74963383bdcb377691cbb5aac2fbec083096cd201aca8c677f0a637ab793b3aa762fb02f5aa7767e710469bc39f0a8a0
7
- data.tar.gz: 894d7350c1438462826073b48a7db77889466aa7d122b991c2c4bb212a12177bab53095a76d9a2e4444a355f6b5343b0f1d7be008c347fdc84f9df52f60924f8
6
+ metadata.gz: 3b28ce6e459d29a0b457179ad2f97282ccf26109358ed8ab933d42e080d8ad1e4511d68c1470d16437c8dd71338ed8951f2a021335f135cf0d3d467d432e715a
7
+ data.tar.gz: d54fc63c669aa31fc728d35f3761c4a853d1ef345d9010988157550073ff2e38feb6ad123be562ee323219d812fa3f414da17102d0c462801bd31aa0be50405d
@@ -1,3 +1,2 @@
1
1
  require "asciidoctor/standoc/deprecated"
2
2
  require "metanorma/standoc/base"
3
-
@@ -1,3 +1,2 @@
1
1
  require "asciidoctor/standoc/deprecated"
2
2
  require "metanorma/standoc/blocks"
3
-
@@ -1,3 +1,2 @@
1
1
  require "asciidoctor/standoc/deprecated"
2
2
  require "metanorma/standoc/blocks_notes"
3
-
@@ -1,3 +1,2 @@
1
1
  require "asciidoctor/standoc/deprecated"
2
2
  require "metanorma/standoc/cleanup"
3
-
@@ -1,3 +1,2 @@
1
1
  require "asciidoctor/standoc/deprecated"
2
2
  require "metanorma/standoc/cleanup_amend"
3
-
@@ -1,3 +1,2 @@
1
1
  require "asciidoctor/standoc/deprecated"
2
2
  require "metanorma/standoc/cleanup_block"
3
-
@@ -1,3 +1,2 @@
1
1
  require "asciidoctor/standoc/deprecated"
2
2
  require "metanorma/standoc/cleanup_boilerplate"
3
-
@@ -1,3 +1,2 @@
1
1
  require "asciidoctor/standoc/deprecated"
2
2
  require "metanorma/standoc/cleanup_footnotes"
3
-
@@ -1,3 +1,2 @@
1
1
  require "asciidoctor/standoc/deprecated"
2
2
  require "metanorma/standoc/cleanup_image"
3
-
@@ -1,3 +1,2 @@
1
1
  require "asciidoctor/standoc/deprecated"
2
2
  require "metanorma/standoc/cleanup_inline"
3
-
@@ -1,3 +1,2 @@
1
1
  require "asciidoctor/standoc/deprecated"
2
2
  require "metanorma/standoc/cleanup_maths"
3
-
@@ -1,3 +1,2 @@
1
1
  require "asciidoctor/standoc/deprecated"
2
2
  require "metanorma/standoc/cleanup_ref"
3
-
@@ -1,3 +1,2 @@
1
1
  require "asciidoctor/standoc/deprecated"
2
2
  require "metanorma/standoc/cleanup_ref_dl"
3
-
@@ -1,3 +1,2 @@
1
1
  require "asciidoctor/standoc/deprecated"
2
2
  require "metanorma/standoc/cleanup_reqt"
3
-
@@ -1,3 +1,2 @@
1
1
  require "asciidoctor/standoc/deprecated"
2
2
  require "metanorma/standoc/cleanup_section"
3
-
@@ -1,3 +1,2 @@
1
1
  require "asciidoctor/standoc/deprecated"
2
2
  require "metanorma/standoc/cleanup_section_names"
3
-
@@ -1,3 +1,2 @@
1
1
  require "asciidoctor/standoc/deprecated"
2
2
  require "metanorma/standoc/cleanup_symbols"
3
-
@@ -1,3 +1,2 @@
1
1
  require "asciidoctor/standoc/deprecated"
2
2
  require "metanorma/standoc/cleanup_table"
3
-
@@ -1,3 +1,2 @@
1
1
  require "asciidoctor/standoc/deprecated"
2
2
  require "metanorma/standoc/cleanup_terms"
3
-
@@ -1,3 +1,2 @@
1
1
  require "asciidoctor/standoc/deprecated"
2
2
  require "metanorma/standoc/cleanup_terms_designations"
3
-
@@ -1,3 +1,2 @@
1
1
  require "asciidoctor/standoc/deprecated"
2
2
  require "metanorma/standoc/cleanup_text"
3
-
@@ -1,3 +1,2 @@
1
1
  require "asciidoctor/standoc/deprecated"
2
2
  require "metanorma/standoc/cleanup_toc"
3
-
@@ -1,3 +1,2 @@
1
1
  require "asciidoctor/standoc/deprecated"
2
2
  require "metanorma/standoc/cleanup_xref"
3
-
@@ -1,3 +1,2 @@
1
1
  require "asciidoctor/standoc/deprecated"
2
2
  require "metanorma/standoc/converter"
3
-
@@ -1,5 +1,7 @@
1
- warn "Please replace your references to Asciidoctor::Standoc with Metanorma::Standoc and your instances of require 'asciidoctor/standoc' with require 'metanorma/standoc'"
1
+ warn "Please replace your references to Asciidoctor::Standoc with "\
2
+ "Metanorma::Standoc and your instances of require 'asciidoctor/standoc' "\
3
+ "with require 'metanorma/standoc'"
2
4
 
3
- exit 127 if ENV['METANORMA_DEPRECATION_FAIL']
5
+ exit 127 if ENV["METANORMA_DEPRECATION_FAIL"]
4
6
 
5
7
  Asciidoctor::Standoc = Metanorma::Standoc unless defined? Asciidoctor::Standoc
@@ -1,3 +1,2 @@
1
1
  require "asciidoctor/standoc/deprecated"
2
2
  require "metanorma/standoc/front"
3
-
@@ -1,3 +1,2 @@
1
1
  require "asciidoctor/standoc/deprecated"
2
2
  require "metanorma/standoc/front_contributor"
3
-
@@ -1,3 +1,2 @@
1
1
  require "asciidoctor/standoc/deprecated"
2
2
  require "metanorma/standoc/inline"
3
-
@@ -1,3 +1,2 @@
1
1
  require "asciidoctor/standoc/deprecated"
2
2
  require "metanorma/standoc/lists"
3
-
@@ -1,3 +1,2 @@
1
1
  require "asciidoctor/standoc/deprecated"
2
2
  require "metanorma/standoc/macros"
3
-
@@ -1,3 +1,2 @@
1
1
  require "asciidoctor/standoc/deprecated"
2
2
  require "metanorma/standoc/macros_form"
3
-
@@ -1,3 +1,2 @@
1
1
  require "asciidoctor/standoc/deprecated"
2
2
  require "metanorma/standoc/macros_note"
3
-
@@ -1,3 +1,2 @@
1
1
  require "asciidoctor/standoc/deprecated"
2
2
  require "metanorma/standoc/macros_plantuml"
3
-
@@ -1,3 +1,2 @@
1
1
  require "asciidoctor/standoc/deprecated"
2
2
  require "metanorma/standoc/macros_terms"
3
-
@@ -1,3 +1,2 @@
1
1
  require "asciidoctor/standoc/deprecated"
2
2
  require "metanorma/standoc/render"
3
-
@@ -1,3 +1,2 @@
1
1
  require "asciidoctor/standoc/deprecated"
2
2
  require "metanorma/standoc/reqt"
3
-
@@ -1,3 +1,2 @@
1
1
  require "asciidoctor/standoc/deprecated"
2
2
  require "metanorma/standoc/section"
3
-
@@ -1,3 +1,2 @@
1
1
  require "asciidoctor/standoc/deprecated"
2
2
  require "metanorma/standoc/table"
3
-
@@ -1,3 +1,2 @@
1
1
  require "asciidoctor/standoc/deprecated"
2
2
  require "metanorma/standoc/term_lookup_cleanup"
3
-
@@ -1,3 +1,2 @@
1
1
  require "asciidoctor/standoc/deprecated"
2
2
  require "metanorma/standoc/terms"
3
-
@@ -1,3 +1,2 @@
1
1
  require "asciidoctor/standoc/deprecated"
2
2
  require "metanorma/standoc/utils"
3
-
@@ -1,3 +1,2 @@
1
1
  require "asciidoctor/standoc/deprecated"
2
2
  require "metanorma/standoc/validate"
3
-
@@ -1,3 +1,2 @@
1
1
  require "asciidoctor/standoc/deprecated"
2
2
  require "metanorma/standoc/validate_section"
3
-
@@ -2,7 +2,6 @@ require "isodoc"
2
2
 
3
3
  module IsoDoc
4
4
  module Standoc
5
-
6
5
  # A {Converter} implementation that generates HTML output, and a document
7
6
  # schema encapsulation of the document for validation
8
7
  #
@@ -12,8 +11,8 @@ module IsoDoc
12
11
  super
13
12
  end
14
13
 
15
- def pdf_stylesheet(docxml)
16
- "base.standard.xsl"
14
+ def pdf_stylesheet(_docxml)
15
+ "base.standard.xsl"
17
16
  end
18
17
  end
19
18
  end
@@ -527,7 +527,7 @@
527
527
  </define>
528
528
  <define name="LocalityType">
529
529
  <data type="string">
530
- <param name="pattern">section|clause|part|paragraph|chapter|page|whole|table|annex|figure|note|list|example|volume|issue|time|anchor|locality:[a-zA-Z0-9_]+</param>
530
+ <param name="pattern">section|clause|part|paragraph|chapter|page|title|line|whole|table|annex|figure|note|list|example|volume|issue|time|anchor|locality:[a-zA-Z0-9_]+</param>
531
531
  </data>
532
532
  </define>
533
533
  <define name="referenceFrom">
@@ -677,6 +677,9 @@
677
677
  <zeroOrMore>
678
678
  <ref name="extent"/>
679
679
  </zeroOrMore>
680
+ <optional>
681
+ <ref name="bibliographic_size"/>
682
+ </optional>
680
683
  <zeroOrMore>
681
684
  <ref name="accesslocation"/>
682
685
  </zeroOrMore>
@@ -922,9 +925,29 @@
922
925
  <text/>
923
926
  </element>
924
927
  </define>
928
+ <define name="sizevalue">
929
+ <element name="value">
930
+ <attribute name="type"/>
931
+ <text/>
932
+ </element>
933
+ </define>
934
+ <define name="bibliographic_size">
935
+ <element name="size">
936
+ <oneOrMore>
937
+ <ref name="sizevalue"/>
938
+ </oneOrMore>
939
+ </element>
940
+ </define>
925
941
  <define name="extent">
926
942
  <element name="extent">
927
- <ref name="BibItemLocality"/>
943
+ <choice>
944
+ <zeroOrMore>
945
+ <ref name="locality"/>
946
+ </zeroOrMore>
947
+ <zeroOrMore>
948
+ <ref name="localityStack"/>
949
+ </zeroOrMore>
950
+ </choice>
928
951
  </element>
929
952
  </define>
930
953
  <define name="series">
@@ -96,6 +96,7 @@ module Metanorma
96
96
  return svgmap_example(node) if role == "svgmap"
97
97
  return form(node) if role == "form"
98
98
  return termdefinition(node) if role == "definition"
99
+ return figure_example(node) if role == "figure"
99
100
 
100
101
  reqt_subpart(role) and return requirement_subpart(node)
101
102
  example_proper(node)
@@ -145,6 +146,15 @@ module Metanorma
145
146
  end.join("\n")
146
147
  end
147
148
 
149
+ def figure_example(node)
150
+ noko do |xml|
151
+ xml.figure **figure_attrs(node) do |ex|
152
+ node.title.nil? or ex.name { |name| name << node.title }
153
+ wrap_in_para(node, ex)
154
+ end
155
+ end.join("\n")
156
+ end
157
+
148
158
  def figure_title(node, out)
149
159
  return if node.title.nil?
150
160
 
@@ -111,7 +111,7 @@ module Metanorma
111
111
  return if xml.at("//boilerplate")
112
112
 
113
113
  preface = xml.at("//preface") || xml.at("//sections") ||
114
- xml.at("//annex") || xml.at("//references") || return
114
+ xml.at("//annex") || xml.at("//references") or return
115
115
  b = boilerplate(xml, isodoc) or return
116
116
  preface.previous = b
117
117
  end
@@ -126,7 +126,7 @@ module Metanorma
126
126
  file = File.join(@localdir,
127
127
  @boilerplateauthority)
128
128
  end
129
- (!file.nil? and File.exists?(file)) or return
129
+ (!file.nil? and File.exist?(file)) or return
130
130
  conv.populate_template(File.read(file, encoding: "UTF-8"), nil)
131
131
  end
132
132
 
@@ -162,11 +162,11 @@ module Metanorma
162
162
  end
163
163
 
164
164
  def insert_indirect_biblio(xmldoc, refs, prefix)
165
- ins = xmldoc.at("bibliography") or
166
- xmldoc.root << "<bibliography/>" and ins = xmldoc.at("bibliography")
167
- ins = ins.add_child("<references hidden='true' normative='false'/>").first
165
+ i = xmldoc.at("bibliography") or
166
+ xmldoc.root << "<bibliography/>" and i = xmldoc.at("bibliography")
167
+ i = i.add_child("<references hidden='true' normative='false'/>").first
168
168
  refs.each do |x|
169
- ins << <<~BIB
169
+ i << <<~BIB
170
170
  <bibitem id="#{x}" type="internal">
171
171
  <docidentifier type="repository">#{x.sub(/^#{prefix}_/, "#{prefix}/")}</docidentifier>
172
172
  </bibitem>
@@ -213,12 +213,13 @@ module Metanorma
213
213
  def bibdata_embed_hdr_cleanup(xmldoc)
214
214
  return if @embed_hdr.nil? || @embed_hdr.empty?
215
215
 
216
- embed_recurse(xmldoc.at("//bibdata"), @embed_hdr.first)
216
+ xmldoc.at("//bibdata") << "<relation type='derivedFrom'>"\
217
+ "#{hdr2bibitem(@embed_hdr.first)}</relation>"
217
218
  end
218
219
 
219
220
  def hdr2bibitem(hdr)
220
221
  xml = Asciidoctor
221
- .convert(hdr[:text], backend: Processor.new.asciidoctor_backend,
222
+ .convert(hdr[:text], backend: hdr2bibitem_type(hdr),
222
223
  header_footer: true)
223
224
  b = Nokogiri::XML(xml).at("//xmlns:bibdata")
224
225
  b.name = "bibitem"
@@ -227,6 +228,13 @@ module Metanorma
227
228
  b.to_xml
228
229
  end
229
230
 
231
+ def hdr2bibitem_type(hdr)
232
+ m = /:mn-document-class: (\S+)/.match(hdr[:text])
233
+ if m then m[1].to_sym
234
+ else Processor.new.asciidoctor_backend
235
+ end
236
+ end
237
+
230
238
  def embed_recurse(bibitem, node)
231
239
  node[:child].map { |x| hdr2bibitem(x) }.each do |x|
232
240
  bibitem << "<relation type='derivedFrom'>#{x}</relation>"
@@ -50,10 +50,8 @@ module Metanorma
50
50
  # only numeric references are renumbered
51
51
  def biblio_renumber(xmldoc)
52
52
  i = 0
53
- xmldoc.xpath("//bibliography//references | //clause//references | "\
54
- "//annex//references").each do |r|
55
- next if r["normative"] == "true"
56
-
53
+ xmldoc.xpath("//references[not(@normative = 'true')]"\
54
+ "[not(@hidden = 'true')]").each do |r|
57
55
  r.xpath("./bibitem[not(@hidden = 'true')]").each do |b|
58
56
  i += 1
59
57
  next unless docid = b.at("./docidentifier[@type = 'metanorma']")
@@ -4,12 +4,12 @@ module Metanorma
4
4
  # extending localities to cover ISO referencing
5
5
  LOCALITY_REGEX_STR = <<~REGEXP.freeze
6
6
  ^(((?<conn>and|or|from|to)!)?
7
- (?<locality>section|clause|part|paragraph|chapter|page|
7
+ (?<locality>section|clause|part|paragraph|chapter|page|line|
8
8
  table|annex|figure|example|note|formula|list|time|anchor|
9
9
  locality:[^ \\t\\n\\r:,;=]+)(\\s+|=)
10
10
  (?<ref>[^"][^ \\t\\n,:;-]*|"[^"]+")
11
11
  (-(?<to>[^"][^ \\t\\n,:;-]*|"[^"]"))?|
12
- (?<locality2>whole|locality:[^ \\t\\n\\r:,;=]+))(?<punct>[,:;]?)\\s*
12
+ (?<locality2>whole|title|locality:[^ \\t\\n\\r:,;=]+))(?<punct>[,:;]?)\\s*
13
13
  (?<text>.*)$
14
14
  REGEXP
15
15
  LOCALITY_RE = Regexp.new(LOCALITY_REGEX_STR.gsub(/\s/, ""),
@@ -160,8 +160,7 @@ module Metanorma
160
160
 
161
161
  def origin_cleanup(xmldoc)
162
162
  xmldoc.xpath("//origin/concept[termref]").each do |x|
163
- t = x.at("./termref")
164
- x.replace(t)
163
+ x.replace(x.at("./termref"))
165
164
  end
166
165
  xmldoc.xpath("//origin").each do |x|
167
166
  x["citeas"] = @anchors&.dig(x["bibitemid"], :xref) or
@@ -51,7 +51,7 @@ module Metanorma
51
51
  end
52
52
 
53
53
  def inline_anchor_xref_match(node)
54
- /^(hidden%(?<hidden>[^,]+),?)?
54
+ /^(?:hidden%(?<hidden>[^,]+),?)?
55
55
  (?<drop>droploc%)?(?<case>capital%|lowercase%)?(?<drop2>droploc%)?
56
56
  (?<fn>fn:?\s*)?(?<text>.*)$/x.match node.text
57
57
  end
@@ -81,10 +81,9 @@ module Metanorma
81
81
  def inline_anchor_bibref(node)
82
82
  eref_contents = (node.text || node.target || node.id)
83
83
  &.sub(/^\[?([^\[\]]+?)\]?$/, "[\\1]")
84
- eref_attributes = { id: node.target || node.id }
85
84
  @refids << (node.target || node.id)
86
85
  noko do |xml|
87
- xml.ref **attr_code(eref_attributes) do |r|
86
+ xml.ref **attr_code(id: node.target || node.id) do |r|
88
87
  r << eref_contents
89
88
  end
90
89
  end.join
@@ -229,13 +228,17 @@ module Metanorma
229
228
  noko do |xml|
230
229
  node.type == :visible and xml << node.text
231
230
  terms = (node.attr("terms") || [node.text]).map { |x| xml_encode(x) }
232
- xml.index do |i|
233
- i.primary { |x| x << terms[0] }
234
- a = terms[1] and i.secondary { |x| x << a }
235
- a = terms[2] and i.tertiary { |x| x << a }
236
- end
231
+ inline_indexterm1(xml, terms)
237
232
  end.join
238
233
  end
234
+
235
+ def inline_indexterm1(xml, terms)
236
+ xml.index do |i|
237
+ i.primary { |x| x << terms[0] }
238
+ a = terms[1] and i.secondary { |x| x << a }
239
+ a = terms[2] and i.tertiary { |x| x << a }
240
+ end
241
+ end
239
242
  end
240
243
  end
241
244
  end
@@ -9,7 +9,6 @@ module Metanorma
9
9
  ret = lines.each_with_object({ lines: [], hdr: [] }) do |line, m|
10
10
  process1(line, m, doc, reader, headings)
11
11
  end
12
- #doc.converter.embed_hdr = ret[:hdr]
13
12
  doc.attributes["embed_hdr"] = ret[:hdr]
14
13
  ::Asciidoctor::Reader.new ret[:lines].flatten
15
14
  end
@@ -83,8 +82,7 @@ module Metanorma
83
82
  j = i
84
83
  j -= 1 while j >= 0 && /^\S/.match?(m[j])
85
84
  lines[j..i].each { |n| m << n }
86
- else
87
- skip or m << l
85
+ else skip or m << l
88
86
  end
89
87
  end
90
88
  end
@@ -109,7 +109,7 @@ module Metanorma
109
109
  def preprocess_attrs(target)
110
110
  m = /^(?<id>&lt;&lt;.+?&gt;&gt;)?(?<rest>.*)$/.match(target)
111
111
  ret = { id: m[:id]&.sub(/^&lt;&lt;/, "")&.sub(/&gt;&gt;$/, "") }
112
- if m2 = /^(?<rest>.*?)(?<opt>,opt(ion)?s=.+)$/
112
+ if m2 = /^(?<rest>.*?)(?<opt>,opt(?:ion)?s=.+)$/
113
113
  .match(m[:rest].sub(/^,/, ""))
114
114
  ret[:opt] = CSV.parse_line(m2[:opt].sub(/^,opt(ion)?s=/, "")
115
115
  .sub(/^"(.+)"$/, "\\1").sub(/^'(.+)'$/, "\\1"))
@@ -22,7 +22,8 @@ module Metanorma
22
22
  end
23
23
 
24
24
  def version
25
- "Metanorma::Standoc #{Metanorma::Standoc::VERSION}/IsoDoc #{IsoDoc::VERSION}"
25
+ "Metanorma::Standoc #{Metanorma::Standoc::VERSION}/"\
26
+ "IsoDoc #{IsoDoc::VERSION}"
26
27
  end
27
28
 
28
29
  def html_path(file)
@@ -87,10 +87,10 @@ module Metanorma
87
87
  end
88
88
  end
89
89
 
90
- def isorefmatches3_1(xml, match, yr, _hasyr, _ref)
90
+ def isorefmatches3_1(xml, match, year, _hasyr, _ref)
91
91
  xml.bibitem(**attr_code(ref_attributes(match))) do |t|
92
- isorefrender1(t, match, yr, " (all parts)")
93
- conditional_date(t, match, yr == "--")
92
+ isorefrender1(t, match, year, " (all parts)")
93
+ conditional_date(t, match, year == "--")
94
94
  iso_publisher(t, match[:code])
95
95
  if match.names.include?("fn") && match[:fn]
96
96
  t.note(**plaintxt.merge(type: "Unpublished-Status")) do |p|
@@ -108,7 +108,7 @@ module Metanorma
108
108
  bib.uri code[:key].sub(/\.[a-zA-Z0-9]+$/, ""), **{ type: "URI" }
109
109
  bib.uri code[:key].sub(/\.[a-zA-Z0-9]+$/, ""), **{ type: "citation" }
110
110
  end
111
- code[:id].sub!(/[:-](19|20)[0-9][0-9]$/, "")
111
+ # code[:id].sub!(/[:-](19|20)[0-9][0-9]$/, "")
112
112
  docid(bib, match[:usrlbl]) if match[:usrlbl]
113
113
  docid(bib, /^\d+$/.match?(code[:id]) ? "[#{code[:id]}]" : code[:id])
114
114
  code[:type] == "repo" and
@@ -123,7 +123,8 @@ module Metanorma
123
123
  end
124
124
  yr_match = /[:-](?<year>(?:19|20)[0-9][0-9])\b/.match(code[:id])
125
125
  refitem_render1(match, code, t)
126
- docnumber(t, code[:id]) unless /^\d+$|^\(.+\)$/.match?(code[:id])
126
+ /^\d+$|^\(.+\)$/.match?(code[:id]) or
127
+ docnumber(t, code[:id].sub(/[:-](19|20)[0-9][0-9]$/, ""))
127
128
  conditional_date(t, yr_match || match, false)
128
129
  end
129
130
  end
@@ -178,7 +179,7 @@ module Metanorma
178
179
  \[(?<usrlbl>\([^)]+\))?(?<code>(?:ISO|IEC)[^0-9]*\s[0-9]+)
179
180
  (?::(?<year>--|&\#821[12];|[0-9][0-9-]+))?\s
180
181
  \(all\sparts\)\]</ref>,?\s*
181
- (<fn[^>]*>\s*<p>(?<fn>[^\]]+)</p>\s*</fn>,?\s?)?(?<text>.*)$}xm.freeze
182
+ (?:<fn[^>]*>\s*<p>(?<fn>[^\]]+)</p>\s*</fn>,?\s?)?(?<text>.*)$}xm.freeze
182
183
 
183
184
  NON_ISO_REF = %r{^<ref\sid="(?<anchor>[^"]+)">
184
185
  \[(?<usrlbl>\([^)]+\))?(?<code>.+?)\]</ref>,?\s*(?<text>.*)$}xm
@@ -28,6 +28,8 @@ module Metanorma
28
28
  tocfigures: @tocfigures,
29
29
  toctables: @toctables,
30
30
  tocrecommendations: @tocrecommendations,
31
+ fonts: node.attr("fonts"),
32
+ fontlicenseagreement: node.attr("font-license-agreement"),
31
33
  }
32
34
  end
33
35
 
@@ -67,6 +69,8 @@ module Metanorma
67
69
  tocfigures: @tocfigures,
68
70
  toctables: @toctables,
69
71
  tocrecommendations: @tocrecommendations,
72
+ fonts: node.attr("fonts"),
73
+ fontlicenseagreement: node.attr("font-license-agreement"),
70
74
  }
71
75
 
72
76
  if fonts_manifest = node.attr(FONTS_MANIFEST)
@@ -81,7 +85,8 @@ module Metanorma
81
85
  pdf-owner-password pdf-allow-copy-content pdf-allow-edit-content
82
86
  pdf-allow-assemble-document pdf-allow-edit-annotations
83
87
  pdf-allow-print pdf-allow-print-hq pdf-allow-fill-in-forms
84
- pdf-allow-access-content pdf-encrypt-metadata)
88
+ pdf-allow-access-content pdf-encrypt-metadata fonts
89
+ font-license-agreement)
85
90
  .each_with_object({}) do |x, m|
86
91
  m[x.gsub(/-/, "").to_i] = node.attr(x)
87
92
  end
@@ -165,7 +165,7 @@ module Metanorma
165
165
 
166
166
  t = term.dup
167
167
  t.xpath(".//index").map(&:remove)
168
- Metanorma::Utils::to_ncname(t.text.strip.downcase
168
+ Metanorma::Utils::to_ncname(t.text.strip
169
169
  .gsub(/[[:space:]]+/, "-"))
170
170
  end
171
171
 
@@ -64,7 +64,7 @@ module Metanorma
64
64
 
65
65
  def max_td_count(table)
66
66
  max = 0
67
- table.xpath(".//tr").each do |tr|
67
+ table.xpath("./tr").each do |tr|
68
68
  n = tr.xpath("./td | ./th").size
69
69
  max < n and max = n
70
70
  end
@@ -72,8 +72,8 @@ module Metanorma
72
72
  end
73
73
 
74
74
  def maxrowcols_validate(table, maxcols)
75
- cells2d = table.xpath(".//tr").each_with_object([]) { |_r, m| m << {} }
76
- table.xpath(".//tr").each_with_index do |tr, r|
75
+ cells2d = table.xpath("./*/tr").each_with_object([]) { |_r, m| m << {} }
76
+ table.xpath("./*/tr").each_with_index do |tr, r|
77
77
  curr = 0
78
78
  tr.xpath("./td | ./th").each do |td|
79
79
  curr = maxcols_validate1(td, r, curr, cells2d, maxcols)