metanorma-standoc 1.5.1 → 1.6.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +62 -0
  3. data/lib/asciidoctor/standoc/base.rb +7 -2
  4. data/lib/asciidoctor/standoc/basicdoc.rng +23 -0
  5. data/lib/asciidoctor/standoc/cleanup.rb +32 -12
  6. data/lib/asciidoctor/standoc/cleanup_amend.rb +54 -0
  7. data/lib/asciidoctor/standoc/cleanup_block.rb +0 -2
  8. data/lib/asciidoctor/standoc/cleanup_boilerplate.rb +14 -0
  9. data/lib/asciidoctor/standoc/cleanup_footnotes.rb +11 -3
  10. data/lib/asciidoctor/standoc/cleanup_inline.rb +62 -1
  11. data/lib/asciidoctor/standoc/cleanup_ref.rb +6 -5
  12. data/lib/asciidoctor/standoc/cleanup_section.rb +19 -3
  13. data/lib/asciidoctor/standoc/cleanup_terms.rb +2 -2
  14. data/lib/asciidoctor/standoc/converter.rb +4 -2
  15. data/lib/asciidoctor/standoc/front.rb +9 -3
  16. data/lib/asciidoctor/standoc/front_contributor.rb +58 -18
  17. data/lib/asciidoctor/standoc/inline.rb +21 -31
  18. data/lib/asciidoctor/standoc/isodoc.rng +125 -58
  19. data/lib/asciidoctor/standoc/log.rb +10 -1
  20. data/lib/asciidoctor/standoc/macros.rb +44 -33
  21. data/lib/asciidoctor/standoc/ref.rb +39 -44
  22. data/lib/asciidoctor/standoc/ref_sect.rb +12 -5
  23. data/lib/asciidoctor/standoc/section.rb +11 -10
  24. data/lib/asciidoctor/standoc/table.rb +3 -2
  25. data/lib/asciidoctor/standoc/utils.rb +2 -1
  26. data/lib/asciidoctor/standoc/validate.rb +30 -18
  27. data/lib/asciidoctor/standoc/validate_section.rb +1 -1
  28. data/lib/asciidoctor/standoc/views/datamodel/model_representation.adoc.erb +10 -10
  29. data/lib/liquid/custom_blocks/key_iterator.rb +21 -0
  30. data/lib/liquid/custom_blocks/with_json_nested_context.rb +18 -0
  31. data/lib/liquid/custom_blocks/with_yaml_nested_context.rb +19 -0
  32. data/lib/liquid/custom_filters/values.rb +7 -0
  33. data/lib/metanorma/standoc.rb +0 -5
  34. data/lib/metanorma/standoc/version.rb +20 -1
  35. data/metanorma-standoc.gemspec +4 -4
  36. data/spec/asciidoctor-standoc/base_spec.rb +248 -10
  37. data/spec/asciidoctor-standoc/blocks_spec.rb +263 -144
  38. data/spec/asciidoctor-standoc/cleanup_spec.rb +199 -50
  39. data/spec/asciidoctor-standoc/inline_spec.rb +132 -5
  40. data/spec/asciidoctor-standoc/isobib_cache_spec.rb +13 -27
  41. data/spec/asciidoctor-standoc/macros_json2text_spec.rb +10 -0
  42. data/spec/asciidoctor-standoc/macros_spec.rb +43 -23
  43. data/spec/asciidoctor-standoc/macros_yaml2text_spec.rb +6 -561
  44. data/spec/asciidoctor-standoc/refs_dl_spec.rb +5 -3
  45. data/spec/asciidoctor-standoc/refs_spec.rb +268 -57
  46. data/spec/asciidoctor-standoc/section_spec.rb +0 -1
  47. data/spec/asciidoctor-standoc/table_spec.rb +119 -113
  48. data/spec/asciidoctor-standoc/validate_spec.rb +27 -1
  49. data/spec/examples/codes_table.html +1365 -1365
  50. data/spec/fixtures/macros_datamodel/address_class_profile.xml +46 -46
  51. data/spec/fixtures/macros_datamodel/address_component_profile.xml +21 -21
  52. data/spec/fixtures/macros_datamodel/blank_definition_profile.xml +21 -21
  53. data/spec/spec_helper.rb +115 -109
  54. data/spec/support/shared_examples/structured_data_2_text_preprocessor.rb +781 -0
  55. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +54 -238
  56. data/spec/vcr_cassettes/isobib_get_123.yml +14 -60
  57. data/spec/vcr_cassettes/isobib_get_123_1.yml +24 -116
  58. data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +361 -0
  59. data/spec/vcr_cassettes/isobib_get_123_2001.yml +14 -60
  60. data/spec/vcr_cassettes/isobib_get_124.yml +11 -57
  61. data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +8 -8
  62. data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +39 -37
  63. metadata +42 -11
  64. data/.github/workflows/macos.yml +0 -46
  65. data/.github/workflows/ubuntu.yml +0 -49
  66. data/.github/workflows/windows.yml +0 -53
  67. data/lib/asciidoctor/standoc/macros_yaml2text.rb +0 -165
  68. data/lib/metanorma/standoc/latexml_requirement.rb +0 -62
  69. data/lib/metanorma/standoc/requirement.rb +0 -13
@@ -1,8 +1,6 @@
1
1
  require "date"
2
- require "nokogiri"
3
2
  require "htmlentities"
4
3
  require "json"
5
- require "pathname"
6
4
  require "open-uri"
7
5
  require "mathml2asciimath"
8
6
 
@@ -107,6 +105,7 @@ module Asciidoctor
107
105
  sections_order_cleanup(x)
108
106
  sections_level_cleanup(x)
109
107
  sections_names_cleanup(x)
108
+ change_clauses(x)
110
109
  end
111
110
 
112
111
  def obligations_cleanup(x)
@@ -141,12 +140,29 @@ module Asciidoctor
141
140
  end
142
141
 
143
142
  def clausebefore_cleanup(xmldoc)
143
+ preface_clausebefore_cleanup(xmldoc)
144
+ sections_clausebefore_cleanup(xmldoc)
145
+ end
146
+
147
+ def preface_clausebefore_cleanup(xmldoc)
148
+ return unless xmldoc.at("//preface")
149
+ unless ins = xmldoc.at("//preface").children.first
150
+ xmldoc.at("//preface") << " "
151
+ ins = xmldoc.at("//preface").children.first
152
+ end
153
+ xmldoc.xpath("//preface//*[@beforeclauses = 'true']").each do |x|
154
+ x.delete("beforeclauses")
155
+ ins.previous = x.remove
156
+ end
157
+ end
158
+
159
+ def sections_clausebefore_cleanup(xmldoc)
144
160
  return unless xmldoc.at("//sections")
145
161
  unless ins = xmldoc.at("//sections").children.first
146
162
  xmldoc.at("//sections") << " "
147
163
  ins = xmldoc.at("//sections").children.first
148
164
  end
149
- xmldoc.xpath("//*[@beforeclauses = 'true']").each do |x|
165
+ xmldoc.xpath("//sections//*[@beforeclauses = 'true']").each do |x|
150
166
  x.delete("beforeclauses")
151
167
  ins.previous = x.remove
152
168
  end
@@ -110,8 +110,8 @@ module Asciidoctor
110
110
  end
111
111
  ret = Nokogiri::XML(key.to_xml)
112
112
  HTMLEntities.new.decode(ret.text).
113
- gsub(/[\[\]\{\}<>\(\)]/, "").strip.
114
- gsub(/[[:punct]]|[_^]/, ":\\0").gsub(/`/, "").
113
+ gsub(/[\[\]\{\}<>\(\)]/, "").gsub(/\s/m, "").
114
+ gsub(/[[:punct:]]|[_^]/, ":\\0").gsub(/`/, "").
115
115
  gsub(/[0-9]+/, "þ\\0")
116
116
  end
117
117
 
@@ -23,13 +23,15 @@ module Asciidoctor
23
23
  Asciidoctor::Extensions.register do
24
24
  preprocessor Asciidoctor::Standoc::Datamodel::AttributesTablePreprocessor
25
25
  preprocessor Asciidoctor::Standoc::Datamodel::DiagramPreprocessor
26
- preprocessor Asciidoctor::Standoc::Yaml2TextPreprocessor
26
+ preprocessor Metanorma::Plugin::Datastruct::Json2TextPreprocessor
27
+ preprocessor Metanorma::Plugin::Datastruct::Yaml2TextPreprocessor
27
28
  inline_macro Asciidoctor::Standoc::AltTermInlineMacro
28
29
  inline_macro Asciidoctor::Standoc::DeprecatedTermInlineMacro
29
30
  inline_macro Asciidoctor::Standoc::DomainTermInlineMacro
30
31
  inline_macro Asciidoctor::Standoc::InheritInlineMacro
31
32
  inline_macro Asciidoctor::Standoc::HTML5RubyMacro
32
33
  inline_macro Asciidoctor::Standoc::ConceptInlineMacro
34
+ inline_macro Asciidoctor::Standoc::AutonumberInlineMacro
33
35
  block Asciidoctor::Standoc::ToDoAdmonitionBlock
34
36
  treeprocessor Asciidoctor::Standoc::ToDoInlineAdmonitionBlock
35
37
  block Asciidoctor::Standoc::PlantUMLBlockMacro
@@ -65,7 +67,7 @@ module Asciidoctor
65
67
  attr_accessor :_file
66
68
  end
67
69
 
68
- def self.inherited( k )
70
+ def self.inherited(k)
69
71
  k._file = caller_locations.first.absolute_path
70
72
  end
71
73
 
@@ -17,6 +17,11 @@ module Asciidoctor
17
17
  xml.docnumber node.attr("docnumber")
18
18
  end
19
19
 
20
+ def metadata_other_id(node, xml)
21
+ a = node.attr("isbn") and xml.docidentifier a, type: "ISBN"
22
+ a = node.attr("isbn10") and xml.docidentifier a, type: "ISBN10"
23
+ end
24
+
20
25
  def metadata_version(node, xml)
21
26
  xml.edition node.attr("edition") if node.attr("edition")
22
27
  xml.version do |v|
@@ -27,7 +32,7 @@ module Asciidoctor
27
32
 
28
33
  def metadata_status(node, xml)
29
34
  xml.status do |s|
30
- s.stage ( node.attr("status") || node.attr("docstage") || "published" )
35
+ s.stage (node.attr("status") || node.attr("docstage") || "published")
31
36
  node.attr("docsubstage") and s.substage node.attr("docsubstage")
32
37
  node.attr("iteration") and s.iteration node.attr("iteration")
33
38
  end
@@ -138,6 +143,7 @@ module Asciidoctor
138
143
  title node, xml
139
144
  metadata_source(node, xml)
140
145
  metadata_id(node, xml)
146
+ metadata_other_id(node, xml)
141
147
  metadata_date(node, xml)
142
148
  metadata_author(node, xml)
143
149
  metadata_publisher(node, xml)
@@ -180,8 +186,8 @@ module Asciidoctor
180
186
  ["en"].each do |lang|
181
187
  at = { language: lang, format: "text/plain" }
182
188
  xml.title **attr_code(at) do |t|
183
- t << (Utils::asciidoc_sub(node.attr("title") || node.attr("title-en")) ||
184
- node.title)
189
+ t << (Utils::asciidoc_sub(node.attr("title") ||
190
+ node.attr("title-en")) || node.title)
185
191
  end
186
192
  end
187
193
  end
@@ -21,22 +21,45 @@ module Asciidoctor
21
21
  end
22
22
  end
23
23
 
24
- def organization(org, orgname)
24
+ def organization(org, orgname, node = nil, default_org = nil)
25
+ abbrevs = org_abbrev
26
+ n = abbrevs.invert[orgname] and orgname = n
25
27
  org.name orgname
28
+ default_org and a = node.attr("subdivision") and org.subdivision a
29
+ abbr = org_abbrev[orgname]
30
+ default_org && b = node.attr("subdivision-abbr") and abbr = b
31
+ abbr and org.abbreviation abbr
32
+ default_org and org_address(node, org)
33
+ end
34
+
35
+ def org_address(node, p)
36
+ node.attr("pub-address") and p.address do |ad|
37
+ ad.formattedAddress do |f|
38
+ f << node.attr("pub-address").gsub(/ \+\n/, "<br/>")
39
+ end
40
+ end
41
+ node.attr("pub-phone") and p.phone node.attr("pub-phone")
42
+ node.attr("pub-fax") and p.phone node.attr("pub-fax"), **{type: "fax"}
43
+ node.attr("pub-email") and p.email node.attr("pub-email")
44
+ node.attr("pub-uri") and p.uri node.attr("pub-uri")
26
45
  end
27
46
 
28
47
  # , " => ," : CSV definition does not deal with space followed by quote
29
48
  # at start of field
30
49
  def csv_split(s, delim = ",")
31
- CSV.parse_line(s&.gsub(/, "(?!")/, ',"'), liberal_parsing: true,
32
- col_sep: delim)&.map { |x| x.strip }
50
+ CSV.parse_line(s&.gsub(/, "(?!")/, ',"'),
51
+ liberal_parsing: true,
52
+ col_sep: delim)&.compact&.map { |x| x.strip }
33
53
  end
34
54
 
35
55
  def metadata_author(node, xml)
36
- csv_split(node.attr("publisher") || default_publisher || "")&.each do |p|
56
+ csv_split(node.attr("publisher") || default_publisher || "")&.
57
+ each do |p|
37
58
  xml.contributor do |c|
38
59
  c.role **{ type: "author" }
39
- c.organization { |a| organization(a, p) }
60
+ c.organization do |a|
61
+ organization(a, p, node, !node.attr("publisher"))
62
+ end
40
63
  end
41
64
  end
42
65
  personal_author(node, xml)
@@ -52,18 +75,26 @@ module Asciidoctor
52
75
  end
53
76
  end
54
77
 
78
+ def personal_role(node, c, suffix)
79
+ c.role **{ type: node.attr("role#{suffix}")&.downcase || "author" }
80
+ end
81
+
82
+ def personal_contact(node, suffix, p)
83
+ node.attr("phone#{suffix}") and p.phone node.attr("phone#{suffix}")
84
+ node.attr("fax#{suffix}") and
85
+ p.phone node.attr("fax#{suffix}"), **{type: "fax"}
86
+ node.attr("email#{suffix}") and p.email node.attr("email#{suffix}")
87
+ node.attr("contributor-uri#{suffix}") and
88
+ p.uri node.attr("contributor-uri#{suffix}")
89
+ end
90
+
55
91
  def personal_author1(node, xml, suffix)
56
92
  xml.contributor do |c|
57
- c.role **{ type: node.attr("role#{suffix}")&.downcase || "author" }
93
+ personal_role(node, c, suffix)
58
94
  c.person do |p|
59
95
  person_name(node, xml, suffix, p)
60
96
  person_affiliation(node, xml, suffix, p)
61
- node.attr("phone#{suffix}") and p.phone node.attr("phone#{suffix}")
62
- node.attr("fax#{suffix}") and
63
- p.phone node.attr("fax#{suffix}"), **{type: "fax"}
64
- node.attr("email#{suffix}") and p.email node.attr("email#{suffix}")
65
- node.attr("contributor-uri#{suffix}") and
66
- p.uri node.attr("contributor-uri#{suffix}")
97
+ personal_contact(node, suffix, p)
67
98
  end
68
99
  end
69
100
  end
@@ -87,7 +118,9 @@ module Asciidoctor
87
118
  abbr = node.attr("affiliation_abbrev#{suffix}") and
88
119
  o.abbreviation abbr
89
120
  node.attr("address#{suffix}") and o.address do |ad|
90
- ad.formattedAddress node.attr("address#{suffix}")
121
+ ad.formattedAddress do |f|
122
+ f << node.attr("address#{suffix}").gsub(/ \+\n/, "<br/>")
123
+ end
91
124
  end
92
125
  end
93
126
  end
@@ -97,24 +130,31 @@ module Asciidoctor
97
130
  nil
98
131
  end
99
132
 
133
+ def org_abbrev
134
+ { }
135
+ end
136
+
100
137
  def metadata_publisher(node, xml)
101
138
  publishers = node.attr("publisher") || default_publisher || return
102
139
  csv_split(publishers)&.each do |p|
103
140
  xml.contributor do |c|
104
141
  c.role **{ type: "publisher" }
105
- c.organization { |a| organization(a, p) }
142
+ c.organization do |a|
143
+ organization(a, p, node, !node.attr("publisher"))
144
+ end
106
145
  end
107
146
  end
108
147
  end
109
148
 
110
149
  def metadata_copyright(node, xml)
111
- publishers = node.attr("copyright-holder") || node.attr("publisher") ||
112
- default_publisher || "-"
113
- csv_split(publishers)&.each do |p|
150
+ pub = node.attr("copyright-holder") || node.attr("publisher")
151
+ csv_split(pub || default_publisher || "-")&.each do |p|
114
152
  xml.copyright do |c|
115
153
  c.from (node.attr("copyright-year") || Date.today.year)
116
154
  p.match(/[A-Za-z]/).nil? or c.owner do |owner|
117
- owner.organization { |o| organization(o, p) }
155
+ owner.organization do |a|
156
+ organization(a, p, node, !pub)
157
+ end
118
158
  end
119
159
  end
120
160
  end
@@ -3,7 +3,8 @@ require "htmlentities"
3
3
  require "unicode2latex"
4
4
  require "mime/types"
5
5
  require "base64"
6
- require 'English'
6
+ require "English"
7
+ require "latexmath"
7
8
 
8
9
  module Asciidoctor
9
10
  module Standoc
@@ -32,18 +33,28 @@ module Asciidoctor
32
33
  end
33
34
 
34
35
  def inline_anchor_xref(node)
35
- m = /^(?<case>capital%|lowercase%)?(?<fn>fn(:\s*(?<text>.*))?)?$/.match node.text
36
- casing = m.nil? ? nil : m[:case]&.sub(/%$/, "")
37
- f = (m.nil? || m[:fn].nil?) ? "inline" : "footnote"
38
- c = (!m.nil? && (!m[:fn].nil? || !m[:case].nil?)) ? m[:text] : node.text
39
- t = node.target.gsub(/^#/, "").gsub(%r{(\.xml|\.adoc)(#.*$)}, "\\2")
40
36
  noko do |xml|
41
- xml.xref **attr_code(target: t, type: f, case: casing) do |x|
37
+ attrs = inline_anchor_xref_attrs(node)
38
+ c = attrs[:text]
39
+ attrs.delete(:text) unless c.nil?
40
+ xml.xref **attr_code(attrs) do |x|
42
41
  x << c
43
42
  end
44
43
  end.join
45
44
  end
46
45
 
46
+ def inline_anchor_xref_attrs(node)
47
+ m = /^(?<drop>droploc%)?(?<case>capital%|lowercase%)?(?<drop2>droploc%)?
48
+ (?<fn>fn(:\s*(?<text>.*))?)?$/x.match node.text
49
+ casing = m.nil? ? nil : m[:case]&.sub(/%$/, "")
50
+ droploc = m.nil? ? nil : ((m[:drop].nil? && m[:drop2].nil?) ? nil: true)
51
+ f = (m.nil? || m[:fn].nil?) ? "inline" : "footnote"
52
+ c = (!m.nil? && (%i[case fn drop drop2].any? { |x| !m[x].nil? })) ?
53
+ m[:text] : node.text
54
+ t = node.target.gsub(/^#/, "").gsub(%r{(\.xml|\.adoc)(#.*$)}, "\\2")
55
+ { target: t, type: f, case: casing, droploc: droploc, text: c }
56
+ end
57
+
47
58
  def inline_anchor_link(node)
48
59
  contents = node.text
49
60
  contents = "" if node.target.gsub(%r{^mailto:}, "") == node.text
@@ -105,33 +116,12 @@ module Asciidoctor
105
116
  HTMLEntities.new.encode(text, :basic, :hexadecimal).
106
117
  gsub(/&amp;gt;/, ">").gsub(/\&amp;lt;/, "<").gsub(/&amp;amp;/, "&").
107
118
  gsub(/&gt;/, ">").gsub(/&lt;/, "<").gsub(/&amp;/, "&").
108
- gsub(/&quot;/, '"').gsub(/&#xa;/, "\n")
109
- end
110
-
111
- def latex_run1(lxm_input, cmd)
112
- IO.popen(cmd, "r+", external_encoding: "UTF-8") do |io|
113
- io.write(lxm_input)
114
- io.close_write
115
- io.read
116
- end
117
- end
118
-
119
- def latex_run(lxm_input)
120
- results = nil
121
- Metanorma::Standoc::Requirements[:latexml].cmd.each_with_index do |cmd, i|
122
- warn "Retrying with #{cmd}" if i > 0
123
- results = latex_run1(lxm_input, cmd)
124
- if $CHILD_STATUS.to_i.zero?
125
- warn "Success!" if i > 0
126
- break
127
- end
128
- end
129
- $CHILD_STATUS.to_i.zero? ? results : nil
119
+ gsub(/&quot;/, '"').gsub(/&#xa;/, "\n").gsub(/&amp;#/, "&#")
130
120
  end
131
121
 
132
122
  def latex_parse(text)
133
123
  lxm_input = Unicode2LaTeX.unicode2latex(HTMLEntities.new.decode(text))
134
- results = latex_run(lxm_input)
124
+ results = Latexmath.parse(lxm_input).to_mathml
135
125
  results.nil? and
136
126
  @log.add('Math', nil,
137
127
  "latexmlmath failed to process equation:\n#{lxm_input}")
@@ -151,7 +141,7 @@ module Asciidoctor
151
141
  s.parent.children = math
152
142
  end
153
143
  else
154
- xml.stem text, **{ type: "AsciiMath" }
144
+ xml.stem text&.gsub(/\&amp;#/, "&#"), **{ type: "AsciiMath" }
155
145
  end
156
146
  end
157
147
 
@@ -43,7 +43,9 @@
43
43
  <define name="xref">
44
44
  <element name="xref">
45
45
  <attribute name="target">
46
- <data type="IDREF"/>
46
+ <data type="string">
47
+ <param name="pattern">\i\c*|\c+#\c+</param>
48
+ </data>
47
49
  </attribute>
48
50
  <optional>
49
51
  <attribute name="type">
@@ -61,6 +63,11 @@
61
63
  </choice>
62
64
  </attribute>
63
65
  </optional>
66
+ <optional>
67
+ <attribute name="droploc">
68
+ <data type="boolean"/>
69
+ </attribute>
70
+ </optional>
64
71
  <text/>
65
72
  </element>
66
73
  </define>
@@ -578,6 +585,8 @@
578
585
  <ref name="ol"/>
579
586
  <ref name="dl"/>
580
587
  <ref name="formula"/>
588
+ <ref name="quote"/>
589
+ <ref name="sourcecode"/>
581
590
  </choice>
582
591
  </oneOrMore>
583
592
  </element>
@@ -661,6 +670,16 @@
661
670
  </choice>
662
671
  </attribute>
663
672
  </optional>
673
+ <optional>
674
+ <attribute name="valign">
675
+ <choice>
676
+ <value>top</value>
677
+ <value>middle</value>
678
+ <value>bottom</value>
679
+ <value>baseline</value>
680
+ </choice>
681
+ </attribute>
682
+ </optional>
664
683
  <choice>
665
684
  <zeroOrMore>
666
685
  <choice>
@@ -697,6 +716,16 @@
697
716
  </choice>
698
717
  </attribute>
699
718
  </optional>
719
+ <optional>
720
+ <attribute name="valign">
721
+ <choice>
722
+ <value>top</value>
723
+ <value>middle</value>
724
+ <value>bottom</value>
725
+ <value>baseline</value>
726
+ </choice>
727
+ </attribute>
728
+ </optional>
700
729
  <choice>
701
730
  <zeroOrMore>
702
731
  <choice>
@@ -834,6 +863,13 @@
834
863
  </define>
835
864
  <define name="standard-document">
836
865
  <element name="standard-document">
866
+ <attribute name="version"/>
867
+ <attribute name="type">
868
+ <choice>
869
+ <value>semantic</value>
870
+ <value>presentation</value>
871
+ </choice>
872
+ </attribute>
837
873
  <ref name="bibdata"/>
838
874
  <optional>
839
875
  <ref name="boilerplate"/>
@@ -855,7 +891,7 @@
855
891
  <oneOrMore>
856
892
  <choice>
857
893
  <ref name="content"/>
858
- <ref name="preface_abstract"/>
894
+ <ref name="abstract"/>
859
895
  <ref name="foreword"/>
860
896
  <ref name="introduction"/>
861
897
  <ref name="acknowledgements"/>
@@ -1049,14 +1085,17 @@
1049
1085
  <ref name="section-title"/>
1050
1086
  </optional>
1051
1087
  <group>
1052
- <group>
1053
- <zeroOrMore>
1054
- <ref name="BasicBlock"/>
1055
- </zeroOrMore>
1056
- <zeroOrMore>
1057
- <ref name="note"/>
1058
- </zeroOrMore>
1059
- </group>
1088
+ <choice>
1089
+ <group>
1090
+ <zeroOrMore>
1091
+ <ref name="BasicBlock"/>
1092
+ </zeroOrMore>
1093
+ <zeroOrMore>
1094
+ <ref name="note"/>
1095
+ </zeroOrMore>
1096
+ </group>
1097
+ <ref name="amend"/>
1098
+ </choice>
1060
1099
  <zeroOrMore>
1061
1100
  <choice>
1062
1101
  <ref name="clause-subsection"/>
@@ -1125,49 +1164,7 @@
1125
1164
  </define>
1126
1165
  <define name="annex">
1127
1166
  <element name="annex">
1128
- <optional>
1129
- <attribute name="id">
1130
- <data type="ID"/>
1131
- </attribute>
1132
- </optional>
1133
- <optional>
1134
- <attribute name="language"/>
1135
- </optional>
1136
- <optional>
1137
- <attribute name="script"/>
1138
- </optional>
1139
- <optional>
1140
- <attribute name="inline-header">
1141
- <data type="boolean"/>
1142
- </attribute>
1143
- </optional>
1144
- <attribute name="obligation">
1145
- <choice>
1146
- <value>normative</value>
1147
- <value>informative</value>
1148
- </choice>
1149
- </attribute>
1150
- <optional>
1151
- <ref name="section-title"/>
1152
- </optional>
1153
- <group>
1154
- <group>
1155
- <zeroOrMore>
1156
- <ref name="BasicBlock"/>
1157
- </zeroOrMore>
1158
- <zeroOrMore>
1159
- <ref name="note"/>
1160
- </zeroOrMore>
1161
- </group>
1162
- <zeroOrMore>
1163
- <choice>
1164
- <ref name="annex-subsection"/>
1165
- <ref name="terms"/>
1166
- <ref name="definitions"/>
1167
- <ref name="references"/>
1168
- </choice>
1169
- </zeroOrMore>
1170
- </group>
1167
+ <ref name="Annex-Section"/>
1171
1168
  </element>
1172
1169
  </define>
1173
1170
  <define name="terms">
@@ -1453,11 +1450,6 @@
1453
1450
  </optional>
1454
1451
  </element>
1455
1452
  </define>
1456
- <define name="preface_abstract">
1457
- <element name="abstract">
1458
- <ref name="Basic-Section"/>
1459
- </element>
1460
- </define>
1461
1453
  <define name="term-clause">
1462
1454
  <element name="clause">
1463
1455
  <optional>
@@ -1507,4 +1499,79 @@
1507
1499
  <ref name="CitationType"/>
1508
1500
  </element>
1509
1501
  </define>
1502
+ <define name="amend">
1503
+ <element name="amend">
1504
+ <optional>
1505
+ <attribute name="id">
1506
+ <data type="ID"/>
1507
+ </attribute>
1508
+ </optional>
1509
+ <attribute name="change">
1510
+ <choice>
1511
+ <value>add</value>
1512
+ <value>modify</value>
1513
+ <value>delete</value>
1514
+ </choice>
1515
+ </attribute>
1516
+ <optional>
1517
+ <attribute name="path"/>
1518
+ </optional>
1519
+ <optional>
1520
+ <attribute name="path_end"/>
1521
+ </optional>
1522
+ <optional>
1523
+ <attribute name="title"/>
1524
+ </optional>
1525
+ <optional>
1526
+ <element name="location">
1527
+ <zeroOrMore>
1528
+ <ref name="locality"/>
1529
+ </zeroOrMore>
1530
+ </element>
1531
+ </optional>
1532
+ <zeroOrMore>
1533
+ <ref name="autonumber"/>
1534
+ </zeroOrMore>
1535
+ <optional>
1536
+ <element name="description">
1537
+ <zeroOrMore>
1538
+ <ref name="BasicBlock"/>
1539
+ </zeroOrMore>
1540
+ </element>
1541
+ </optional>
1542
+ <optional>
1543
+ <element name="newcontent">
1544
+ <zeroOrMore>
1545
+ <ref name="BasicBlock"/>
1546
+ </zeroOrMore>
1547
+ </element>
1548
+ </optional>
1549
+ <optional>
1550
+ <element name="description">
1551
+ <zeroOrMore>
1552
+ <ref name="BasicBlock"/>
1553
+ </zeroOrMore>
1554
+ </element>
1555
+ </optional>
1556
+ </element>
1557
+ </define>
1558
+ <define name="autonumber">
1559
+ <element name="autonumber">
1560
+ <attribute name="type">
1561
+ <choice>
1562
+ <value>requirement</value>
1563
+ <value>recommendation</value>
1564
+ <value>permission</value>
1565
+ <value>table</value>
1566
+ <value>figure</value>
1567
+ <value>admonition</value>
1568
+ <value>formula</value>
1569
+ <value>sourcecode</value>
1570
+ <value>example</value>
1571
+ <value>note</value>
1572
+ </choice>
1573
+ </attribute>
1574
+ <text/>
1575
+ </element>
1576
+ </define>
1510
1577
  </grammar>