metanorma-standoc 2.0.7 → 2.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/lib/metanorma/standoc/base.rb +3 -1
  3. data/lib/metanorma/standoc/biblio.rng +69 -42
  4. data/lib/metanorma/standoc/blocks.rb +8 -3
  5. data/lib/metanorma/standoc/blocks_notes.rb +20 -11
  6. data/lib/metanorma/standoc/cleanup.rb +1 -0
  7. data/lib/metanorma/standoc/cleanup_block.rb +10 -0
  8. data/lib/metanorma/standoc/cleanup_footnotes.rb +14 -9
  9. data/lib/metanorma/standoc/cleanup_inline.rb +17 -0
  10. data/lib/metanorma/standoc/cleanup_maths.rb +5 -4
  11. data/lib/metanorma/standoc/cleanup_reqt.rb +1 -1
  12. data/lib/metanorma/standoc/cleanup_section.rb +15 -13
  13. data/lib/metanorma/standoc/cleanup_terms.rb +3 -1
  14. data/lib/metanorma/standoc/cleanup_text.rb +9 -4
  15. data/lib/metanorma/standoc/converter.rb +2 -0
  16. data/lib/metanorma/standoc/inline.rb +2 -1
  17. data/lib/metanorma/standoc/isodoc.rng +65 -0
  18. data/lib/metanorma/standoc/lists.rb +8 -3
  19. data/lib/metanorma/standoc/macros.rb +31 -4
  20. data/lib/metanorma/standoc/macros_form.rb +1 -1
  21. data/lib/metanorma/standoc/macros_note.rb +1 -6
  22. data/lib/metanorma/standoc/reqt.rb +5 -3
  23. data/lib/metanorma/standoc/version.rb +1 -1
  24. data/metanorma-standoc.gemspec +2 -2
  25. data/spec/metanorma/base_spec.rb +41 -5
  26. data/spec/metanorma/blocks_spec.rb +78 -3
  27. data/spec/metanorma/cleanup_blocks_spec.rb +9 -0
  28. data/spec/metanorma/cleanup_sections_spec.rb +5 -5
  29. data/spec/metanorma/cleanup_spec.rb +5 -5
  30. data/spec/metanorma/cleanup_terms_spec.rb +1 -1
  31. data/spec/metanorma/inline_spec.rb +3 -3
  32. data/spec/metanorma/lists_spec.rb +10 -4
  33. data/spec/metanorma/macros_spec.rb +21 -12
  34. data/spec/metanorma/refs_dl_spec.rb +17 -5
  35. data/spec/metanorma/refs_spec.rb +1 -7
  36. data/spec/metanorma/table_spec.rb +24 -6
  37. data/spec/spec_helper.rb +1 -1
  38. data/spec/vcr_cassettes/bsi16341.yml +496 -0
  39. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +49 -49
  40. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec1.yml +12 -12
  41. data/spec/vcr_cassettes/hide_refs.yml +168 -168
  42. data/spec/vcr_cassettes/isobib_get_123.yml +12 -12
  43. data/spec/vcr_cassettes/isobib_get_123_1.yml +96 -96
  44. data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +110 -110
  45. data/spec/vcr_cassettes/isobib_get_123_2001.yml +11 -11
  46. data/spec/vcr_cassettes/isobib_get_124.yml +13 -13
  47. data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +18 -22
  48. data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +45 -45
  49. data/spec/vcr_cassettes/std-link.yml +207 -0
  50. metadata +11 -10
  51. data/docs/quickstart.adoc +0 -375
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9e678173d52fd8197d0127f397b7f65349b72d26242d62c3cee8005e3057068b
4
- data.tar.gz: 4a5548452c906db7df68ead74453f49d484fe601791a35aeb22360e9abb0b2ea
3
+ metadata.gz: 56e2b9105572c28858ffc12d075b16615ec8195836ad4bf7d7d2122fbf81dc05
4
+ data.tar.gz: 2594f703aeba2f78a5bf3df715709f78b3b6da1a751cb52fedd3ebce299eaf2d
5
5
  SHA512:
6
- metadata.gz: 3b28ce6e459d29a0b457179ad2f97282ccf26109358ed8ab933d42e080d8ad1e4511d68c1470d16437c8dd71338ed8951f2a021335f135cf0d3d467d432e715a
7
- data.tar.gz: d54fc63c669aa31fc728d35f3761c4a853d1ef345d9010988157550073ff2e38feb6ad123be562ee323219d812fa3f414da17102d0c462801bd31aa0be50405d
6
+ metadata.gz: eeef127fe3ea160b49aa62cbb1aa665fb4e0cdb6d1712f646667394a41633c89864a294900c444abc1fceb7fbe2649bdfb2f539d1ccc66d3df89cd247ea31655
7
+ data.tar.gz: 2d1ded28e889db67a42275a5890a8e942b2b966e342e7bb7bc2b21129875394dff03ce1c1cd634b409ce72a68de0e4fd4eff518731cb3b8809c70d5c0c5f0449
@@ -171,7 +171,9 @@ module Metanorma
171
171
  end
172
172
 
173
173
  def doctype(node)
174
- node.attr("doctype")&.gsub(/\s+/, "-")&.downcase
174
+ ret = node.attr("doctype")&.gsub(/\s+/, "-")&.downcase || "standard"
175
+ ret = "standard" if ret == "article"
176
+ ret
175
177
  end
176
178
 
177
179
  def front(node, xml)
@@ -614,12 +614,12 @@
614
614
  <optional>
615
615
  <ref name="fetched"/>
616
616
  </optional>
617
- <choice>
618
- <oneOrMore>
619
- <ref name="btitle"/>
620
- </oneOrMore>
617
+ <optional>
621
618
  <ref name="formattedref"/>
622
- </choice>
619
+ </optional>
620
+ <oneOrMore>
621
+ <ref name="btitle"/>
622
+ </oneOrMore>
623
623
  <zeroOrMore>
624
624
  <ref name="bsource"/>
625
625
  </zeroOrMore>
@@ -851,17 +851,46 @@
851
851
  </define>
852
852
  <define name="bplace">
853
853
  <element name="place">
854
- <optional>
855
- <attribute name="uri">
856
- <data type="anyURI"/>
857
- </attribute>
858
- </optional>
859
- <optional>
860
- <attribute name="region"/>
861
- </optional>
854
+ <choice>
855
+ <text/>
856
+ <group>
857
+ <ref name="bibliocity"/>
858
+ <zeroOrMore>
859
+ <ref name="biblioregion"/>
860
+ </zeroOrMore>
861
+ <zeroOrMore>
862
+ <ref name="bibliocountry"/>
863
+ </zeroOrMore>
864
+ </group>
865
+ </choice>
866
+ </element>
867
+ </define>
868
+ <define name="bibliocity">
869
+ <element name="city">
862
870
  <text/>
863
871
  </element>
864
872
  </define>
873
+ <define name="biblioregion">
874
+ <element name="region">
875
+ <ref name="RegionType"/>
876
+ </element>
877
+ </define>
878
+ <define name="bibliocountry">
879
+ <element name="country">
880
+ <ref name="RegionType"/>
881
+ </element>
882
+ </define>
883
+ <define name="RegionType">
884
+ <optional>
885
+ <attribute name="iso"/>
886
+ </optional>
887
+ <optional>
888
+ <attribute name="recommended">
889
+ <data type="boolean"/>
890
+ </attribute>
891
+ </optional>
892
+ <text/>
893
+ </define>
865
894
  <define name="bprice">
866
895
  <element name="price">
867
896
  <attribute name="currency"/>
@@ -957,36 +986,34 @@
957
986
  <ref name="SeriesType"/>
958
987
  </attribute>
959
988
  </optional>
960
- <choice>
989
+ <optional>
961
990
  <ref name="formattedref"/>
962
- <group>
963
- <ref name="btitle"/>
964
- <optional>
965
- <ref name="bplace"/>
966
- </optional>
967
- <optional>
968
- <ref name="seriesorganization"/>
969
- </optional>
970
- <optional>
971
- <ref name="abbreviation"/>
972
- </optional>
973
- <optional>
974
- <ref name="seriesfrom"/>
975
- </optional>
976
- <optional>
977
- <ref name="seriesto"/>
978
- </optional>
979
- <optional>
980
- <ref name="seriesnumber"/>
981
- </optional>
982
- <optional>
983
- <ref name="seriespartnumber"/>
984
- </optional>
985
- <optional>
986
- <ref name="seriesrun"/>
987
- </optional>
988
- </group>
989
- </choice>
991
+ </optional>
992
+ <ref name="btitle"/>
993
+ <optional>
994
+ <ref name="bplace"/>
995
+ </optional>
996
+ <optional>
997
+ <ref name="seriesorganization"/>
998
+ </optional>
999
+ <optional>
1000
+ <ref name="abbreviation"/>
1001
+ </optional>
1002
+ <optional>
1003
+ <ref name="seriesfrom"/>
1004
+ </optional>
1005
+ <optional>
1006
+ <ref name="seriesto"/>
1007
+ </optional>
1008
+ <optional>
1009
+ <ref name="seriesnumber"/>
1010
+ </optional>
1011
+ <optional>
1012
+ <ref name="seriespartnumber"/>
1013
+ </optional>
1014
+ <optional>
1015
+ <ref name="seriesrun"/>
1016
+ </optional>
990
1017
  </element>
991
1018
  </define>
992
1019
  <define name="SeriesType">
@@ -80,14 +80,17 @@ module Metanorma
80
80
 
81
81
  def term_example(node)
82
82
  noko do |xml|
83
- xml.termexample **attr_code(id_attr(node)) do |ex|
83
+ xml.termexample **attr_code(id_attr(node)
84
+ .merge(
85
+ keepasterm: node.option?("termexample") ? "true" : nil,
86
+ )) do |ex|
84
87
  wrap_in_para(node, ex)
85
88
  end
86
89
  end.join("\n")
87
90
  end
88
91
 
89
92
  def example(node)
90
- return term_example(node) if in_terms?
93
+ return term_example(node) if in_terms? || node.option?("termexample")
91
94
 
92
95
  role = node.role || node.attr("style")
93
96
  %w(recommendation requirement permission).include?(role) and
@@ -237,10 +240,12 @@ module Metanorma
237
240
  end
238
241
 
239
242
  def pass(node)
243
+ c = HTMLEntities.new
240
244
  noko do |xml|
241
245
  xml.passthrough **attr_code(formats:
242
246
  node.attr("format") || "metanorma") do |p|
243
- p << HTMLEntities.new.encode(node.content, :basic, :hexadecimal)
247
+ p << c.encode(c.decode(node.content),
248
+ :basic, :hexadecimal)
244
249
  end
245
250
  end
246
251
  end
@@ -8,16 +8,13 @@ module Metanorma
8
8
  number: node.attr("number"),
9
9
  subsequence: node.attr("subsequence"),
10
10
  "keep-separate": node.attr("keep-separate"),
11
+ keepasterm: node.option?("termnote") ? "true" : nil,
11
12
  )))
12
13
  end
13
14
 
14
15
  def note_attrs(node)
15
- attr_code(
16
- termnote_attrs(node).merge(
17
- type: node.attr("type"),
18
- beforeclauses: node.attr("beforeclauses") == "true" ? "true" : nil,
19
- ),
20
- )
16
+ attr_code(termnote_attrs(node).merge(admonition_core_attrs(node)
17
+ .merge(type: node.attr("type"))))
21
18
  end
22
19
 
23
20
  def sidebar_attrs(node)
@@ -65,6 +62,8 @@ module Metanorma
65
62
  end
66
63
 
67
64
  def note(node)
65
+ return termnote(node) if node.option?("termnote")
66
+
68
67
  noko do |xml|
69
68
  xml.note **note_attrs(node) do |c|
70
69
  wrap_in_para(node, c)
@@ -73,15 +72,25 @@ module Metanorma
73
72
  end
74
73
 
75
74
  def admonition_attrs(node)
75
+ attr_code(keep_attrs(node).merge(id_attr(node)
76
+ .merge(admonition_core_attrs(node)
77
+ .merge(type: admonition_name(node)))))
78
+ end
79
+
80
+ def admonition_core_attrs(node)
81
+ { notag: node.attr("notag") == "true" ? "true" : nil,
82
+ coverpage: node.attr("coverpage") == "true" ? "true" : nil,
83
+ beforeclauses: node.attr("beforeclauses") == "true" ? "true" : nil,
84
+ unnumbered: node.attr("unnumbered") ||
85
+ (node.attr("notag") == "true") || nil }
86
+ end
87
+
88
+ def admonition_name(node)
76
89
  name = node.attr("name")
77
90
  a = node.attr("type") and ["danger", "safety precautions"].each do |t|
78
91
  name = t if a.casecmp(t).zero?
79
92
  end
80
- attr_code(keep_attrs(node).merge(id_attr(node)
81
- .merge(
82
- type: name,
83
- beforeclauses: node.attr("beforeclauses") == "true" ? "true" : nil,
84
- )))
93
+ name
85
94
  end
86
95
 
87
96
  def admonition(node)
@@ -25,6 +25,7 @@ module Metanorma
25
25
  module Cleanup
26
26
  def cleanup(xmldoc)
27
27
  element_name_cleanup(xmldoc)
28
+ passthrough_cleanup(xmldoc)
28
29
  sections_cleanup(xmldoc)
29
30
  obligations_cleanup(xmldoc)
30
31
  table_cleanup(xmldoc)
@@ -73,11 +73,21 @@ module Metanorma
73
73
  end
74
74
  end
75
75
 
76
+ def single_subfigure_cleanup(xmldoc)
77
+ xmldoc.xpath("//figure[figure]").each do |e|
78
+ s = e.xpath("./figure")
79
+ return unless s.size == 1
80
+
81
+ s[0].replace(s[0].children)
82
+ end
83
+ end
84
+
76
85
  def figure_cleanup(xmldoc)
77
86
  figure_footnote_cleanup(xmldoc)
78
87
  figure_dl_cleanup1(xmldoc)
79
88
  figure_dl_cleanup2(xmldoc)
80
89
  subfigure_cleanup(xmldoc)
90
+ single_subfigure_cleanup(xmldoc)
81
91
  end
82
92
 
83
93
  ELEMS_ALLOW_NOTES = %w[p formula ul ol dl figure].freeze
@@ -5,12 +5,15 @@ require "json"
5
5
  module Metanorma
6
6
  module Standoc
7
7
  module Cleanup
8
- def footnote_content(fn)
9
- c = fn.children.respond_to?(:to_xml) ? fn.children.to_xml : fn.children
8
+ def footnote_content(fnote)
9
+ c = if fnote.children.respond_to?(:to_xml)
10
+ fnote.children.to_xml
11
+ else fn.children
12
+ end
10
13
  c.gsub(/ id="[^"]+"/, "")
11
14
  end
12
15
 
13
- # include footnotes inside figure if they are the only content
16
+ # include footnotes inside figure if they are the only content
14
17
  # of the paras following
15
18
  def figure_footnote_cleanup(xmldoc)
16
19
  nomatches = false
@@ -18,7 +21,9 @@ module Metanorma
18
21
  q = "//figure/following-sibling::*[1][self::p and *[1][self::fn]]"
19
22
  nomatches = true
20
23
  xmldoc.xpath(q).each do |s|
21
- next if s.children.map { |c| c.text? && /[[:alpha:]]/.match(c.text) }.any?
24
+ next if s.children.map do |c|
25
+ c.text? && /[[:alpha:]]/.match(c.text)
26
+ end.any?
22
27
 
23
28
  s.previous_element << s.first_element_child.remove
24
29
  s.remove
@@ -27,16 +32,16 @@ module Metanorma
27
32
  end
28
33
  end
29
34
 
30
- def table_footnote_renumber1(fn, i, seen)
31
- content = footnote_content(fn)
35
+ def table_footnote_renumber1(fnote, i, seen)
36
+ content = footnote_content(fnote)
32
37
  if seen[content] then outnum = seen[content]
33
38
  else
34
39
  i += 1
35
40
  outnum = i
36
41
  seen[content] = outnum
37
42
  end
38
- fn["reference"] = (outnum - 1 + "a".ord).chr
39
- fn["table"] = true
43
+ fnote["reference"] = (outnum - 1 + "a".ord).chr
44
+ fnote["table"] = true
40
45
  [i, seen]
41
46
  end
42
47
 
@@ -84,7 +89,7 @@ module Metanorma
84
89
 
85
90
  def footnote_block_cleanup(xmldoc)
86
91
  xmldoc.xpath("//footnoteblock").each do |f|
87
- f.name = 'fn'
92
+ f.name = "fn"
88
93
  if id = xmldoc.at("//*[@id = '#{f.text}']")
89
94
  f.children = id.remove.children
90
95
  else
@@ -185,6 +185,23 @@ module Metanorma
185
185
  Digest::MD5.hexdigest("#{elem.path}////#{elem.text}")
186
186
  .sub(/^(.{8})(.{4})(.{4})(.{4})(.{12})$/, "_\\1-\\2-\\3-\\4-\\5")
187
187
  end
188
+
189
+ def passthrough_cleanup(doc)
190
+ doc.xpath("//passthrough-inline").each do |p|
191
+ p.name = "passthrough"
192
+ p.children = select_odd_chars(p.children.to_xml)
193
+ end
194
+ doc.xpath("//identifier").each do |p|
195
+ p.children = select_odd_chars(p.children.to_xml)
196
+ end
197
+ end
198
+
199
+ private
200
+
201
+ # skip ZWNJ inserted to prevent regexes operating in asciidoctor
202
+ def select_odd_chars(text)
203
+ text.gsub(/(?!&)([[:punct:]])\u200c/, "\\1")
204
+ end
188
205
  end
189
206
  end
190
207
  end
@@ -20,8 +20,8 @@ module Metanorma
20
20
  text = text.gsub(%r{<stem type="AsciiMath">(.+?)</stem>}m) do
21
21
  "<amathstem>#{HTMLEntities.new.decode($1)}</amathstem>"
22
22
  end
23
- text = Html2Doc.asciimath_to_mathml(text,
24
- ["<amathstem>", "</amathstem>"])
23
+ text = Html2Doc.new({})
24
+ .asciimath_to_mathml(text, ["<amathstem>", "</amathstem>"])
25
25
  x = Nokogiri::XML(text)
26
26
  x.xpath("//*[local-name() = 'math'][not(parent::stem)]").each do |y|
27
27
  y.wrap("<stem type='MathML'></stem>")
@@ -68,10 +68,11 @@ module Metanorma
68
68
  def mi_italicise?(char)
69
69
  return false if char.length > 1
70
70
 
71
- if /\p{Greek}/.match?(char)
71
+ case char
72
+ when /\p{Greek}/
72
73
  (/\p{Lower}/.match(char) && !mathml_mi_italics[:lowergreek]) ||
73
74
  (/\p{Upper}/.match(char) && !mathml_mi_italics[:uppergreek])
74
- elsif /\p{Latin}/.match?(char)
75
+ when /\p{Latin}/
75
76
  (/\p{Lower}/.match(char) && !mathml_mi_italics[:lowerroman]) ||
76
77
  (/\p{Upper}/.match(char) && !mathml_mi_italics[:upperroman])
77
78
  else false
@@ -53,7 +53,7 @@ module Metanorma
53
53
  permission).include?(text.name))) ||
54
54
  (text.text.strip.empty? && !text.at(".//xref | .//eref | .//link"))
55
55
 
56
- t = Nokogiri::XML::Element.new("description", reqt)
56
+ t = Nokogiri::XML::Element.new("description", reqt.document)
57
57
  text.before(t)
58
58
  t.children = text.remove
59
59
  end
@@ -125,11 +125,8 @@ module Metanorma
125
125
  end
126
126
 
127
127
  def obligations_cleanup_info(xml)
128
- s = xml.at("//foreword") and s["obligation"] = "informative"
129
- s = xml.at("//introduction") and s["obligation"] = "informative"
130
- s = xml.at("//acknowledgements") and s["obligation"] = "informative"
131
- xml.xpath("//references").each { |r| r["obligation"] = "informative" }
132
- xml.xpath("//preface//clause").each do |r|
128
+ xml.xpath("//foreword | //introduction | //acknowledgements | "\
129
+ "//references | //preface//clause").each do |r|
133
130
  r["obligation"] = "informative"
134
131
  end
135
132
  end
@@ -158,29 +155,34 @@ module Metanorma
158
155
  def preface_clausebefore_cleanup(xmldoc)
159
156
  return unless xmldoc.at("//preface")
160
157
 
161
- unless ins = xmldoc.at("//preface").children.first
162
- xmldoc.at("//preface") << " "
163
- ins = xmldoc.at("//preface").children.first
164
- end
158
+ ins = insert_before(xmldoc, "//preface")
165
159
  xmldoc.xpath("//preface//*[@beforeclauses = 'true']").each do |x|
166
160
  x.delete("beforeclauses")
167
161
  ins.previous = x.remove
168
162
  end
163
+ xmldoc.xpath("//*[@coverpage = 'true']").each do |x|
164
+ ins.previous = x.remove
165
+ end
169
166
  end
170
167
 
171
168
  def sections_clausebefore_cleanup(xmldoc)
172
169
  return unless xmldoc.at("//sections")
173
170
 
174
- unless ins = xmldoc.at("//sections").children.first
175
- xmldoc.at("//sections") << " "
176
- ins = xmldoc.at("//sections").children.first
177
- end
171
+ ins = insert_before(xmldoc, "//sections")
178
172
  xmldoc.xpath("//sections//*[@beforeclauses = 'true']").each do |x|
179
173
  x.delete("beforeclauses")
180
174
  ins.previous = x.remove
181
175
  end
182
176
  end
183
177
 
178
+ def insert_before(xmldoc, xpath)
179
+ unless ins = xmldoc.at(xpath).children.first
180
+ xmldoc.at(xpath) << " "
181
+ ins = xmldoc.at(xpath).children.first
182
+ end
183
+ ins
184
+ end
185
+
184
186
  def floatingtitle_cleanup(xmldoc)
185
187
  pop_floating_title(xmldoc)
186
188
  floating_title_preface2sections(xmldoc)
@@ -93,7 +93,9 @@ module Metanorma
93
93
  def termnote_example_cleanup(xmldoc)
94
94
  %w(note example).each do |w|
95
95
  xmldoc.xpath("//term#{w}[not(ancestor::term)]").each do |x|
96
- x.name = w
96
+ if x["keepasterm"] then x.delete("keepasterm")
97
+ else x.name = w
98
+ end
97
99
  end
98
100
  end
99
101
  end
@@ -5,8 +5,11 @@ module Metanorma
5
5
  text = result.flatten.map { |l| l.sub(/\s*\Z/, "") } * "\n"
6
6
  !@keepasciimath and text = asciimath2mathml(text)
7
7
  text = text.gsub(/\s+<fn /, "<fn ")
8
- text.gsub(%r{<passthrough\s+formats="metanorma">([^<]*)
9
- </passthrough>}mx) { HTMLEntities.new.decode($1) }
8
+ %w(passthrough passthrough-inline).each do |v|
9
+ text.gsub!(%r{<#{v}\s+formats="metanorma">([^<]*)
10
+ </#{v}>}mx) { HTMLEntities.new.decode($1) }
11
+ end
12
+ text
10
13
  end
11
14
 
12
15
  def smartquotes_cleanup(xmldoc)
@@ -33,7 +36,8 @@ module Metanorma
33
36
 
34
37
  def uninterrupt_quotes_around_xml_skip(elem)
35
38
  !(/\A['"]/.match?(elem.text) &&
36
- elem.previous.ancestors("pre, tt, sourcecode, stem, figure, bibdata")
39
+ elem.previous.ancestors("pre, tt, sourcecode, stem, figure, bibdata,
40
+ passthrough, identifer")
37
41
  .empty? &&
38
42
  ((elem.previous.text.strip.empty? &&
39
43
  !empty_tag_with_text_content?(elem.previous)) ||
@@ -70,7 +74,8 @@ module Metanorma
70
74
  empty_tag_with_text_content?(x) and prev = "dummy"
71
75
  next unless x.text?
72
76
 
73
- x.ancestors("pre, tt, sourcecode, stem, figure, bibdata").empty? and
77
+ x.ancestors("pre, tt, sourcecode, stem, figure, bibdata, passthrough,
78
+ identifier").empty? and
74
79
  dumb2smart_quotes1(x, prev)
75
80
  prev = x.text if x.ancestors("index").empty?
76
81
  end
@@ -36,6 +36,7 @@ module Metanorma
36
36
  inline_macro Metanorma::Standoc::DomainTermInlineMacro
37
37
  inline_macro Metanorma::Standoc::InheritInlineMacro
38
38
  inline_macro Metanorma::Standoc::HTML5RubyMacro
39
+ inline_macro Metanorma::Standoc::IdentifierInlineMacro
39
40
  inline_macro Metanorma::Standoc::ConceptInlineMacro
40
41
  inline_macro Metanorma::Standoc::AutonumberInlineMacro
41
42
  inline_macro Metanorma::Standoc::VariantInlineMacro
@@ -63,6 +64,7 @@ module Metanorma
63
64
  block Metanorma::Plugin::Lutaml::LutamlDiagramBlock
64
65
  block Metanorma::Standoc::PseudocodeBlockMacro
65
66
  preprocessor Metanorma::Standoc::EmbedIncludeProcessor
67
+ preprocessor Metanorma::Standoc::NamedEscapePreprocessor
66
68
  end
67
69
 
68
70
  include ::Asciidoctor::Converter
@@ -79,7 +79,8 @@ module Metanorma
79
79
  end
80
80
 
81
81
  def inline_anchor_bibref(node)
82
- eref_contents = (node.text || node.target || node.id)
82
+ eref_contents = HTMLEntities.new
83
+ .decode(node.text || node.target || node.id)
83
84
  &.sub(/^\[?([^\[\]]+?)\]?$/, "[\\1]")
84
85
  @refids << (node.target || node.id)
85
86
  noko do |xml|
@@ -32,6 +32,43 @@
32
32
  <ref name="DocumentType"/>
33
33
  </element>
34
34
  </define>
35
+ <define name="admonition">
36
+ <element name="admonition">
37
+ <attribute name="type">
38
+ <ref name="AdmonitionType"/>
39
+ </attribute>
40
+ <optional>
41
+ <attribute name="class"/>
42
+ </optional>
43
+ <attribute name="id">
44
+ <data type="ID"/>
45
+ </attribute>
46
+ <optional>
47
+ <attribute name="uri">
48
+ <data type="anyURI"/>
49
+ </attribute>
50
+ </optional>
51
+ <optional>
52
+ <attribute name="coverpage">
53
+ <data type="boolean"/>
54
+ </attribute>
55
+ </optional>
56
+ <optional>
57
+ <attribute name="notag">
58
+ <data type="boolean"/>
59
+ </attribute>
60
+ </optional>
61
+ <optional>
62
+ <ref name="tname"/>
63
+ </optional>
64
+ <zeroOrMore>
65
+ <ref name="paragraph-with-footnote"/>
66
+ </zeroOrMore>
67
+ <zeroOrMore>
68
+ <ref name="note"/>
69
+ </zeroOrMore>
70
+ </element>
71
+ </define>
35
72
  <define name="index">
36
73
  <element name="index">
37
74
  <optional>
@@ -245,6 +282,9 @@
245
282
  <ref name="MultilingualRenderingType"/>
246
283
  </attribute>
247
284
  </optional>
285
+ <optional>
286
+ <ref name="tname"/>
287
+ </optional>
248
288
  <oneOrMore>
249
289
  <ref name="ul_li"/>
250
290
  </oneOrMore>
@@ -287,6 +327,9 @@
287
327
  </choice>
288
328
  </attribute>
289
329
  </optional>
330
+ <optional>
331
+ <ref name="tname"/>
332
+ </optional>
290
333
  <oneOrMore>
291
334
  <ref name="li"/>
292
335
  </oneOrMore>
@@ -323,6 +366,9 @@
323
366
  <ref name="MultilingualRenderingType"/>
324
367
  </attribute>
325
368
  </optional>
369
+ <optional>
370
+ <ref name="tname"/>
371
+ </optional>
326
372
  <oneOrMore>
327
373
  <ref name="dt"/>
328
374
  <ref name="dd"/>
@@ -851,6 +897,16 @@
851
897
  <ref name="MultilingualRenderingType"/>
852
898
  </attribute>
853
899
  </optional>
900
+ <optional>
901
+ <attribute name="coverpage">
902
+ <data type="boolean"/>
903
+ </attribute>
904
+ </optional>
905
+ <optional>
906
+ <attribute name="notag">
907
+ <data type="boolean"/>
908
+ </attribute>
909
+ </optional>
854
910
  <oneOrMore>
855
911
  <choice>
856
912
  <ref name="paragraph"/>
@@ -1178,6 +1234,7 @@
1178
1234
  <ref name="concept"/>
1179
1235
  <ref name="add"/>
1180
1236
  <ref name="del"/>
1237
+ <ref name="span"/>
1181
1238
  </choice>
1182
1239
  </define>
1183
1240
  <define name="add">
@@ -1204,6 +1261,14 @@
1204
1261
  </choice>
1205
1262
  </element>
1206
1263
  </define>
1264
+ <define name="span">
1265
+ <element name="span">
1266
+ <attribute name="class"/>
1267
+ <oneOrMore>
1268
+ <ref name="TextElement"/>
1269
+ </oneOrMore>
1270
+ </element>
1271
+ </define>
1207
1272
  <define name="concept">
1208
1273
  <element name="concept">
1209
1274
  <optional>