metanorma-standoc 1.8.8 → 1.9.4

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 +3 -13
  3. data/.hound.yml +3 -1
  4. data/.rubocop.yml +3 -7
  5. data/Gemfile.devel +0 -0
  6. data/lib/asciidoctor/standoc/base.rb +42 -36
  7. data/lib/asciidoctor/standoc/biblio.rng +1 -0
  8. data/lib/asciidoctor/standoc/blocks.rb +25 -9
  9. data/lib/asciidoctor/standoc/blocks_notes.rb +41 -24
  10. data/lib/asciidoctor/standoc/cleanup.rb +59 -84
  11. data/lib/asciidoctor/standoc/cleanup_block.rb +63 -85
  12. data/lib/asciidoctor/standoc/cleanup_boilerplate.rb +51 -29
  13. data/lib/asciidoctor/standoc/cleanup_footnotes.rb +1 -0
  14. data/lib/asciidoctor/standoc/cleanup_image.rb +71 -0
  15. data/lib/asciidoctor/standoc/cleanup_maths.rb +36 -27
  16. data/lib/asciidoctor/standoc/cleanup_ref.rb +24 -15
  17. data/lib/asciidoctor/standoc/cleanup_ref_dl.rb +1 -1
  18. data/lib/asciidoctor/standoc/cleanup_reqt.rb +47 -0
  19. data/lib/asciidoctor/standoc/cleanup_section.rb +77 -134
  20. data/lib/asciidoctor/standoc/cleanup_section_names.rb +75 -0
  21. data/lib/asciidoctor/standoc/converter.rb +10 -3
  22. data/lib/asciidoctor/standoc/datamodel/plantuml_renderer.rb +67 -66
  23. data/lib/asciidoctor/standoc/front.rb +35 -18
  24. data/lib/asciidoctor/standoc/front_contributor.rb +70 -45
  25. data/lib/asciidoctor/standoc/inline.rb +30 -22
  26. data/lib/asciidoctor/standoc/isodoc.rng +321 -4
  27. data/lib/asciidoctor/standoc/lists.rb +4 -2
  28. data/lib/asciidoctor/standoc/macros.rb +50 -23
  29. data/lib/asciidoctor/standoc/macros_form.rb +63 -0
  30. data/lib/asciidoctor/standoc/ref.rb +87 -112
  31. data/lib/asciidoctor/standoc/ref_date_id.rb +62 -0
  32. data/lib/asciidoctor/standoc/ref_sect.rb +20 -17
  33. data/lib/asciidoctor/standoc/section.rb +3 -1
  34. data/lib/asciidoctor/standoc/term_lookup_cleanup.rb +31 -16
  35. data/lib/asciidoctor/standoc/terms.rb +27 -16
  36. data/lib/asciidoctor/standoc/utils.rb +35 -9
  37. data/lib/asciidoctor/standoc/validate.rb +30 -28
  38. data/lib/metanorma-standoc.rb +0 -1
  39. data/lib/metanorma/standoc/version.rb +5 -5
  40. data/metanorma-standoc.gemspec +11 -11
  41. data/spec/asciidoctor/base_spec.rb +715 -509
  42. data/spec/asciidoctor/blocks_spec.rb +830 -727
  43. data/spec/asciidoctor/cleanup_sections_spec.rb +51 -14
  44. data/spec/asciidoctor/cleanup_spec.rb +1836 -1673
  45. data/spec/asciidoctor/inline_spec.rb +330 -283
  46. data/spec/asciidoctor/isobib_cache_spec.rb +406 -358
  47. data/spec/asciidoctor/lists_spec.rb +3 -3
  48. data/spec/asciidoctor/macros_plantuml_spec.rb +8 -8
  49. data/spec/asciidoctor/macros_spec.rb +546 -444
  50. data/spec/asciidoctor/macros_yaml2text_spec.rb +1 -1
  51. data/spec/asciidoctor/refs_dl_spec.rb +4 -4
  52. data/spec/asciidoctor/refs_spec.rb +1528 -1533
  53. data/spec/asciidoctor/section_spec.rb +778 -689
  54. data/spec/asciidoctor/table_spec.rb +6 -6
  55. data/spec/asciidoctor/validate_spec.rb +296 -304
  56. data/spec/spec_helper.rb +13 -9
  57. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +66 -66
  58. data/spec/vcr_cassettes/isobib_get_123.yml +17 -17
  59. data/spec/vcr_cassettes/isobib_get_123_1.yml +31 -31
  60. data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +40 -40
  61. data/spec/vcr_cassettes/isobib_get_123_2001.yml +17 -17
  62. data/spec/vcr_cassettes/isobib_get_124.yml +16 -16
  63. data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +14 -14
  64. data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +78 -66
  65. metadata +69 -67
  66. data/lib/liquid/custom_blocks/key_iterator.rb +0 -21
  67. data/lib/liquid/custom_blocks/with_json_nested_context.rb +0 -18
  68. data/lib/liquid/custom_blocks/with_yaml_nested_context.rb +0 -19
  69. data/lib/liquid/custom_filters/values.rb +0 -7
@@ -10,18 +10,18 @@ module Asciidoctor
10
10
  module Front
11
11
  def committee_component(compname, node, out)
12
12
  out.send compname.gsub(/-/, "_"), node.attr(compname),
13
- **attr_code(number: node.attr("#{compname}-number"),
14
- type: node.attr("#{compname}-type"))
13
+ **attr_code(number: node.attr("#{compname}-number"),
14
+ type: node.attr("#{compname}-type"))
15
15
  i = 2
16
- while node.attr(compname+"_#{i}") do
17
- out.send compname.gsub(/-/, "_"), node.attr(compname+"_#{i}"),
18
- **attr_code(number: node.attr("#{compname}-number_#{i}"),
19
- type: node.attr("#{compname}-type_#{i}"))
16
+ while node.attr(compname + "_#{i}")
17
+ out.send compname.gsub(/-/, "_"), node.attr(compname + "_#{i}"),
18
+ **attr_code(number: node.attr("#{compname}-number_#{i}"),
19
+ type: node.attr("#{compname}-type_#{i}"))
20
20
  i += 1
21
21
  end
22
22
  end
23
23
 
24
- def organization(org, orgname, node = nil, default_org = nil)
24
+ def organization(org, orgname, is_pub, node = nil, default_org = nil)
25
25
  abbrevs = org_abbrev
26
26
  n = abbrevs.invert[orgname] and orgname = n
27
27
  org.name orgname
@@ -29,37 +29,39 @@ module Asciidoctor
29
29
  abbr = org_abbrev[orgname]
30
30
  default_org && b = node.attr("subdivision-abbr") and abbr = b
31
31
  abbr and org.abbreviation abbr
32
- default_org and org_address(node, org)
32
+ is_pub && node and org_address(node, org)
33
33
  end
34
34
 
35
- def org_address(node, p)
36
- node.attr("pub-address") and p.address do |ad|
35
+ def org_address(node, person)
36
+ node.attr("pub-address") and person.address do |ad|
37
37
  ad.formattedAddress do |f|
38
38
  f << node.attr("pub-address").gsub(/ \+\n/, "<br/>")
39
39
  end
40
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")
41
+ node.attr("pub-phone") and person.phone node.attr("pub-phone")
42
+ node.attr("pub-fax") and
43
+ person.phone node.attr("pub-fax"), **{ type: "fax" }
44
+ node.attr("pub-email") and person.email node.attr("pub-email")
45
+ node.attr("pub-uri") and person.uri node.attr("pub-uri")
45
46
  end
46
47
 
47
48
  # , " => ," : CSV definition does not deal with space followed by quote
48
49
  # at start of field
49
- def csv_split(s, delim = ";")
50
- return if s.nil?
51
- CSV.parse_line(s&.gsub(/#{delim} "(?!")/, "#{delim}\""),
50
+ def csv_split(text, delim = ";")
51
+ return if text.nil?
52
+
53
+ CSV.parse_line(text&.gsub(/#{delim} "(?!")/, "#{delim}\""),
52
54
  liberal_parsing: true,
53
- col_sep: delim)&.compact&.map { |x| x.strip }
55
+ col_sep: delim)&.compact&.map(&:strip)
54
56
  end
55
57
 
56
58
  def metadata_author(node, xml)
57
- csv_split(node.attr("publisher") || default_publisher || "")&.
58
- each do |p|
59
+ csv_split(node.attr("publisher") || default_publisher || "")
60
+ &.each do |p|
59
61
  xml.contributor do |c|
60
62
  c.role **{ type: "author" }
61
63
  c.organization do |a|
62
- organization(a, p, node, !node.attr("publisher"))
64
+ organization(a, p, false, node, !node.attr("publisher"))
63
65
  end
64
66
  end
65
67
  end
@@ -76,17 +78,18 @@ module Asciidoctor
76
78
  end
77
79
  end
78
80
 
79
- def personal_role(node, c, suffix)
80
- c.role **{ type: node.attr("role#{suffix}")&.downcase || "author" }
81
+ def personal_role(node, contrib, suffix)
82
+ type = node.attr("role#{suffix}")&.downcase || "author"
83
+ contrib.role **{ type: type }
81
84
  end
82
85
 
83
- def personal_contact(node, suffix, p)
84
- node.attr("phone#{suffix}") and p.phone node.attr("phone#{suffix}")
86
+ def personal_contact(node, suffix, person)
87
+ node.attr("phone#{suffix}") and person.phone node.attr("phone#{suffix}")
85
88
  node.attr("fax#{suffix}") and
86
- p.phone node.attr("fax#{suffix}"), **{type: "fax"}
87
- node.attr("email#{suffix}") and p.email node.attr("email#{suffix}")
89
+ person.phone node.attr("fax#{suffix}"), **{ type: "fax" }
90
+ node.attr("email#{suffix}") and person.email node.attr("email#{suffix}")
88
91
  node.attr("contributor-uri#{suffix}") and
89
- p.uri node.attr("contributor-uri#{suffix}")
92
+ person.uri node.attr("contributor-uri#{suffix}")
90
93
  end
91
94
 
92
95
  def personal_author1(node, xml, suffix)
@@ -100,8 +103,8 @@ module Asciidoctor
100
103
  end
101
104
  end
102
105
 
103
- def person_name(node, xml, suffix, p)
104
- p.name do |n|
106
+ def person_name(node, _xml, suffix, person)
107
+ person.name do |n|
105
108
  if node.attr("fullname#{suffix}")
106
109
  n.completename node.attr("fullname#{suffix}")
107
110
  else
@@ -112,21 +115,43 @@ module Asciidoctor
112
115
  end
113
116
  end
114
117
 
115
- def person_affiliation(node, xml, suffix, p)
116
- node.attr("affiliation#{suffix}") and p.affiliation do |a|
118
+ def person_affiliation(node, _xml, suffix, person)
119
+ node.attr("affiliation#{suffix}") and person.affiliation do |a|
117
120
  a.organization do |o|
118
- o.name node.attr("affiliation#{suffix}")
119
- a = node.attr("affiliation_subdiv#{suffix}")
120
- abbr = node.attr("affiliation_abbrev#{suffix}") and o.abbreviation abbr
121
- csv_split(node.attr("affiliation_subdiv#{suffix}"))&.each do |s|
122
- o.subdivision s
123
- end
124
- node.attr("address#{suffix}") and o.address do |ad|
125
- ad.formattedAddress do |f|
126
- f << node.attr("address#{suffix}").gsub(/ \+\n/, "<br/>")
127
- end
121
+ person_organization(node, suffix, o)
122
+ end
123
+ end
124
+ end
125
+
126
+ def person_organization(node, suffix, xml)
127
+ xml.name node.attr("affiliation#{suffix}")
128
+ abbr = node.attr("affiliation_abbrev#{suffix}") and
129
+ xml.abbreviation abbr
130
+ csv_split(node.attr("affiliation_subdiv#{suffix}"))&.each do |s|
131
+ xml.subdivision s
132
+ end
133
+ person_address(node, suffix, xml)
134
+ end
135
+
136
+ def person_address(node, suffix, xml)
137
+ if node.attr("address#{suffix}")
138
+ xml.address do |ad|
139
+ ad.formattedAddress do |f|
140
+ f << node.attr("address#{suffix}").gsub(/ \+\n/, "<br/>")
128
141
  end
129
142
  end
143
+ elsif node.attr("country#{suffix}") || node.attr("city#{suffix}")
144
+ person_address_components(node, suffix, xml)
145
+ end
146
+ end
147
+
148
+ def person_address_components(node, suffix, xml)
149
+ xml.address do |ad|
150
+ s = node.attr("street#{suffix}") and ad.street s
151
+ s = node.attr("city#{suffix}") and ad.city s
152
+ s = node.attr("state#{suffix}") and ad.state s
153
+ s = node.attr("country#{suffix}") and ad.country s
154
+ s = node.attr("postcode#{suffix}") and ad.postcode s
130
155
  end
131
156
  end
132
157
 
@@ -135,7 +160,7 @@ module Asciidoctor
135
160
  end
136
161
 
137
162
  def org_abbrev
138
- { }
163
+ {}
139
164
  end
140
165
 
141
166
  def metadata_publisher(node, xml)
@@ -144,7 +169,7 @@ module Asciidoctor
144
169
  xml.contributor do |c|
145
170
  c.role **{ type: "publisher" }
146
171
  c.organization do |a|
147
- organization(a, p, node, !node.attr("publisher"))
172
+ organization(a, p, true, node, !node.attr("publisher"))
148
173
  end
149
174
  end
150
175
  end
@@ -157,7 +182,7 @@ module Asciidoctor
157
182
  c.from (node.attr("copyright-year") || Date.today.year)
158
183
  p.match(/[A-Za-z]/).nil? or c.owner do |owner|
159
184
  owner.organization do |a|
160
- organization(a, p, node, !pub)
185
+ organization(a, p, true, node, !pub)
161
186
  end
162
187
  end
163
188
  end
@@ -9,8 +9,8 @@ require "latexmath"
9
9
  module Asciidoctor
10
10
  module Standoc
11
11
  module Inline
12
- def refid?(x)
13
- @refids.include? x
12
+ def refid?(ref)
13
+ @refids.include? ref
14
14
  end
15
15
 
16
16
  def inline_anchor(node)
@@ -45,7 +45,7 @@ module Asciidoctor
45
45
 
46
46
  def inline_anchor_xref_attrs(node)
47
47
  m = /^(?<drop>droploc%)?(?<case>capital%|lowercase%)?(?<drop2>droploc%)?
48
- (?<fn>fn(:\s*(?<text>.*))?)?$/x.match node.text
48
+ (?<fn>fn:?\s*)?(?<text>.*)$/x.match node.text
49
49
  casing = m.nil? ? nil : m[:case]&.sub(/%$/, "")
50
50
  droploc = m.nil? ? nil : ((m[:drop].nil? && m[:drop2].nil?) ? nil: true)
51
51
  f = (m.nil? || m[:fn].nil?) ? "inline" : "footnote"
@@ -58,7 +58,8 @@ module Asciidoctor
58
58
  def inline_anchor_link(node)
59
59
  contents = node.text
60
60
  contents = "" if node.target.gsub(%r{^mailto:}, "") == node.text
61
- attributes = { "target": node.target, "alt": node.attr("title") }
61
+ attributes = { "target": node.target, "alt": node.attr("title"),
62
+ "updatetype": node.attr("updatetype") }
62
63
  noko do |xml|
63
64
  xml.link **attr_code(attributes) do |l|
64
65
  l << contents
@@ -67,8 +68,8 @@ module Asciidoctor
67
68
  end
68
69
 
69
70
  def inline_anchor_bibref(node)
70
- eref_contents = (node.text || node.target || node.id)&.
71
- sub(/^\[?([^\[\]]+?)\]?$/, "[\\1]")
71
+ eref_contents = (node.text || node.target || node.id)
72
+ &.sub(/^\[?([^\[\]]+?)\]?$/, "[\\1]")
72
73
  eref_attributes = { id: node.target || node.id }
73
74
  @refids << (node.target || node.id)
74
75
  noko do |xml|
@@ -105,7 +106,7 @@ module Asciidoctor
105
106
  attrs = {}
106
107
  node.option?("landscape") and attrs[:orientation] = "landscape"
107
108
  node.option?("portrait") and attrs[:orientation] = "portrait"
108
- noko { |xml| xml.pagebreak **attr_code(attrs)}.join
109
+ noko { |xml| xml.pagebreak **attr_code(attrs) }.join
109
110
  end
110
111
 
111
112
  def thematic_break(_node)
@@ -113,30 +114,31 @@ module Asciidoctor
113
114
  end
114
115
 
115
116
  def xml_encode(text)
116
- HTMLEntities.new.encode(text, :basic, :hexadecimal).
117
- gsub(/&amp;gt;/, ">").gsub(/\&amp;lt;/, "<").gsub(/&amp;amp;/, "&").
118
- gsub(/&gt;/, ">").gsub(/&lt;/, "<").gsub(/&amp;/, "&").
119
- gsub(/&quot;/, '"').gsub(/&#xa;/, "\n").gsub(/&amp;#/, "&#")
117
+ HTMLEntities.new.encode(text, :basic, :hexadecimal)
118
+ .gsub(/&amp;gt;/, ">").gsub(/\&amp;lt;/, "<").gsub(/&amp;amp;/, "&")
119
+ .gsub(/&gt;/, ">").gsub(/&lt;/, "<").gsub(/&amp;/, "&")
120
+ .gsub(/&quot;/, '"').gsub(/&#xa;/, "\n").gsub(/&amp;#/, "&#")
120
121
  end
121
122
 
122
123
  def latex_parse(text)
123
124
  lxm_input = Unicode2LaTeX.unicode2latex(HTMLEntities.new.decode(text))
124
125
  results = Latexmath.parse(lxm_input).to_mathml
125
126
  results.nil? and
126
- @log.add('Math', nil,
127
+ @log.add("Math", nil,
127
128
  "latexmlmath failed to process equation:\n#{lxm_input}")
128
129
  results&.sub(%r{<math ([^>]+ )?display="block"}, "<math \\1")
129
130
  end
130
131
 
131
132
  def stem_parse(text, xml, style)
132
133
  if /&lt;([^:>&]+:)?math(\s+[^>&]+)?&gt; |
133
- <([^:>&]+:)?math(\s+[^>&]+)?>/x.match text
134
+ <([^:>&]+:)?math(\s+[^>&]+)?>/x.match? text
134
135
  math = xml_encode(text)
135
136
  xml.stem math, **{ type: "MathML" }
136
137
  elsif style == :latexmath
137
138
  latex = latex_parse(text) or return xml.stem **{ type: "MathML" }
138
139
  xml.stem **{ type: "MathML" } do |s|
139
- math = Nokogiri::XML.fragment(latex.sub(/<\?[^>]+>/, "")).elements[0]
140
+ math = Nokogiri::XML.fragment(latex.sub(/<\?[^>]+>/, ""))
141
+ .elements[0]
140
142
  math.delete("alttext")
141
143
  s.parent.children = math
142
144
  end
@@ -145,9 +147,9 @@ module Asciidoctor
145
147
  end
146
148
  end
147
149
 
148
- def highlight_parse(text, xml)
149
- xml << text
150
- end
150
+ def highlight_parse(text, xml)
151
+ xml << text
152
+ end
151
153
 
152
154
  def inline_quoted(node)
153
155
  noko do |xml|
@@ -182,14 +184,20 @@ module Asciidoctor
182
184
 
183
185
  def image_attributes(node)
184
186
  uri = node.image_uri (node.attr("target") || node.target)
185
- types = /^data:/.match(uri) ? Metanorma::Utils::datauri2mime(uri) : MIME::Types.type_for(uri)
187
+ types = if /^data:/.match?(uri) then Metanorma::Utils::datauri2mime(uri)
188
+ else MIME::Types.type_for(uri)
189
+ end
186
190
  type = types.first.to_s
187
191
  uri = uri.sub(%r{^data:image/\*;}, "data:#{type};")
188
- attr_code(src: uri,
192
+ image_attributes1(node, uri, type)
193
+ end
194
+
195
+ def image_attributes1(node, uri, type)
196
+ attr_code(src: uri,
189
197
  id: Metanorma::Utils::anchor_or_uuid,
190
198
  mimetype: type,
191
199
  height: node.attr("height") || "auto",
192
- width: node.attr("width") || "auto" ,
200
+ width: node.attr("width") || "auto",
193
201
  filename: node.attr("filename"),
194
202
  title: node.attr("titleattr"),
195
203
  alt: node.alt == node.attr("default-alt") ? nil : node.alt)
@@ -197,14 +205,14 @@ module Asciidoctor
197
205
 
198
206
  def inline_image(node)
199
207
  noko do |xml|
200
- xml.image **(image_attributes(node))
208
+ xml.image **image_attributes(node)
201
209
  end.join("")
202
210
  end
203
211
 
204
212
  def inline_indexterm(node)
205
213
  noko do |xml|
206
214
  node.type == :visible and xml << node.text
207
- terms = (node.attr("terms") || [node.text]).map { |x| xml_encode(x) }
215
+ terms = (node.attr("terms") || [node.text]).map { |x| xml_encode(x) }
208
216
  xml.index do |i|
209
217
  i.primary { |x| x << terms[0] }
210
218
  a = terms.dig(1) and i.secondary { |x| x << a }
@@ -45,6 +45,11 @@
45
45
  <optional>
46
46
  <attribute name="alt"/>
47
47
  </optional>
48
+ <optional>
49
+ <attribute name="updatetype">
50
+ <data type="boolean"/>
51
+ </attribute>
52
+ </optional>
48
53
  <text/>
49
54
  </element>
50
55
  </define>
@@ -86,6 +91,35 @@
86
91
  <text/>
87
92
  </element>
88
93
  </define>
94
+ <define name="erefType">
95
+ <optional>
96
+ <attribute name="normative">
97
+ <data type="boolean"/>
98
+ </attribute>
99
+ </optional>
100
+ <attribute name="citeas"/>
101
+ <attribute name="type">
102
+ <ref name="ReferenceFormat"/>
103
+ </attribute>
104
+ <optional>
105
+ <attribute name="alt"/>
106
+ </optional>
107
+ <optional>
108
+ <attribute name="case">
109
+ <choice>
110
+ <value>capital</value>
111
+ <value>lowercase</value>
112
+ </choice>
113
+ </attribute>
114
+ </optional>
115
+ <optional>
116
+ <attribute name="droploc">
117
+ <data type="boolean"/>
118
+ </attribute>
119
+ </optional>
120
+ <ref name="CitationType"/>
121
+ <text/>
122
+ </define>
89
123
  <define name="ul">
90
124
  <element name="ul">
91
125
  <attribute name="id">
@@ -514,6 +548,9 @@
514
548
  </define>
515
549
  <define name="BibDataExtensionType">
516
550
  <ref name="doctype"/>
551
+ <optional>
552
+ <ref name="docsubtype"/>
553
+ </optional>
517
554
  <optional>
518
555
  <ref name="editorialgroup"/>
519
556
  </optional>
@@ -775,8 +812,100 @@
775
812
  <ref name="paragraph"/>
776
813
  </element>
777
814
  </define>
815
+ <define name="em">
816
+ <element name="em">
817
+ <zeroOrMore>
818
+ <choice>
819
+ <ref name="PureTextElement"/>
820
+ <ref name="stem"/>
821
+ <ref name="index"/>
822
+ </choice>
823
+ </zeroOrMore>
824
+ </element>
825
+ </define>
826
+ <define name="strong">
827
+ <element name="strong">
828
+ <zeroOrMore>
829
+ <choice>
830
+ <ref name="PureTextElement"/>
831
+ <ref name="stem"/>
832
+ <ref name="index"/>
833
+ </choice>
834
+ </zeroOrMore>
835
+ </element>
836
+ </define>
837
+ <define name="tt">
838
+ <element name="tt">
839
+ <zeroOrMore>
840
+ <choice>
841
+ <ref name="PureTextElement"/>
842
+ <ref name="index"/>
843
+ </choice>
844
+ </zeroOrMore>
845
+ </element>
846
+ </define>
847
+ <define name="keyword">
848
+ <element name="keyword">
849
+ <zeroOrMore>
850
+ <choice>
851
+ <ref name="PureTextElement"/>
852
+ <ref name="index"/>
853
+ </choice>
854
+ </zeroOrMore>
855
+ </element>
856
+ </define>
857
+ <define name="strike">
858
+ <element name="strike">
859
+ <zeroOrMore>
860
+ <choice>
861
+ <ref name="PureTextElement"/>
862
+ <ref name="index"/>
863
+ </choice>
864
+ </zeroOrMore>
865
+ </element>
866
+ </define>
867
+ <define name="underline">
868
+ <element name="underline">
869
+ <zeroOrMore>
870
+ <choice>
871
+ <ref name="PureTextElement"/>
872
+ <ref name="index"/>
873
+ </choice>
874
+ </zeroOrMore>
875
+ </element>
876
+ </define>
877
+ <define name="smallcap">
878
+ <element name="smallcap">
879
+ <zeroOrMore>
880
+ <choice>
881
+ <ref name="PureTextElement"/>
882
+ <ref name="index"/>
883
+ </choice>
884
+ </zeroOrMore>
885
+ </element>
886
+ </define>
887
+ <define name="pagebreak">
888
+ <element name="pagebreak">
889
+ <optional>
890
+ <attribute name="orientation">
891
+ <choice>
892
+ <value>landscape</value>
893
+ <value>portrait</value>
894
+ </choice>
895
+ </attribute>
896
+ </optional>
897
+ </element>
898
+ </define>
778
899
  </include>
779
900
  <!-- end overrides -->
901
+ <define name="docsubtype">
902
+ <element name="docsubtype">
903
+ <ref name="DocumentSubtype"/>
904
+ </element>
905
+ </define>
906
+ <define name="DocumentSubtype">
907
+ <text/>
908
+ </define>
780
909
  <define name="colgroup">
781
910
  <element name="colgroup">
782
911
  <oneOrMore>
@@ -793,7 +922,35 @@
793
922
  <value>internal</value>
794
923
  </define>
795
924
  <define name="TextElement" combine="choice">
796
- <ref name="concept"/>
925
+ <choice>
926
+ <ref name="concept"/>
927
+ <ref name="add"/>
928
+ <ref name="del"/>
929
+ </choice>
930
+ </define>
931
+ <define name="add">
932
+ <element name="add">
933
+ <choice>
934
+ <ref name="PureTextElement"/>
935
+ <ref name="eref"/>
936
+ <ref name="stem"/>
937
+ <ref name="keyword"/>
938
+ <ref name="xref"/>
939
+ <ref name="hyperlink"/>
940
+ </choice>
941
+ </element>
942
+ </define>
943
+ <define name="del">
944
+ <element name="del">
945
+ <choice>
946
+ <ref name="PureTextElement"/>
947
+ <ref name="eref"/>
948
+ <ref name="stem"/>
949
+ <ref name="keyword"/>
950
+ <ref name="xref"/>
951
+ <ref name="hyperlink"/>
952
+ </choice>
953
+ </element>
797
954
  </define>
798
955
  <define name="concept">
799
956
  <element name="concept">
@@ -814,8 +971,170 @@
814
971
  <ref name="permission"/>
815
972
  <ref name="imagemap"/>
816
973
  <ref name="svgmap"/>
974
+ <ref name="inputform"/>
975
+ </choice>
976
+ </define>
977
+ <define name="inputform">
978
+ <element name="form">
979
+ <attribute name="id">
980
+ <data type="ID"/>
981
+ </attribute>
982
+ <attribute name="name"/>
983
+ <attribute name="action"/>
984
+ <zeroOrMore>
985
+ <choice>
986
+ <ref name="TextElement"/>
987
+ <ref name="FormInput"/>
988
+ </choice>
989
+ </zeroOrMore>
990
+ </element>
991
+ </define>
992
+ <define name="FormInput">
993
+ <choice>
994
+ <ref name="input"/>
995
+ <ref name="formlabel"/>
996
+ <ref name="select"/>
997
+ <ref name="textarea"/>
998
+ </choice>
999
+ </define>
1000
+ <define name="InputType">
1001
+ <choice>
1002
+ <value>button</value>
1003
+ <value>checkbox</value>
1004
+ <value>date</value>
1005
+ <value>file</value>
1006
+ <value>password</value>
1007
+ <value>radio</value>
1008
+ <value>submit</value>
1009
+ <value>text</value>
817
1010
  </choice>
818
1011
  </define>
1012
+ <define name="input">
1013
+ <element name="input">
1014
+ <attribute name="type">
1015
+ <ref name="InputType"/>
1016
+ </attribute>
1017
+ <optional>
1018
+ <attribute name="checked">
1019
+ <data type="boolean"/>
1020
+ </attribute>
1021
+ </optional>
1022
+ <optional>
1023
+ <attribute name="disabled">
1024
+ <data type="boolean"/>
1025
+ </attribute>
1026
+ </optional>
1027
+ <optional>
1028
+ <attribute name="readonly">
1029
+ <data type="boolean"/>
1030
+ </attribute>
1031
+ </optional>
1032
+ <optional>
1033
+ <attribute name="maxlength">
1034
+ <data type="int"/>
1035
+ </attribute>
1036
+ </optional>
1037
+ <optional>
1038
+ <attribute name="minlength">
1039
+ <data type="int"/>
1040
+ </attribute>
1041
+ </optional>
1042
+ <optional>
1043
+ <attribute name="name"/>
1044
+ </optional>
1045
+ <optional>
1046
+ <attribute name="value"/>
1047
+ </optional>
1048
+ <optional>
1049
+ <attribute name="id">
1050
+ <data type="ID"/>
1051
+ </attribute>
1052
+ </optional>
1053
+ </element>
1054
+ </define>
1055
+ <define name="formlabel">
1056
+ <element name="label">
1057
+ <attribute name="for">
1058
+ <data type="IDREF"/>
1059
+ </attribute>
1060
+ <zeroOrMore>
1061
+ <ref name="PureTextElement"/>
1062
+ </zeroOrMore>
1063
+ </element>
1064
+ </define>
1065
+ <define name="select">
1066
+ <element name="select">
1067
+ <optional>
1068
+ <attribute name="name"/>
1069
+ </optional>
1070
+ <optional>
1071
+ <attribute name="value"/>
1072
+ </optional>
1073
+ <optional>
1074
+ <attribute name="id">
1075
+ <data type="ID"/>
1076
+ </attribute>
1077
+ </optional>
1078
+ <optional>
1079
+ <attribute name="disabled">
1080
+ <data type="boolean"/>
1081
+ </attribute>
1082
+ </optional>
1083
+ <optional>
1084
+ <attribute name="multiple">
1085
+ <data type="boolean"/>
1086
+ </attribute>
1087
+ </optional>
1088
+ <optional>
1089
+ <attribute name="size">
1090
+ <data type="int"/>
1091
+ </attribute>
1092
+ </optional>
1093
+ <oneOrMore>
1094
+ <ref name="option"/>
1095
+ </oneOrMore>
1096
+ </element>
1097
+ </define>
1098
+ <define name="option">
1099
+ <element name="option">
1100
+ <optional>
1101
+ <attribute name="disabled">
1102
+ <data type="boolean"/>
1103
+ </attribute>
1104
+ </optional>
1105
+ <optional>
1106
+ <attribute name="value"/>
1107
+ </optional>
1108
+ <zeroOrMore>
1109
+ <ref name="PureTextElement"/>
1110
+ </zeroOrMore>
1111
+ </element>
1112
+ </define>
1113
+ <define name="textarea">
1114
+ <element name="textarea">
1115
+ <optional>
1116
+ <attribute name="name"/>
1117
+ </optional>
1118
+ <optional>
1119
+ <attribute name="value"/>
1120
+ </optional>
1121
+ <optional>
1122
+ <attribute name="id">
1123
+ <data type="ID"/>
1124
+ </attribute>
1125
+ </optional>
1126
+ <optional>
1127
+ <attribute name="rows">
1128
+ <data type="int"/>
1129
+ </attribute>
1130
+ </optional>
1131
+ <optional>
1132
+ <attribute name="cols">
1133
+ <data type="int"/>
1134
+ </attribute>
1135
+ </optional>
1136
+ </element>
1137
+ </define>
819
1138
  <define name="bibliography">
820
1139
  <element name="bibliography">
821
1140
  <oneOrMore>
@@ -888,9 +1207,7 @@
888
1207
  </define>
889
1208
  <define name="IsoWorkgroup">
890
1209
  <optional>
891
- <attribute name="number">
892
- <data type="int"/>
893
- </attribute>
1210
+ <attribute name="number"/>
894
1211
  </optional>
895
1212
  <optional>
896
1213
  <attribute name="type"/>