metanorma-standoc 1.5.2 → 1.6.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +66 -0
  3. data/README.adoc +1 -3
  4. data/lib/asciidoctor/standoc/base.rb +6 -1
  5. data/lib/asciidoctor/standoc/basicdoc.rng +23 -0
  6. data/lib/asciidoctor/standoc/cleanup.rb +79 -12
  7. data/lib/asciidoctor/standoc/cleanup_amend.rb +54 -0
  8. data/lib/asciidoctor/standoc/cleanup_block.rb +41 -6
  9. data/lib/asciidoctor/standoc/cleanup_boilerplate.rb +14 -0
  10. data/lib/asciidoctor/standoc/cleanup_footnotes.rb +11 -3
  11. data/lib/asciidoctor/standoc/cleanup_inline.rb +11 -2
  12. data/lib/asciidoctor/standoc/cleanup_ref.rb +3 -4
  13. data/lib/asciidoctor/standoc/cleanup_section.rb +1 -2
  14. data/lib/asciidoctor/standoc/converter.rb +6 -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 +135 -58
  19. data/lib/asciidoctor/standoc/lists.rb +4 -2
  20. data/lib/asciidoctor/standoc/macros.rb +59 -33
  21. data/lib/asciidoctor/standoc/ref.rb +41 -46
  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/views/datamodel/model_representation.adoc.erb +10 -10
  26. data/lib/liquid/custom_blocks/key_iterator.rb +21 -0
  27. data/lib/liquid/custom_blocks/with_json_nested_context.rb +18 -0
  28. data/lib/liquid/custom_blocks/with_yaml_nested_context.rb +19 -0
  29. data/lib/liquid/custom_filters/values.rb +7 -0
  30. data/lib/metanorma/standoc.rb +0 -5
  31. data/lib/metanorma/standoc/version.rb +20 -1
  32. data/metanorma-standoc.gemspec +5 -4
  33. data/spec/asciidoctor-standoc/base_spec.rb +246 -9
  34. data/spec/asciidoctor-standoc/blocks_spec.rb +255 -143
  35. data/spec/asciidoctor-standoc/cleanup_sections_spec.rb +1498 -0
  36. data/spec/asciidoctor-standoc/cleanup_spec.rb +409 -1572
  37. data/spec/asciidoctor-standoc/inline_spec.rb +128 -4
  38. data/spec/asciidoctor-standoc/isobib_cache_spec.rb +6 -20
  39. data/spec/asciidoctor-standoc/lists_spec.rb +10 -1
  40. data/spec/asciidoctor-standoc/macros_json2text_spec.rb +10 -0
  41. data/spec/asciidoctor-standoc/macros_lutaml_spec.rb +80 -0
  42. data/spec/asciidoctor-standoc/macros_spec.rb +36 -0
  43. data/spec/asciidoctor-standoc/macros_yaml2text_spec.rb +6 -561
  44. data/spec/asciidoctor-standoc/refs_dl_spec.rb +2 -2
  45. data/spec/asciidoctor-standoc/refs_spec.rb +266 -55
  46. data/spec/asciidoctor-standoc/section_spec.rb +0 -1
  47. data/spec/asciidoctor-standoc/table_spec.rb +112 -112
  48. data/spec/asciidoctor-standoc/validate_spec.rb +5 -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/fixtures/test.exp +121 -0
  54. data/spec/spec_helper.rb +142 -108
  55. data/spec/support/shared_examples/structured_data_2_text_preprocessor.rb +781 -0
  56. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +50 -234
  57. data/spec/vcr_cassettes/isobib_get_123.yml +13 -59
  58. data/spec/vcr_cassettes/isobib_get_123_1.yml +23 -115
  59. data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +361 -0
  60. data/spec/vcr_cassettes/isobib_get_123_2001.yml +11 -57
  61. data/spec/vcr_cassettes/isobib_get_124.yml +13 -59
  62. data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +8 -8
  63. data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +50 -36
  64. metadata +59 -11
  65. data/.github/workflows/macos.yml +0 -46
  66. data/.github/workflows/ubuntu.yml +0 -49
  67. data/.github/workflows/windows.yml +0 -53
  68. data/lib/asciidoctor/standoc/macros_yaml2text.rb +0 -165
  69. data/lib/metanorma/standoc/latexml_requirement.rb +0 -62
  70. data/lib/metanorma/standoc/requirement.rb +0 -13
@@ -1,10 +1,7 @@
1
1
  require "date"
2
- require "nokogiri"
3
2
  require "htmlentities"
4
3
  require "json"
5
- require "pathname"
6
4
  require "open-uri"
7
- require "pp"
8
5
 
9
6
  module Asciidoctor
10
7
  module Standoc
@@ -75,7 +72,18 @@ module Asciidoctor
75
72
  end
76
73
  end
77
74
 
75
+ def title_footnote_move(xmldoc)
76
+ ins = xmldoc.at("//bibdata/language")
77
+ xmldoc.xpath("//bibdata/title//fn").each do |f|
78
+ f.name = "note"
79
+ f["type"] = "title-footnote"
80
+ f.delete("reference")
81
+ ins.previous = f.remove
82
+ end
83
+ end
84
+
78
85
  def footnote_cleanup(xmldoc)
86
+ title_footnote_move(xmldoc)
79
87
  table_footnote_renumber(xmldoc)
80
88
  other_footnote_renumber(xmldoc)
81
89
  xmldoc.xpath("//fn").each do |fn|
@@ -49,7 +49,15 @@ module Asciidoctor
49
49
  end
50
50
 
51
51
  def extract_localities(x)
52
- text = x&.children&.first&.remove&.text
52
+ f = x&.children&.first or return
53
+ f.text? or return
54
+ head = f.remove.text
55
+ tail = x&.children&.remove
56
+ extract_localities1(x, head)
57
+ tail and x << tail
58
+ end
59
+
60
+ def extract_localities1(x, text)
53
61
  b = x.add_child("<localityStack/>").first if LOCALITY_RE.match text
54
62
  while (m = LOCALITY_RE.match text)
55
63
  ref = m[:ref] ? "<referenceFrom>#{tq m[:ref]}</referenceFrom>" : ""
@@ -142,7 +150,8 @@ module Asciidoctor
142
150
  start = s[0]
143
151
  ret1 = %r([#{NAMECHAR}#]).match(start) ? "_" :
144
152
  (%r([#{NAMESTARTCHAR}#]).match(start) ? "_#{start}" : start)
145
- ret = ret1 + s[1..-1].gsub(%r([#{NAMECHAR}#]), "_")
153
+ ret2 = s[1..-1] || ""
154
+ ret = (ret1 || "") + ret2.gsub(%r([#{NAMECHAR}#]), "_")
146
155
  ret
147
156
  end
148
157
 
@@ -49,9 +49,8 @@ module Asciidoctor
49
49
  # consecutively, but that standards codes are preserved as is:
50
50
  # only numeric references are renumbered
51
51
  def biblio_renumber(xmldoc)
52
- r = xmldoc.at("//references[@normative = 'false'] | "\
53
- "//clause[.//references[@normative = 'false']] | "\
54
- "//annex[.//references[@normative = 'false']]") or return
52
+ r = xmldoc.at("//references | //clause[.//references] | "\
53
+ "//annex[.//references]") or return
55
54
  r.xpath(".//bibitem[not(ancestor::bibitem)]").each_with_index do |b, i|
56
55
  next unless docid = b.at("./docidentifier[@type = 'metanorma']")
57
56
  next unless /^\[\d+\]$/.match(docid.text)
@@ -127,7 +126,7 @@ module Asciidoctor
127
126
  bibitemxml = RelatonBib::BibliographicItem.new(
128
127
  RelatonBib::HashConverter::hash_to_bib(bib)).to_xml or next
129
128
  bibitem = Nokogiri::XML(bibitemxml)
130
- bibitem["id"] = c["id"] if c["id"]
129
+ bibitem.root["id"] = c["id"] if c["id"] && !/^_/.match(c["id"])
131
130
  c.replace(bibitem.root)
132
131
  end
133
132
  end
@@ -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)
@@ -23,13 +23,17 @@ 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
28
+ preprocessor Metanorma::Plugin::Lutaml::LutamlPreprocessor
27
29
  inline_macro Asciidoctor::Standoc::AltTermInlineMacro
28
30
  inline_macro Asciidoctor::Standoc::DeprecatedTermInlineMacro
29
31
  inline_macro Asciidoctor::Standoc::DomainTermInlineMacro
30
32
  inline_macro Asciidoctor::Standoc::InheritInlineMacro
31
33
  inline_macro Asciidoctor::Standoc::HTML5RubyMacro
32
34
  inline_macro Asciidoctor::Standoc::ConceptInlineMacro
35
+ inline_macro Asciidoctor::Standoc::AutonumberInlineMacro
36
+ inline_macro Asciidoctor::Standoc::VariantInlineMacro
33
37
  block Asciidoctor::Standoc::ToDoAdmonitionBlock
34
38
  treeprocessor Asciidoctor::Standoc::ToDoInlineAdmonitionBlock
35
39
  block Asciidoctor::Standoc::PlantUMLBlockMacro
@@ -65,7 +69,7 @@ module Asciidoctor
65
69
  attr_accessor :_file
66
70
  end
67
71
 
68
- def self.inherited( k )
72
+ def self.inherited(k)
69
73
  k._file = caller_locations.first.absolute_path
70
74
  end
71
75
 
@@ -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
 
@@ -24,6 +24,14 @@
24
24
  <start>
25
25
  <ref name="standard-document"/>
26
26
  </start>
27
+ <define name="doctype">
28
+ <element name="doctype">
29
+ <optional>
30
+ <attribute name="abbreviation"/>
31
+ </optional>
32
+ <ref name="DocumentType"/>
33
+ </element>
34
+ </define>
27
35
  <define name="hyperlink">
28
36
  <element name="link">
29
37
  <attribute name="target">
@@ -42,7 +50,6 @@
42
50
  </define>
43
51
  <define name="xref">
44
52
  <element name="xref">
45
- <!-- attribute target { xsd:IDREF }, -->
46
53
  <attribute name="target">
47
54
  <data type="string">
48
55
  <param name="pattern">\i\c*|\c+#\c+</param>
@@ -64,6 +71,11 @@
64
71
  </choice>
65
72
  </attribute>
66
73
  </optional>
74
+ <optional>
75
+ <attribute name="droploc">
76
+ <data type="boolean"/>
77
+ </attribute>
78
+ </optional>
67
79
  <text/>
68
80
  </element>
69
81
  </define>
@@ -137,6 +149,11 @@
137
149
  <data type="boolean"/>
138
150
  </attribute>
139
151
  </optional>
152
+ <optional>
153
+ <attribute name="key">
154
+ <data type="boolean"/>
155
+ </attribute>
156
+ </optional>
140
157
  <oneOrMore>
141
158
  <ref name="dt"/>
142
159
  <ref name="dd"/>
@@ -581,6 +598,8 @@
581
598
  <ref name="ol"/>
582
599
  <ref name="dl"/>
583
600
  <ref name="formula"/>
601
+ <ref name="quote"/>
602
+ <ref name="sourcecode"/>
584
603
  </choice>
585
604
  </oneOrMore>
586
605
  </element>
@@ -664,6 +683,16 @@
664
683
  </choice>
665
684
  </attribute>
666
685
  </optional>
686
+ <optional>
687
+ <attribute name="valign">
688
+ <choice>
689
+ <value>top</value>
690
+ <value>middle</value>
691
+ <value>bottom</value>
692
+ <value>baseline</value>
693
+ </choice>
694
+ </attribute>
695
+ </optional>
667
696
  <choice>
668
697
  <zeroOrMore>
669
698
  <choice>
@@ -700,6 +729,16 @@
700
729
  </choice>
701
730
  </attribute>
702
731
  </optional>
732
+ <optional>
733
+ <attribute name="valign">
734
+ <choice>
735
+ <value>top</value>
736
+ <value>middle</value>
737
+ <value>bottom</value>
738
+ <value>baseline</value>
739
+ </choice>
740
+ </attribute>
741
+ </optional>
703
742
  <choice>
704
743
  <zeroOrMore>
705
744
  <choice>
@@ -837,6 +876,13 @@
837
876
  </define>
838
877
  <define name="standard-document">
839
878
  <element name="standard-document">
879
+ <attribute name="version"/>
880
+ <attribute name="type">
881
+ <choice>
882
+ <value>semantic</value>
883
+ <value>presentation</value>
884
+ </choice>
885
+ </attribute>
840
886
  <ref name="bibdata"/>
841
887
  <optional>
842
888
  <ref name="boilerplate"/>
@@ -858,7 +904,7 @@
858
904
  <oneOrMore>
859
905
  <choice>
860
906
  <ref name="content"/>
861
- <ref name="preface_abstract"/>
907
+ <ref name="abstract"/>
862
908
  <ref name="foreword"/>
863
909
  <ref name="introduction"/>
864
910
  <ref name="acknowledgements"/>
@@ -1052,14 +1098,17 @@
1052
1098
  <ref name="section-title"/>
1053
1099
  </optional>
1054
1100
  <group>
1055
- <group>
1056
- <zeroOrMore>
1057
- <ref name="BasicBlock"/>
1058
- </zeroOrMore>
1059
- <zeroOrMore>
1060
- <ref name="note"/>
1061
- </zeroOrMore>
1062
- </group>
1101
+ <choice>
1102
+ <group>
1103
+ <zeroOrMore>
1104
+ <ref name="BasicBlock"/>
1105
+ </zeroOrMore>
1106
+ <zeroOrMore>
1107
+ <ref name="note"/>
1108
+ </zeroOrMore>
1109
+ </group>
1110
+ <ref name="amend"/>
1111
+ </choice>
1063
1112
  <zeroOrMore>
1064
1113
  <choice>
1065
1114
  <ref name="clause-subsection"/>
@@ -1128,49 +1177,7 @@
1128
1177
  </define>
1129
1178
  <define name="annex">
1130
1179
  <element name="annex">
1131
- <optional>
1132
- <attribute name="id">
1133
- <data type="ID"/>
1134
- </attribute>
1135
- </optional>
1136
- <optional>
1137
- <attribute name="language"/>
1138
- </optional>
1139
- <optional>
1140
- <attribute name="script"/>
1141
- </optional>
1142
- <optional>
1143
- <attribute name="inline-header">
1144
- <data type="boolean"/>
1145
- </attribute>
1146
- </optional>
1147
- <attribute name="obligation">
1148
- <choice>
1149
- <value>normative</value>
1150
- <value>informative</value>
1151
- </choice>
1152
- </attribute>
1153
- <optional>
1154
- <ref name="section-title"/>
1155
- </optional>
1156
- <group>
1157
- <group>
1158
- <zeroOrMore>
1159
- <ref name="BasicBlock"/>
1160
- </zeroOrMore>
1161
- <zeroOrMore>
1162
- <ref name="note"/>
1163
- </zeroOrMore>
1164
- </group>
1165
- <zeroOrMore>
1166
- <choice>
1167
- <ref name="annex-subsection"/>
1168
- <ref name="terms"/>
1169
- <ref name="definitions"/>
1170
- <ref name="references"/>
1171
- </choice>
1172
- </zeroOrMore>
1173
- </group>
1180
+ <ref name="Annex-Section"/>
1174
1181
  </element>
1175
1182
  </define>
1176
1183
  <define name="terms">
@@ -1456,11 +1463,6 @@
1456
1463
  </optional>
1457
1464
  </element>
1458
1465
  </define>
1459
- <define name="preface_abstract">
1460
- <element name="abstract">
1461
- <ref name="Basic-Section"/>
1462
- </element>
1463
- </define>
1464
1466
  <define name="term-clause">
1465
1467
  <element name="clause">
1466
1468
  <optional>
@@ -1510,4 +1512,79 @@
1510
1512
  <ref name="CitationType"/>
1511
1513
  </element>
1512
1514
  </define>
1515
+ <define name="amend">
1516
+ <element name="amend">
1517
+ <optional>
1518
+ <attribute name="id">
1519
+ <data type="ID"/>
1520
+ </attribute>
1521
+ </optional>
1522
+ <attribute name="change">
1523
+ <choice>
1524
+ <value>add</value>
1525
+ <value>modify</value>
1526
+ <value>delete</value>
1527
+ </choice>
1528
+ </attribute>
1529
+ <optional>
1530
+ <attribute name="path"/>
1531
+ </optional>
1532
+ <optional>
1533
+ <attribute name="path_end"/>
1534
+ </optional>
1535
+ <optional>
1536
+ <attribute name="title"/>
1537
+ </optional>
1538
+ <optional>
1539
+ <element name="location">
1540
+ <zeroOrMore>
1541
+ <ref name="locality"/>
1542
+ </zeroOrMore>
1543
+ </element>
1544
+ </optional>
1545
+ <zeroOrMore>
1546
+ <ref name="autonumber"/>
1547
+ </zeroOrMore>
1548
+ <optional>
1549
+ <element name="description">
1550
+ <zeroOrMore>
1551
+ <ref name="BasicBlock"/>
1552
+ </zeroOrMore>
1553
+ </element>
1554
+ </optional>
1555
+ <optional>
1556
+ <element name="newcontent">
1557
+ <zeroOrMore>
1558
+ <ref name="BasicBlock"/>
1559
+ </zeroOrMore>
1560
+ </element>
1561
+ </optional>
1562
+ <optional>
1563
+ <element name="description">
1564
+ <zeroOrMore>
1565
+ <ref name="BasicBlock"/>
1566
+ </zeroOrMore>
1567
+ </element>
1568
+ </optional>
1569
+ </element>
1570
+ </define>
1571
+ <define name="autonumber">
1572
+ <element name="autonumber">
1573
+ <attribute name="type">
1574
+ <choice>
1575
+ <value>requirement</value>
1576
+ <value>recommendation</value>
1577
+ <value>permission</value>
1578
+ <value>table</value>
1579
+ <value>figure</value>
1580
+ <value>admonition</value>
1581
+ <value>formula</value>
1582
+ <value>sourcecode</value>
1583
+ <value>example</value>
1584
+ <value>note</value>
1585
+ </choice>
1586
+ </attribute>
1587
+ <text/>
1588
+ </element>
1589
+ </define>
1513
1590
  </grammar>