metanorma-standoc 2.1.3 → 2.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/lib/metanorma/standoc/blocks_notes.rb +1 -1
  3. data/lib/metanorma/standoc/cleanup_footnotes.rb +19 -17
  4. data/lib/metanorma/standoc/cleanup_ref.rb +16 -0
  5. data/lib/metanorma/standoc/cleanup_section.rb +6 -0
  6. data/lib/metanorma/standoc/converter.rb +2 -0
  7. data/lib/metanorma/standoc/isodoc.rng +16 -0
  8. data/lib/metanorma/standoc/macros_note.rb +26 -0
  9. data/lib/metanorma/standoc/ref.rb +3 -1
  10. data/lib/metanorma/standoc/ref_sect.rb +3 -1
  11. data/lib/metanorma/standoc/ref_utility.rb +20 -5
  12. data/lib/metanorma/standoc/version.rb +1 -1
  13. data/metanorma-standoc.gemspec +1 -1
  14. data/spec/examples/datamodel/address_class_profile.presentation.xml +14 -0
  15. data/spec/metanorma/blocks_spec.rb +5 -0
  16. data/spec/metanorma/cleanup_sections_spec.rb +55 -4
  17. data/spec/metanorma/macros_spec.rb +32 -6
  18. data/spec/metanorma/refs_dl_spec.rb +18 -7
  19. data/spec/metanorma/refs_spec.rb +278 -332
  20. data/spec/spec_helper.rb +1 -1
  21. data/spec/vcr_cassettes/bsi16341.yml +58 -72
  22. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +98 -98
  23. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec1.yml +13 -13
  24. data/spec/vcr_cassettes/hide_refs.yml +62 -62
  25. data/spec/vcr_cassettes/isobib_get_123.yml +11 -11
  26. data/spec/vcr_cassettes/isobib_get_123_1.yml +26 -26
  27. data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +32 -32
  28. data/spec/vcr_cassettes/isobib_get_123_2001.yml +12 -12
  29. data/spec/vcr_cassettes/isobib_get_124.yml +12 -12
  30. data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +20 -20
  31. data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +56 -56
  32. metadata +5 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 322efef58275c5330db01582e8ead5ea9c5c496e8a6c5e96aafd8c8413a4412f
4
- data.tar.gz: f88ff574288ee6159fd0e4b05eb076767daede15afd3187d2de05dc1aae295bf
3
+ metadata.gz: d55c699cf84e05288a133b4e0b9305cfb14809780ec379b8d617a928338f1fca
4
+ data.tar.gz: 772eaa9e0e09e9ad7c40b70ade1825d437ba079673767b31c3c5b493cf29af4f
5
5
  SHA512:
6
- metadata.gz: f88c019751884a354f2217c7f67798365e4dfa4fdf15f573f8fa95d98b65abb483da40e6a5f8bd6c1fedb76a8d5d1fe72417cff24b94224bd5ecb625389dd926
7
- data.tar.gz: 4eaa00800dc54f99af38e012923472d50215308e8ba96d2ebe8414ffb9e38c266a0de29e18fc80ba2536d82c7f47ea0df8bea8b892d7610c7d67b46d088bf430
6
+ metadata.gz: fba5328a1ebbc7d236174893d3e98ece5768c3d8935c326506692023d1254c1a2bda95f842956b4830d18c949ba817d4ca4f00548c569999ae38381c1406f02f
7
+ data.tar.gz: d3aed7321347c856c5f8ff600118773094ffc948a5f7b3be6655dff48749c4780a5a4048baf1a04d4aad94e22b650648c91c7ca9bc159680beb48ec4275a8904
@@ -94,7 +94,7 @@ module Metanorma
94
94
  end
95
95
 
96
96
  def admonition(node)
97
- return termnote(node) if in_terms?
97
+ return termnote(node) if in_terms? && node.attr("name") == "note"
98
98
  return note(node) if node.attr("name") == "note"
99
99
  return todo(node) if node.attr("name") == "todo"
100
100
 
@@ -13,14 +13,16 @@ module Metanorma
13
13
  c.gsub(/ id="[^"]+"/, "")
14
14
  end
15
15
 
16
+ FIGURE_FN_XPATH =
17
+ "//figure/following-sibling::*[1][self::p and *[1][self::fn]]".freeze
18
+
16
19
  # include footnotes inside figure if they are the only content
17
20
  # of the paras following
18
21
  def figure_footnote_cleanup(xmldoc)
19
22
  nomatches = false
20
23
  until nomatches
21
- q = "//figure/following-sibling::*[1][self::p and *[1][self::fn]]"
22
24
  nomatches = true
23
- xmldoc.xpath(q).each do |s|
25
+ xmldoc.xpath(FIGURE_FN_XPATH).each do |s|
24
26
  next if s.children.map do |c|
25
27
  c.text? && /[[:alpha:]]/.match(c.text)
26
28
  end.any?
@@ -32,17 +34,17 @@ module Metanorma
32
34
  end
33
35
  end
34
36
 
35
- def table_footnote_renumber1(fnote, i, seen)
37
+ def table_footnote_renumber1(fnote, idx, seen)
36
38
  content = footnote_content(fnote)
37
39
  if seen[content] then outnum = seen[content]
38
40
  else
39
- i += 1
40
- outnum = i
41
+ idx += 1
42
+ outnum = idx
41
43
  seen[content] = outnum
42
44
  end
43
45
  fnote["reference"] = (outnum - 1 + "a".ord).chr
44
46
  fnote["table"] = true
45
- [i, seen]
47
+ [idx, seen]
46
48
  end
47
49
 
48
50
  def table_footnote_renumber(xmldoc)
@@ -55,18 +57,18 @@ module Metanorma
55
57
  end
56
58
  end
57
59
 
58
- def other_footnote_renumber1(fn, i, seen)
59
- unless fn["table"]
60
- content = footnote_content(fn)
61
- if seen[content] then outnum = seen[content]
62
- else
63
- i += 1
64
- outnum = i
65
- seen[content] = outnum
66
- end
67
- fn["reference"] = outnum.to_s
60
+ def other_footnote_renumber1(fnote, idx, seen)
61
+ return [idx, seen] if fnote["table"]
62
+
63
+ content = footnote_content(fnote)
64
+ if seen[content] then outnum = seen[content]
65
+ else
66
+ idx += 1
67
+ outnum = idx
68
+ seen[content] = outnum
68
69
  end
69
- [i, seen]
70
+ fnote["reference"] = outnum.to_s
71
+ [idx, seen]
70
72
  end
71
73
 
72
74
  def other_footnote_renumber(xmldoc)
@@ -80,6 +80,7 @@ module Metanorma
80
80
 
81
81
  def biblio_cleanup(xmldoc)
82
82
  biblio_reorder(xmldoc)
83
+ biblio_annex(xmldoc)
83
84
  biblio_nested(xmldoc)
84
85
  biblio_renumber(xmldoc)
85
86
  biblio_linkonly(xmldoc)
@@ -119,6 +120,16 @@ module Metanorma
119
120
  xmldoc.xpath("//bibitem/ext").each(&:remove)
120
121
  end
121
122
 
123
+ def biblio_annex(xmldoc)
124
+ xmldoc.xpath("//annex[references/references]").each do |t|
125
+ next unless t.xpath("./clause | ./references | ./terms").size == 1
126
+
127
+ r = t.at("./references")
128
+ r.xpath("./references").each { |b| b["normative"] = r["normative"] }
129
+ r.replace(r.elements)
130
+ end
131
+ end
132
+
122
133
  def biblio_nested(xmldoc)
123
134
  xmldoc.xpath("//references[references]").each do |t|
124
135
  t.name = "clause"
@@ -143,6 +154,11 @@ module Metanorma
143
154
  def reference_names(xmldoc)
144
155
  xmldoc.xpath("//bibitem[not(ancestor::bibitem)]").each do |ref|
145
156
  docid = ref.at("./docidentifier[@type = 'metanorma']") ||
157
+ ref.at("./docidentifier[@primary = 'true'][@language = '#{@lang}']") ||
158
+ ref.at("./docidentifier[@primary = 'true'][not(@language)]") ||
159
+ ref.at("./docidentifier[@primary = 'true']") ||
160
+ ref.at("./docidentifier[not(@type = 'DOI')][@language = '#{@lang}']") ||
161
+ ref.at("./docidentifier[not(@type = 'DOI')][not(@language)]") ||
146
162
  ref.at("./docidentifier[not(@type = 'DOI')]") or next
147
163
  reference = format_ref(docid.children.to_xml, docid["type"])
148
164
  @anchors[ref["id"]] = { xref: reference }
@@ -118,6 +118,12 @@ module Metanorma
118
118
  change_clauses(xml)
119
119
  end
120
120
 
121
+ def single_clause_annex(xml)
122
+ xml.xpath("//annex").each do |a|
123
+ single_clause_annex1(a)
124
+ end
125
+ end
126
+
121
127
  def obligations_cleanup(xml)
122
128
  obligations_cleanup_info(xml)
123
129
  obligations_cleanup_norm(xml)
@@ -59,6 +59,8 @@ module Metanorma
59
59
  inline_macro Metanorma::Plugin::Lutaml::LutamlTableInlineMacro
60
60
  block_macro Metanorma::Plugin::Lutaml::LutamlDiagramBlockMacro
61
61
  block Metanorma::Standoc::ToDoAdmonitionBlock
62
+ block Metanorma::Standoc::EditorAdmonitionBlock
63
+ treeprocessor Metanorma::Standoc::EditorInlineAdmonitionBlock
62
64
  treeprocessor Metanorma::Standoc::ToDoInlineAdmonitionBlock
63
65
  block Metanorma::Standoc::PlantUMLBlockMacro
64
66
  block Metanorma::Plugin::Lutaml::LutamlDiagramBlock
@@ -69,6 +69,17 @@
69
69
  </zeroOrMore>
70
70
  </element>
71
71
  </define>
72
+ <define name="AdmonitionType">
73
+ <choice>
74
+ <value>warning</value>
75
+ <value>note</value>
76
+ <value>tip</value>
77
+ <value>important</value>
78
+ <value>caution</value>
79
+ <value>statement</value>
80
+ <value>editorial</value>
81
+ </choice>
82
+ </define>
72
83
  <define name="index">
73
84
  <element name="index">
74
85
  <optional>
@@ -116,6 +127,11 @@
116
127
  <data type="boolean"/>
117
128
  </attribute>
118
129
  </optional>
130
+ <optional>
131
+ <attribute name="suppress_identifier">
132
+ <data type="boolean"/>
133
+ </attribute>
134
+ </optional>
119
135
  <ref name="BibliographicItem"/>
120
136
  </element>
121
137
  </define>
@@ -37,5 +37,31 @@ module Metanorma
37
37
  %{<footnoteblock>#{out}</footnoteblock>}
38
38
  end
39
39
  end
40
+
41
+ class EditorAdmonitionBlock < Asciidoctor::Extensions::BlockProcessor
42
+ use_dsl
43
+ named :EDITOR
44
+ on_contexts :example, :paragraph
45
+
46
+ def process(parent, reader, attrs)
47
+ attrs["name"] = "editorial"
48
+ attrs["caption"] = "EDITOR"
49
+ create_block(parent, :admonition, reader.lines, attrs,
50
+ content_model: :compound)
51
+ end
52
+ end
53
+
54
+ class EditorInlineAdmonitionBlock < Asciidoctor::Extensions::Treeprocessor
55
+ def process(document)
56
+ (document.find_by context: :paragraph).each do |para|
57
+ next unless /^EDITOR: /.match? para.lines[0]
58
+
59
+ para.set_attr("name", "editorial")
60
+ para.set_attr("caption", "EDITOR")
61
+ para.lines[0].sub!(/^EDITOR: /, "")
62
+ para.context = :admonition
63
+ end
64
+ end
65
+ end
40
66
  end
41
67
  end
@@ -82,7 +82,8 @@ module Metanorma
82
82
  def isorefmatches3out(item, xml)
83
83
  if item[:doc] then use_retrieved_relaton(item, xml)
84
84
  else
85
- isorefmatches3_1(xml, item[:ref][:match], item[:ref][:yr],
85
+ isorefmatches3_1(xml, item[:ref][:match],
86
+ item[:ref][:yr],
86
87
  item[:ref][:hasyr], item[:doc])
87
88
  end
88
89
  end
@@ -117,6 +118,7 @@ module Metanorma
117
118
 
118
119
  def refitem_render(xml, match, code)
119
120
  xml.bibitem **attr_code(id: match[:anchor],
121
+ suppress_identifier: code[:dropid],
120
122
  hidden: code[:hidden]) do |t|
121
123
  t.formattedref **{ format: "application/x-isodoc+xml" } do |i|
122
124
  i << ref_normalise_no_format(match[:text])
@@ -120,7 +120,9 @@ module Metanorma
120
120
  def use_retrieved_relaton(item, xml)
121
121
  xml.parent.add_child(smart_render_xml(item[:doc], item[:ref][:code],
122
122
  item[:ref]))
123
- use_my_anchor(xml, item[:ref][:match][:anchor], item.dig(:ref, :analyse_code, :hidden))
123
+ use_my_anchor(xml, item[:ref][:match][:anchor],
124
+ hidden: item.dig(:ref, :analyse_code, :hidden),
125
+ dropid: item.dig(:ref, :analyse_code, :dropid))
124
126
  end
125
127
 
126
128
  def init_bib_caches(node)
@@ -31,9 +31,11 @@ module Metanorma
31
31
  end
32
32
  end
33
33
 
34
- def use_my_anchor(ref, id, hidden)
34
+ def use_my_anchor(ref, id, opt)
35
35
  ref.parent.elements.last["id"] = id
36
- hidden and ref.parent.elements.last["hidden"] = hidden
36
+ opt[:hidden] and ref.parent.elements.last["hidden"] = opt[:hidden]
37
+ opt[:dropid] and
38
+ ref.parent.elements.last["suppress_identifier"] = opt[:dropid]
37
39
  ref
38
40
  end
39
41
 
@@ -57,6 +59,7 @@ module Metanorma
57
59
 
58
60
  def mn_code(code)
59
61
  code.sub(/^\(/, "[").sub(/\).*$/, "]")
62
+ .sub(/^dropid\((.+)\)$/, "\\1")
60
63
  .sub(/^hidden\((.+)\)$/, "\\1")
61
64
  .sub(/^nofetch\((.+)\)$/, "\\1")
62
65
  end
@@ -73,6 +76,12 @@ module Metanorma
73
76
  ret.merge(id: m[:id], hidden: true)
74
77
  end
75
78
 
79
+ def analyse_ref_dropid(ret)
80
+ return ret unless m = /^dropid\((?<id>.+)\)$/.match(ret[:id])
81
+
82
+ ret.merge(id: m[:id], dropid: true)
83
+ end
84
+
76
85
  def analyse_ref_repo_path(ret)
77
86
  return ret unless m =
78
87
  /^(?<type>repo|path):\((?<key>[^,]+),?(?<id>.*)\)$/
@@ -89,14 +98,16 @@ module Metanorma
89
98
  end
90
99
 
91
100
  # ref id = (usrlbl)code[:-]year
92
- # code = nofetch(code) | hidden(code) | (repo|path):(key,code) |
101
+ # code = nofetch(code) | hidden(code) | dropid(code) | (repo|path):(key,code) |
93
102
  # \[? number \]? | ident
94
103
  def analyse_ref_code(code)
95
104
  ret = { id: code }
96
105
  return ret if code.blank?
97
106
 
98
107
  analyse_ref_nofetch(
99
- analyse_ref_hidden(analyse_ref_repo_path(analyse_ref_numeric(ret))),
108
+ analyse_ref_hidden(
109
+ analyse_ref_dropid(analyse_ref_repo_path(analyse_ref_numeric(ret))),
110
+ ),
100
111
  )
101
112
  end
102
113
 
@@ -110,7 +121,11 @@ module Metanorma
110
121
  end
111
122
 
112
123
  def ref_attributes(match)
113
- { id: match[:anchor], type: "standard" }
124
+
125
+ code = analyse_ref_code(match[:code])
126
+
127
+ { id: match[:anchor], type: "standard",
128
+ suppress_identifier: code[:dropid] || nil }
114
129
  end
115
130
 
116
131
  MALFORMED_REF = <<~REF.freeze
@@ -19,6 +19,6 @@ module Metanorma
19
19
  end
20
20
 
21
21
  module Standoc
22
- VERSION = "2.1.3".freeze
22
+ VERSION = "2.1.4".freeze
23
23
  end
24
24
  end
@@ -38,7 +38,7 @@ Gem::Specification.new do |spec|
38
38
  spec.add_dependency "latexmath"
39
39
  spec.add_dependency "mathml2asciimath"
40
40
  spec.add_dependency "metanorma-utils", "~> 1.2.8"
41
- spec.add_dependency "relaton-cli", "~> 1.11.0"
41
+ spec.add_dependency "relaton-cli", "~> 1.12.0"
42
42
  spec.add_dependency "relaton-iev", "~> 1.1.0"
43
43
  spec.add_dependency "unicode2latex", "~> 0.0.1"
44
44
 
@@ -0,0 +1,14 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <standard-document xmlns="https://www.metanorma.org/ns/standoc" type="presentation" version="2.0.4">
3
+ <bibdata type="standard">
4
+ <title language="en" format="text/plain">Document title</title>
5
+ <language current="true">en</language><script current="true">Latn</script><status><stage language="">published</stage></status><copyright><from>2022</from></copyright><ext><doctype language="">article</doctype></ext></bibdata><localized-strings><localized-string key="scope" language="en">Scope</localized-string><localized-string key="symbolsabbrev" language="en">Symbols and abbreviated terms</localized-string><localized-string key="abbrev" language="en">Abbreviated terms</localized-string><localized-string key="symbols" language="en">Symbols</localized-string><localized-string key="table_of_contents" language="en">Table of contents</localized-string><localized-string key="introduction" language="en">Introduction</localized-string><localized-string key="foreword" language="en">Foreword</localized-string><localized-string key="abstract" language="en">Abstract</localized-string><localized-string key="acknowledgements" language="en">Acknowledgements</localized-string><localized-string key="termsdef" language="en">Terms and definitions</localized-string><localized-string key="termsdefsymbolsabbrev" language="en">Terms, definitions, symbols and abbreviated terms</localized-string><localized-string key="termsdefsymbols" language="en">Terms, definitions and symbols</localized-string><localized-string key="termsdefabbrev" language="en">Terms, definitions and abbreviated terms</localized-string><localized-string key="normref" language="en">Normative references</localized-string><localized-string key="bibliography" language="en">Bibliography</localized-string><localized-string key="preface" language="en">Preface</localized-string><localized-string key="clause" language="en">Clause</localized-string><localized-string key="annex" language="en">Annex</localized-string><localized-string key="appendix" language="en">Appendix</localized-string><localized-string key="no_terms_boilerplate" language="en"><p>No terms and definitions are listed in this document.</p>
6
+ </localized-string><localized-string key="internal_terms_boilerplate" language="en"><p>For the purposes of this document,
7
+ the following terms and definitions apply.</p>
8
+ </localized-string><localized-string key="norm_with_refs_pref" language="en">The following documents are referred to in the text in such a way that some or all of their content constitutes requirements of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.</localized-string><localized-string key="norm_empty_pref" language="en">There are no normative references in this document.</localized-string><localized-string key="external_terms_boilerplate" language="en"><p>For the purposes of this document,
9
+ the terms and definitions given in % apply.</p>
10
+ </localized-string><localized-string key="internal_external_terms_boilerplate" language="en"><p>For the purposes of this document, the terms and definitions
11
+ given in % and the following apply.</p>
12
+ </localized-string><localized-string key="term_defined_in" language="en">[term defined in %]</localized-string><localized-string key="binary_and" language="en">%1 and %2</localized-string><localized-string key="multiple_and" language="en">%1, and %2</localized-string><localized-string key="binary_or" language="en">%1 or %2</localized-string><localized-string key="multiple_or" language="en">%1, or %2</localized-string><localized-string key="chain_and" language="en">%1 and %2</localized-string><localized-string key="chain_or" language="en">%1 or %2</localized-string><localized-string key="chain_from" language="en">%1 from %2</localized-string><localized-string key="chain_to" language="en">%1 to %2</localized-string><localized-string key="note" language="en">NOTE</localized-string><localized-string key="note_xref" language="en">Note</localized-string><localized-string key="termnote" language="en">Note % to entry</localized-string><localized-string key="list" language="en">List</localized-string><localized-string key="deflist" language="en">Definition List</localized-string><localized-string key="figure" language="en">Figure</localized-string><localized-string key="formula" language="en">Formula</localized-string><localized-string key="inequality" language="en">Formula</localized-string><localized-string key="table" language="en">Table</localized-string><localized-string key="requirement" language="en">Requirement</localized-string><localized-string key="recommendation" language="en">Recommendation</localized-string><localized-string key="permission" language="en">Permission</localized-string><localized-string key="key" language="en">Key</localized-string><localized-string key="example" language="en">EXAMPLE</localized-string><localized-string key="example_xref" language="en">Example</localized-string><localized-string key="where" language="en">where</localized-string><localized-string key="wholeoftext" language="en">Whole of text</localized-string><localized-string key="draft_label" language="en">draft</localized-string><localized-string key="inform_annex" language="en">informative</localized-string><localized-string key="norm_annex" language="en">normative</localized-string><localized-string key="modified" language="en">modified</localized-string><localized-string key="deprecated" language="en">DEPRECATED</localized-string><localized-string key="source" language="en">SOURCE</localized-string><localized-string key="and" language="en">and</localized-string><localized-string key="all_parts" language="en">All Parts</localized-string><localized-string key="toc_figures" language="en">List of figures</localized-string><localized-string key="toc_tables" language="en">List of tables</localized-string><localized-string key="toc_recommendations" language="en">List of recommendations</localized-string><localized-string key="month_january" language="en">January</localized-string><localized-string key="month_february" language="en">February</localized-string><localized-string key="month_march" language="en">March</localized-string><localized-string key="month_april" language="en">April</localized-string><localized-string key="month_may" language="en">May</localized-string><localized-string key="month_june" language="en">June</localized-string><localized-string key="month_july" language="en">July</localized-string><localized-string key="month_august" language="en">August</localized-string><localized-string key="month_september" language="en">September</localized-string><localized-string key="month_october" language="en">October</localized-string><localized-string key="month_november" language="en">November</localized-string><localized-string key="month_december" language="en">December</localized-string><localized-string key="obligation" language="en">Obligation</localized-string><localized-string key="subject" language="en">Subject</localized-string><localized-string key="inherits" language="en">Inherits</localized-string><localized-string key="admonition.danger" language="en">Danger</localized-string><localized-string key="admonition.warning" language="en">Warning</localized-string><localized-string key="admonition.caution" language="en">Caution</localized-string><localized-string key="admonition.important" language="en">Important</localized-string><localized-string key="admonition.safety_precautions" language="en">Safety Precautions</localized-string><localized-string key="locality.section" language="en">Section</localized-string><localized-string key="locality.clause" language="en">Clause</localized-string><localized-string key="locality.part" language="en">Part</localized-string><localized-string key="locality.paragraph" language="en">Paragraph</localized-string><localized-string key="locality.chapter" language="en">Chapter</localized-string><localized-string key="locality.page" language="en">Page</localized-string><localized-string key="locality.table" language="en">Table</localized-string><localized-string key="locality.annex" language="en">Annex</localized-string><localized-string key="locality.figure" language="en">Figure</localized-string><localized-string key="locality.example" language="en">Example</localized-string><localized-string key="locality.note" language="en">Note</localized-string><localized-string key="locality.formula" language="en">Formula</localized-string><localized-string key="grammar_abbrevs.masculine" language="en">m</localized-string><localized-string key="grammar_abbrevs.feminine" language="en">f</localized-string><localized-string key="grammar_abbrevs.neuter" language="en">n</localized-string><localized-string key="grammar_abbrevs.common" language="en">common</localized-string><localized-string key="grammar_abbrevs.singular" language="en">sg</localized-string><localized-string key="grammar_abbrevs.dual" language="en">dual</localized-string><localized-string key="grammar_abbrevs.pl" language="en">pl</localized-string><localized-string key="grammar_abbrevs.isPreposition" language="en">prep</localized-string><localized-string key="grammar_abbrevs.isParticiple" language="en">part</localized-string><localized-string key="grammar_abbrevs.isAdjective" language="en">adj</localized-string><localized-string key="grammar_abbrevs.isAdverb" language="en">adv</localized-string><localized-string key="grammar_abbrevs.isNoun" language="en">noun</localized-string><localized-string key="grammar_abbrevs.isVerb" language="en">verb</localized-string><localized-string key="relatedterms.deprecates" language="en">deprecates</localized-string><localized-string key="relatedterms.supersedes" language="en">supersedes</localized-string><localized-string key="relatedterms.narrower" language="en">narrower</localized-string><localized-string key="relatedterms.broader" language="en">broader</localized-string><localized-string key="relatedterms.equivalent" language="en">equivalent</localized-string><localized-string key="relatedterms.compare" language="en">compare</localized-string><localized-string key="relatedterms.contrast" language="en">contrast</localized-string><localized-string key="relatedterms.see" language="en">see</localized-string><localized-string key="Clause.sg" language="en">Clause</localized-string><localized-string key="Clause.pl" language="en">Clauses</localized-string><localized-string key="Annex.sg" language="en">Annex</localized-string><localized-string key="Annex.pl" language="en">Annexes</localized-string><localized-string key="Appendix.sg" language="en">Appendix</localized-string><localized-string key="Appendix.pl" language="en">Appendixes</localized-string><localized-string key="Note.sg" language="en">Note</localized-string><localized-string key="Note.pl" language="en">Notes</localized-string><localized-string key="Note_%_to_entry.sg" language="en">Note % to entry</localized-string><localized-string key="Note_%_to_entry.pl" language="en">Notes % to entry</localized-string><localized-string key="List.sg" language="en">List</localized-string><localized-string key="List.pl" language="en">Lists</localized-string><localized-string key="Figure.sg" language="en">Figure</localized-string><localized-string key="Figure.pl" language="en">Figures</localized-string><localized-string key="Formula.sg" language="en">Formula</localized-string><localized-string key="Formula.pl" language="en">Formulas</localized-string><localized-string key="Table.sg" language="en">Table</localized-string><localized-string key="Table.pl" language="en">Tables</localized-string><localized-string key="Requirement.sg" language="en">Requirement</localized-string><localized-string key="Requirement.pl" language="en">Requirements</localized-string><localized-string key="Recommendation.sg" language="en">Recommendation</localized-string><localized-string key="Recommendation.pl" language="en">Recommendations</localized-string><localized-string key="Permission.sg" language="en">Permission</localized-string><localized-string key="Permission.pl" language="en">Permissions</localized-string><localized-string key="Example.sg" language="en">Example</localized-string><localized-string key="Example.pl" language="en">Examples</localized-string><localized-string key="Part.sg" language="en">Part</localized-string><localized-string key="Part.pl" language="en">Parts</localized-string><localized-string key="Section.sg" language="en">Section</localized-string><localized-string key="Section.pl" language="en">Sections</localized-string><localized-string key="Paragraph.sg" language="en">Paragraph</localized-string><localized-string key="Paragraph.pl" language="en">Paragraphs</localized-string><localized-string key="Chapter.sg" language="en">Chapter</localized-string><localized-string key="Chapter.pl" language="en">Chapters</localized-string><localized-string key="Page.sg" language="en">Page</localized-string><localized-string key="Page.pl" language="en">Pages</localized-string><localized-string key="language" language="en">en</localized-string><localized-string key="script" language="en">Latn</localized-string></localized-strings>
13
+ <sections> </sections>
14
+ </standard-document>
@@ -412,6 +412,8 @@ RSpec.describe Metanorma::Standoc do
412
412
 
413
413
  NOTE: This is a note
414
414
 
415
+ WARNING: This is not a note
416
+
415
417
  [NOTE,keep-separate=true,tag=X,multilingual-rendering=common]
416
418
  ====
417
419
  XYZ
@@ -428,6 +430,9 @@ RSpec.describe Metanorma::Standoc do
428
430
  <termnote id="_">
429
431
  <p id="_">This is a note</p>
430
432
  </termnote>
433
+ <admonition id='_' type='warning'>
434
+ <p id='_'>This is not a note</p>
435
+ </admonition>
431
436
  <termnote id='_' tag='X' multilingual-rendering='common'>
432
437
  <p id='_'>XYZ</p>
433
438
  </termnote>
@@ -1713,7 +1713,7 @@ RSpec.describe Metanorma::Standoc do
1713
1713
  <li>
1714
1714
  <p id='_'>
1715
1715
  <xref target='cl2'>
1716
- Clause
1716
+ Clause#{' '}
1717
1717
  <em>A</em>
1718
1718
  <stem type='MathML'>
1719
1719
  <math xmlns='http://www.w3.org/1998/Math/MathML'>
@@ -1726,7 +1726,7 @@ RSpec.describe Metanorma::Standoc do
1726
1726
  <li>
1727
1727
  <p id='_'>
1728
1728
  <xref target='a1'>
1729
- Clause
1729
+ Clause#{' '}
1730
1730
  <em>A</em>
1731
1731
  <stem type='MathML'>
1732
1732
  <math xmlns='http://www.w3.org/1998/Math/MathML'>
@@ -1766,7 +1766,7 @@ RSpec.describe Metanorma::Standoc do
1766
1766
  <title>Clause2</title>
1767
1767
  <variant-title type='sub'>&#8220;A&#8221; &#8216;B&#8217;</variant-title>
1768
1768
  <variant-title type='toc'>
1769
- Clause
1769
+ Clause#{' '}
1770
1770
  <em>A</em>
1771
1771
  <stem type='MathML'>
1772
1772
  <math xmlns='http://www.w3.org/1998/Math/MathML'>
@@ -1780,7 +1780,7 @@ RSpec.describe Metanorma::Standoc do
1780
1780
  <annex id='a1' inline-header='false' obligation='normative'>
1781
1781
  <title>Clause</title>
1782
1782
  <variant-title type='toc'>
1783
- Clause
1783
+ Clause#{' '}
1784
1784
  <em>A</em>
1785
1785
  <stem type='MathML'>
1786
1786
  <math xmlns='http://www.w3.org/1998/Math/MathML'>
@@ -1795,4 +1795,55 @@ RSpec.describe Metanorma::Standoc do
1795
1795
  expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1796
1796
  .to be_equivalent_to xmlpp(output)
1797
1797
  end
1798
+
1799
+ it "processes bibliography annex" do
1800
+ input = <<~INPUT
1801
+ #{ASCIIDOC_BLANK_HDR}
1802
+
1803
+ [appendix]
1804
+ == Bibliography
1805
+
1806
+ [bibliography]
1807
+ === Bibliography
1808
+ INPUT
1809
+ output = <<~OUTPUT
1810
+ <annex id='_' obligation='' language='' script=''>
1811
+ <title>Bibliography</title>
1812
+ <references id='_' normative='false' obligation='informative'>
1813
+ <title>Bibliography</title>
1814
+ </references>
1815
+ </annex>
1816
+ OUTPUT
1817
+ ret = Nokogiri::XML(Asciidoctor.convert(input, *OPTIONS))
1818
+ expect(xmlpp(strip_guid(ret.at("//xmlns:annex").to_xml)))
1819
+ .to be_equivalent_to(output)
1820
+ end
1821
+
1822
+ it "processes terms annex" do
1823
+ input = <<~INPUT
1824
+ #{ASCIIDOC_BLANK_HDR}
1825
+
1826
+ [appendix]
1827
+ == Terms and definitions
1828
+
1829
+ === Terms and definitions
1830
+ INPUT
1831
+ output = <<~OUTPUT
1832
+ <annex id='_' obligation='' language='' script=''>
1833
+ <terms id='_' obligation='normative'>
1834
+ <title>Terms and definitions</title>
1835
+ <term id='term-Terms-and-definitions'>
1836
+ <preferred>
1837
+ <expression>
1838
+ <name>Terms and definitions</name>
1839
+ </expression>
1840
+ </preferred>
1841
+ </term>
1842
+ </terms>
1843
+ </annex>
1844
+ OUTPUT
1845
+ ret = Nokogiri::XML(Asciidoctor.convert(input, *OPTIONS))
1846
+ expect(xmlpp(strip_guid(ret.at("//xmlns:annex").to_xml)))
1847
+ .to be_equivalent_to(output)
1848
+ end
1798
1849
  end
@@ -167,6 +167,38 @@ RSpec.describe Metanorma::Standoc do
167
167
  .to be_equivalent_to xmlpp(output)
168
168
  end
169
169
 
170
+ it "processes the macro for editorial notes" do
171
+ input = <<~INPUT
172
+ #{ASCIIDOC_BLANK_HDR}
173
+ EDITOR: Note1
174
+
175
+ [EDITOR]
176
+ ====
177
+ Note2
178
+ ====
179
+
180
+ [EDITOR]
181
+ Note3
182
+ INPUT
183
+ output = <<~OUTPUT
184
+ #{BLANK_HDR}
185
+ <sections>
186
+ <admonition id='_' type='editorial'>
187
+ <p id='_'>Note1</p>
188
+ </admonition>
189
+ <admonition id='_' type='editorial'>
190
+ <p id='_'>Note2</p>
191
+ </admonition>
192
+ <admonition id='_' type='editorial'>
193
+ <p id='_'>Note3</p>
194
+ </admonition>
195
+ </sections>
196
+ </standard-document>
197
+ OUTPUT
198
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
199
+ .to be_equivalent_to xmlpp(output)
200
+ end
201
+
170
202
  it "processes the Metanorma::Standoc concept and related macros" do
171
203
  input = <<~INPUT
172
204
  #{ASCIIDOC_BLANK_HDR}
@@ -1612,15 +1644,9 @@ RSpec.describe Metanorma::Standoc do
1612
1644
  <doctype>standard</doctype>
1613
1645
  <editorialgroup>
1614
1646
  <agency>ISO</agency>
1615
- <technical-committee/>
1616
- <subcommittee/>
1617
- <workgroup/>
1618
1647
  </editorialgroup>
1619
1648
  <approvalgroup>
1620
1649
  <agency>ISO</agency>
1621
- <technical-committee/>
1622
- <subcommittee/>
1623
- <workgroup/>
1624
1650
  </approvalgroup>
1625
1651
  <stagename>International standard</stagename>
1626
1652
  </ext>