metanorma-standoc 2.0.6 → 2.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) 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 +15 -7
  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 +4 -4
  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/version.rb +1 -1
  59. data/metanorma-standoc.gemspec +2 -0
  60. data/spec/assets/iso.adoc +10 -0
  61. data/spec/metanorma/blocks_spec.rb +113 -72
  62. data/spec/metanorma/cleanup_sections_spec.rb +6 -6
  63. data/spec/metanorma/cleanup_spec.rb +5 -5
  64. data/spec/metanorma/cleanup_terms_spec.rb +93 -19
  65. data/spec/metanorma/inline_spec.rb +1 -1
  66. data/spec/metanorma/macros_spec.rb +216 -45
  67. data/spec/metanorma/refs_dl_spec.rb +11 -6
  68. data/spec/metanorma/section_spec.rb +15 -15
  69. data/spec/metanorma/table_spec.rb +339 -342
  70. data/spec/spec_helper.rb +2 -5
  71. metadata +17 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d902ad2befbbd472837eceebed5f29e138d9c10a6dd2a7dc4c465addc6e5bb14
4
- data.tar.gz: e84f81d8e37fde67646aac29bfda98a48ed9d5e851318dfb3acfdefca0872d12
3
+ metadata.gz: 9e678173d52fd8197d0127f397b7f65349b72d26242d62c3cee8005e3057068b
4
+ data.tar.gz: 4a5548452c906db7df68ead74453f49d484fe601791a35aeb22360e9abb0b2ea
5
5
  SHA512:
6
- metadata.gz: 07d40940c3dac1176e80861e39b1fa527c9ae5c028cbde11624677c85f17645160c230725d1c010de16121a47031360c354a62db164534d6fba7d2d5456af8bf
7
- data.tar.gz: 8f2220572c54be5e184d63fa694ce031be239a10d06888c92ac91f028ffa5bee9d2cf516e043df921dc5d932529d9686fadcb4b0547a5604717b14f261650310
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
@@ -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|
@@ -179,7 +179,7 @@ module Metanorma
179
179
  \[(?<usrlbl>\([^)]+\))?(?<code>(?:ISO|IEC)[^0-9]*\s[0-9]+)
180
180
  (?::(?<year>--|&\#821[12];|[0-9][0-9-]+))?\s
181
181
  \(all\sparts\)\]</ref>,?\s*
182
- (<fn[^>]*>\s*<p>(?<fn>[^\]]+)</p>\s*</fn>,?\s?)?(?<text>.*)$}xm.freeze
182
+ (?:<fn[^>]*>\s*<p>(?<fn>[^\]]+)</p>\s*</fn>,?\s?)?(?<text>.*)$}xm.freeze
183
183
 
184
184
  NON_ISO_REF = %r{^<ref\sid="(?<anchor>[^"]+)">
185
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
 
@@ -19,6 +19,6 @@ module Metanorma
19
19
  end
20
20
 
21
21
  module Standoc
22
- VERSION = "2.0.6".freeze
22
+ VERSION = "2.0.7".freeze
23
23
  end
24
24
  end
@@ -46,6 +46,7 @@ Gem::Specification.new do |spec|
46
46
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
47
47
  spec.add_development_dependency "guard", "~> 2.14"
48
48
  spec.add_development_dependency "guard-rspec", "~> 4.7"
49
+ spec.add_development_dependency "metanorma-iso"
49
50
  spec.add_development_dependency "rake", "~> 13.0"
50
51
  spec.add_development_dependency "rspec", "~> 3.6"
51
52
  spec.add_development_dependency "rubocop", "~> 1.5.2"
@@ -54,4 +55,5 @@ Gem::Specification.new do |spec|
54
55
  spec.add_development_dependency "timecop", "~> 0.9"
55
56
  spec.add_development_dependency "vcr", "~> 6.1.0"
56
57
  spec.add_development_dependency "webmock"
58
+ #spec.metadata["rubygems_mfa_required"] = "true"
57
59
  end
@@ -0,0 +1,10 @@
1
+ = X
2
+ A
3
+ :mn-document-class: iso
4
+ :title-main-en: Medical devices — Quality management systems — Requirements for regulatory purposes
5
+ :title-main-fr: Dispositifs médicaux — Systèmes de management de la qualité — Exigences à des fins réglementaires
6
+
7
+ == Clause 1
8
+
9
+ X
10
+