metanorma-generic 1.4.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +7 -0
  2. data/.github/workflows/macos.yml +39 -0
  3. data/.github/workflows/ubuntu.yml +39 -0
  4. data/.github/workflows/windows.yml +42 -0
  5. data/.gitignore +1 -0
  6. data/.hound.yml +3 -0
  7. data/.rubocop.ribose.yml +66 -0
  8. data/.rubocop.tb.yml +650 -0
  9. data/.rubocop.yml +10 -0
  10. data/CODE_OF_CONDUCT.md +74 -0
  11. data/Gemfile +11 -0
  12. data/LICENSE +25 -0
  13. data/README.adoc +52 -0
  14. data/Rakefile +6 -0
  15. data/bin/console +14 -0
  16. data/bin/rspec +17 -0
  17. data/bin/setup +8 -0
  18. data/lib/asciidoctor/generic.rb +7 -0
  19. data/lib/asciidoctor/generic/basicdoc.rng +1059 -0
  20. data/lib/asciidoctor/generic/biblio.rng +1142 -0
  21. data/lib/asciidoctor/generic/converter.rb +172 -0
  22. data/lib/asciidoctor/generic/generic.rng +79 -0
  23. data/lib/asciidoctor/generic/isodoc.rng +1033 -0
  24. data/lib/asciidoctor/generic/reqt.rng +171 -0
  25. data/lib/asciidoctor/generic/rsd.rng +225 -0
  26. data/lib/isodoc/generic.rb +10 -0
  27. data/lib/isodoc/generic/base_convert.rb +59 -0
  28. data/lib/isodoc/generic/html/generic.scss +766 -0
  29. data/lib/isodoc/generic/html/header.html +253 -0
  30. data/lib/isodoc/generic/html/html_generic_intro.html +8 -0
  31. data/lib/isodoc/generic/html/html_generic_titlepage.html +106 -0
  32. data/lib/isodoc/generic/html/htmlstyle.scss +710 -0
  33. data/lib/isodoc/generic/html/logo.jpg +0 -0
  34. data/lib/isodoc/generic/html/scripts.html +84 -0
  35. data/lib/isodoc/generic/html/scripts.pdf.html +72 -0
  36. data/lib/isodoc/generic/html/word_generic_intro.html +72 -0
  37. data/lib/isodoc/generic/html/word_generic_titlepage.html +75 -0
  38. data/lib/isodoc/generic/html/wordstyle.scss +1157 -0
  39. data/lib/isodoc/generic/html_convert.rb +63 -0
  40. data/lib/isodoc/generic/metadata.rb +48 -0
  41. data/lib/isodoc/generic/pdf_convert.rb +64 -0
  42. data/lib/isodoc/generic/word_convert.rb +56 -0
  43. data/lib/metanorma-generic.rb +8 -0
  44. data/lib/metanorma/generic.rb +88 -0
  45. data/lib/metanorma/generic/processor.rb +71 -0
  46. data/lib/metanorma/generic/version.rb +5 -0
  47. data/metanorma-generic.gemspec +43 -0
  48. data/metanorma.yml.example +19 -0
  49. metadata +276 -0
@@ -0,0 +1,10 @@
1
+ # This project follows the Ribose OSS style guide.
2
+ # https://github.com/riboseinc/oss-guides
3
+ # All project-specific additions and overrides should be specified in this file.
4
+
5
+ inherit_from:
6
+ - https://raw.githubusercontent.com/riboseinc/oss-guides/master/ci/rubocop.yml
7
+ AllCops:
8
+ TargetRubyVersion: 2.3
9
+ Rails:
10
+ Enabled: true
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at ronald.tse@ribose.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,11 @@
1
+ Encoding.default_external = Encoding::UTF_8
2
+ Encoding.default_internal = Encoding::UTF_8
3
+
4
+ source "https://rubygems.org"
5
+ git_source(:github) { |repo| "https://github.com/#{repo}" }
6
+
7
+ gemspec
8
+
9
+ if File.exist? 'Gemfile.devel'
10
+ eval File.read('Gemfile.devel'), nil, 'Gemfile.devel' # rubocop:disable Security/Eval
11
+ end
data/LICENSE ADDED
@@ -0,0 +1,25 @@
1
+ BSD 2-Clause License
2
+
3
+ Copyright (c) 2018, Ribose
4
+ All rights reserved.
5
+
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted provided that the following conditions are met:
8
+
9
+ * Redistributions of source code must retain the above copyright notice, this
10
+ list of conditions and the following disclaimer.
11
+
12
+ * Redistributions in binary form must reproduce the above copyright notice,
13
+ this list of conditions and the following disclaimer in the documentation
14
+ and/or other materials provided with the distribution.
15
+
16
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,52 @@
1
+ = metanorma-generic: Metanorma template gem for customisation
2
+
3
+ Formerly known as metanorma-acme
4
+
5
+ image:https://img.shields.io/gem/v/metanorma-generic.svg["Gem Version", link="https://rubygems.org/gems/metanorma-generic"]
6
+ image:https://github.com/metanorma/metanorma-generic/workflows/macos/badge.svg["Build Status (macOS)", link="https://github.com/metanorma/metanorma-generic/actions?workflow=macos"]
7
+ image:https://github.com/metanorma/metanorma-generic/workflows/ubuntu/badge.svg["Build Status (ubuntu)", link="https://github.com/metanorma/metanorma-generic/actions?workflow=ubuntu"]
8
+ image:https://github.com/metanorma/metanorma-generic/workflows/windows/badge.svg["Build Status (macOS)", link="https://github.com/metanorma/metanorma-generic/actions?workflow=windows"]
9
+ image:https://codeclimate.com/github/metanorma/metanorma-generic/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/metanorma/metanorma-generic"]
10
+ image:https://img.shields.io/github/issues-pr-raw/metanorma/metanorma-generic.svg["Pull Requests", link="https://github.com/metanorma/metanorma-generic/pulls"]
11
+ image:https://img.shields.io/github/commits-since/metanorma/metanorma-generic/latest.svg["Commits since latest",link="https://github.com/metanorma/metanorma-generic/releases"]
12
+
13
+ == Functionality
14
+
15
+ This gem processes http://www.metanorma.com[Metanorma] documents with a configurable template for document options.
16
+ It is intended for flavours of Metanorma that do not require extensive gem customisation: these flavours inherit
17
+ from metanorma-generic, instead of directly from https://github.com/metanorma/metanorma-standoc[metanorma-standoc].
18
+
19
+ The gem currently inherits from the https://github.com/metanorma/metanorma-standoc[metanorma-standoc]
20
+ gem, and aligns closely to it.
21
+
22
+ == Configuration
23
+
24
+ Gem can be configured in 2 ways:
25
+ 1. By creating yaml config file with name `metanorma.yml`, see `metanorma.yml.example` for example.
26
+ 2. By using the `Metanorma::Generic.configuration` method directly; for example
27
+
28
+ [source,ruby]
29
+ ---
30
+ Metanorma::Generic.configure do |config|
31
+ config.organization_name_short = 'My Organization'
32
+ config.organization_name_long = 'My Organization name'
33
+ config.document_namespace = 'https://open.ribose.com/standards/mine'
34
+ config.xml_root_tag = 'mine-standard'
35
+ config.logo_path = '/metanorma-mine/lib/isodoc/mine/html/logo.jpg'
36
+ config.validate_rng_file = '/metanorma-mine/lib/asciidoctor/mine/mine.rng'
37
+ config.htmlcoverpage = '/metanorma-mine/lib/isodoc/mine/html/html_mine_titlepage.html'
38
+ config.htmlintropage = '/metanorma-mine/lib/isodoc/mine/html/html_mine_intro.html'
39
+ config.htmlstylesheet = '/metanorma-mine/lib/isodoc/mine/html/htmlstyle.scss'
40
+ config.scripts = '/metanorma-mine/lib/isodoc/mine/html/scripts.html'
41
+ config.scripts_pdf = '/metanorma-mine/lib/isodoc/mine/html/scripts.prd.html'
42
+ config.standardstylesheet = '/metanorma-mine/lib/isodoc/mine/html/'
43
+ config.header = '/metanorma-mine/lib/isodoc/mine/html/header.html'
44
+ config.wordcoverpage = '/metanorma-mine/lib/isodoc/mine/html/word_mine_titlepage.html'
45
+ config.wordintropage = '/metanorma-mine/lib/isodoc/mine/html/word_mine_intro.html'
46
+ config.wordstylesheet = '/metanorma-mine/lib/isodoc/mine/html/wordstyle.scss'
47
+ end
48
+ ---
49
+
50
+ More information about how to configure this gem is given in
51
+ https://www.metanorma.com/builder/topics/simple-adoption/[Simple adoption] on the metanorma.com site.
52
+
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "metanorma/acme"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'rspec' is installed as part of a gem, and
6
+ # this file is here to facilitate running it.
7
+ #
8
+
9
+ require "pathname"
10
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path(
11
+ "../../Gemfile", Pathname.new(__FILE__).realpath
12
+ )
13
+
14
+ require "rubygems"
15
+ require "bundler/setup"
16
+
17
+ load Gem.bin_path("rspec-core", "rspec")
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,7 @@
1
+ require "asciidoctor/generic/converter"
2
+
3
+ module Asciidoctor
4
+ module Generic
5
+
6
+ end
7
+ end
@@ -0,0 +1,1059 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
3
+ <include href="biblio.rng">
4
+ <start>
5
+ <ref name="document"/>
6
+ </start>
7
+ </include>
8
+ <define name="document">
9
+ <element name="document">
10
+ <optional>
11
+ <attribute name="identifier"/>
12
+ </optional>
13
+ <ref name="bibdata"/>
14
+ <ref name="sections"/>
15
+ <zeroOrMore>
16
+ <ref name="references"/>
17
+ </zeroOrMore>
18
+ </element>
19
+ </define>
20
+ <define name="bibdata">
21
+ <element name="bibdata">
22
+ <ref name="BibData"/>
23
+ </element>
24
+ </define>
25
+ <define name="sections">
26
+ <element name="sections">
27
+ <oneOrMore>
28
+ <ref name="section"/>
29
+ </oneOrMore>
30
+ </element>
31
+ </define>
32
+ <define name="section">
33
+ <element name="section">
34
+ <ref name="Basic-Section"/>
35
+ <zeroOrMore>
36
+ <ref name="section"/>
37
+ </zeroOrMore>
38
+ </element>
39
+ </define>
40
+ <define name="Basic-Section">
41
+ <optional>
42
+ <attribute name="id">
43
+ <data type="ID"/>
44
+ </attribute>
45
+ </optional>
46
+ <optional>
47
+ <attribute name="language"/>
48
+ </optional>
49
+ <optional>
50
+ <attribute name="script"/>
51
+ </optional>
52
+ <optional>
53
+ <ref name="section-title"/>
54
+ </optional>
55
+ <zeroOrMore>
56
+ <ref name="BasicBlock"/>
57
+ </zeroOrMore>
58
+ </define>
59
+ <define name="references">
60
+ <element name="references">
61
+ <optional>
62
+ <attribute name="id">
63
+ <data type="ID"/>
64
+ </attribute>
65
+ </optional>
66
+ <optional>
67
+ <ref name="section-title"/>
68
+ </optional>
69
+ <zeroOrMore>
70
+ <ref name="BasicBlock"/>
71
+ </zeroOrMore>
72
+ <zeroOrMore>
73
+ <ref name="bibitem"/>
74
+ </zeroOrMore>
75
+ </element>
76
+ </define>
77
+ <define name="section-title">
78
+ <element name="title">
79
+ <zeroOrMore>
80
+ <ref name="TextElement"/>
81
+ </zeroOrMore>
82
+ </element>
83
+ </define>
84
+ <define name="BasicBlock">
85
+ <choice>
86
+ <ref name="paragraph-with-footnote"/>
87
+ <ref name="table"/>
88
+ <ref name="formula"/>
89
+ <ref name="admonition"/>
90
+ <ref name="ol"/>
91
+ <ref name="ul"/>
92
+ <ref name="dl"/>
93
+ <ref name="figure"/>
94
+ <ref name="quote"/>
95
+ <ref name="sourcecode"/>
96
+ <ref name="example"/>
97
+ <ref name="review"/>
98
+ <ref name="pre"/>
99
+ <ref name="note"/>
100
+ <ref name="pagebreak"/>
101
+ <ref name="hr"/>
102
+ <ref name="bookmark"/>
103
+ </choice>
104
+ </define>
105
+ <define name="paragraph">
106
+ <element name="p">
107
+ <ref name="ParagraphType"/>
108
+ </element>
109
+ </define>
110
+ <define name="Alignments">
111
+ <choice>
112
+ <value>left</value>
113
+ <value>right</value>
114
+ <value>center</value>
115
+ <value>justified</value>
116
+ </choice>
117
+ </define>
118
+ <define name="ParagraphType">
119
+ <attribute name="id">
120
+ <data type="ID"/>
121
+ </attribute>
122
+ <optional>
123
+ <attribute name="align">
124
+ <ref name="Alignments"/>
125
+ </attribute>
126
+ </optional>
127
+ <zeroOrMore>
128
+ <ref name="TextElement"/>
129
+ </zeroOrMore>
130
+ <zeroOrMore>
131
+ <ref name="note"/>
132
+ </zeroOrMore>
133
+ </define>
134
+ <define name="paragraph-with-footnote">
135
+ <element name="p">
136
+ <attribute name="id">
137
+ <data type="ID"/>
138
+ </attribute>
139
+ <optional>
140
+ <attribute name="align">
141
+ <ref name="Alignments"/>
142
+ </attribute>
143
+ </optional>
144
+ <zeroOrMore>
145
+ <choice>
146
+ <ref name="TextElement"/>
147
+ <ref name="fn"/>
148
+ </choice>
149
+ </zeroOrMore>
150
+ <zeroOrMore>
151
+ <ref name="note"/>
152
+ </zeroOrMore>
153
+ </element>
154
+ </define>
155
+ <define name="note">
156
+ <element name="note">
157
+ <attribute name="id">
158
+ <data type="ID"/>
159
+ </attribute>
160
+ <oneOrMore>
161
+ <ref name="paragraph"/>
162
+ </oneOrMore>
163
+ </element>
164
+ </define>
165
+ <define name="review">
166
+ <element name="review">
167
+ <attribute name="id">
168
+ <data type="ID"/>
169
+ </attribute>
170
+ <attribute name="reviewer"/>
171
+ <optional>
172
+ <attribute name="date">
173
+ <data type="dateTime"/>
174
+ </attribute>
175
+ </optional>
176
+ <attribute name="from">
177
+ <data type="IDREF"/>
178
+ </attribute>
179
+ <optional>
180
+ <attribute name="to">
181
+ <data type="IDREF"/>
182
+ </attribute>
183
+ </optional>
184
+ <oneOrMore>
185
+ <ref name="paragraph"/>
186
+ </oneOrMore>
187
+ </element>
188
+ </define>
189
+ <define name="formula">
190
+ <element name="formula">
191
+ <attribute name="id">
192
+ <data type="ID"/>
193
+ </attribute>
194
+ <optional>
195
+ <attribute name="unnumbered">
196
+ <data type="boolean"/>
197
+ </attribute>
198
+ </optional>
199
+ <optional>
200
+ <attribute name="subsequence"/>
201
+ </optional>
202
+ <optional>
203
+ <attribute name="inequality">
204
+ <data type="boolean"/>
205
+ </attribute>
206
+ </optional>
207
+ <ref name="stem"/>
208
+ <optional>
209
+ <ref name="dl"/>
210
+ </optional>
211
+ <zeroOrMore>
212
+ <ref name="note"/>
213
+ </zeroOrMore>
214
+ </element>
215
+ </define>
216
+ <define name="quote">
217
+ <element name="quote">
218
+ <attribute name="id">
219
+ <data type="ID"/>
220
+ </attribute>
221
+ <optional>
222
+ <attribute name="alignment">
223
+ <ref name="Alignments"/>
224
+ </attribute>
225
+ </optional>
226
+ <optional>
227
+ <ref name="quote-source"/>
228
+ </optional>
229
+ <optional>
230
+ <ref name="quote-author"/>
231
+ </optional>
232
+ <oneOrMore>
233
+ <ref name="paragraph-with-footnote"/>
234
+ </oneOrMore>
235
+ <zeroOrMore>
236
+ <ref name="note"/>
237
+ </zeroOrMore>
238
+ </element>
239
+ </define>
240
+ <define name="quote-source">
241
+ <element name="source">
242
+ <ref name="erefType"/>
243
+ </element>
244
+ </define>
245
+ <define name="quote-author">
246
+ <element name="author">
247
+ <text/>
248
+ </element>
249
+ </define>
250
+ <define name="sourcecode">
251
+ <element name="sourcecode">
252
+ <attribute name="id">
253
+ <data type="ID"/>
254
+ </attribute>
255
+ <optional>
256
+ <attribute name="unnumbered">
257
+ <data type="boolean"/>
258
+ </attribute>
259
+ </optional>
260
+ <optional>
261
+ <attribute name="subsequence"/>
262
+ </optional>
263
+ <optional>
264
+ <attribute name="lang"/>
265
+ </optional>
266
+ <optional>
267
+ <ref name="tname"/>
268
+ </optional>
269
+ <oneOrMore>
270
+ <choice>
271
+ <text/>
272
+ <ref name="callout"/>
273
+ </choice>
274
+ </oneOrMore>
275
+ <zeroOrMore>
276
+ <ref name="annotation"/>
277
+ </zeroOrMore>
278
+ <zeroOrMore>
279
+ <ref name="note"/>
280
+ </zeroOrMore>
281
+ </element>
282
+ </define>
283
+ <define name="pre">
284
+ <element name="pre">
285
+ <attribute name="id">
286
+ <data type="ID"/>
287
+ </attribute>
288
+ <optional>
289
+ <attribute name="alt"/>
290
+ </optional>
291
+ <optional>
292
+ <ref name="tname"/>
293
+ </optional>
294
+ <text/>
295
+ <zeroOrMore>
296
+ <ref name="note"/>
297
+ </zeroOrMore>
298
+ </element>
299
+ </define>
300
+ <define name="table">
301
+ <element name="table">
302
+ <attribute name="id">
303
+ <data type="ID"/>
304
+ </attribute>
305
+ <optional>
306
+ <attribute name="unnumbered">
307
+ <data type="boolean"/>
308
+ </attribute>
309
+ </optional>
310
+ <optional>
311
+ <attribute name="subsequence"/>
312
+ </optional>
313
+ <optional>
314
+ <attribute name="alt"/>
315
+ </optional>
316
+ <optional>
317
+ <attribute name="summary"/>
318
+ </optional>
319
+ <optional>
320
+ <attribute name="uri">
321
+ <data type="anyURI"/>
322
+ </attribute>
323
+ </optional>
324
+ <optional>
325
+ <ref name="tname"/>
326
+ </optional>
327
+ <optional>
328
+ <ref name="thead"/>
329
+ </optional>
330
+ <ref name="tbody"/>
331
+ <optional>
332
+ <ref name="tfoot"/>
333
+ </optional>
334
+ <zeroOrMore>
335
+ <ref name="table-note"/>
336
+ </zeroOrMore>
337
+ <optional>
338
+ <ref name="dl"/>
339
+ </optional>
340
+ </element>
341
+ </define>
342
+ <define name="tname">
343
+ <element name="name">
344
+ <oneOrMore>
345
+ <choice>
346
+ <ref name="PureTextElement"/>
347
+ <ref name="eref"/>
348
+ <ref name="stem"/>
349
+ <ref name="keyword"/>
350
+ <ref name="xref"/>
351
+ <ref name="hyperlink"/>
352
+ </choice>
353
+ </oneOrMore>
354
+ </element>
355
+ </define>
356
+ <define name="thead">
357
+ <element name="thead">
358
+ <ref name="tr"/>
359
+ </element>
360
+ </define>
361
+ <define name="tfoot">
362
+ <element name="tfoot">
363
+ <ref name="tr"/>
364
+ </element>
365
+ </define>
366
+ <define name="tbody">
367
+ <element name="tbody">
368
+ <oneOrMore>
369
+ <ref name="tr"/>
370
+ </oneOrMore>
371
+ </element>
372
+ </define>
373
+ <define name="table-note">
374
+ <element name="note">
375
+ <ref name="paragraph"/>
376
+ </element>
377
+ </define>
378
+ <define name="tr">
379
+ <element name="tr">
380
+ <oneOrMore>
381
+ <choice>
382
+ <ref name="td"/>
383
+ <ref name="th"/>
384
+ </choice>
385
+ </oneOrMore>
386
+ </element>
387
+ </define>
388
+ <define name="td">
389
+ <element name="td">
390
+ <optional>
391
+ <attribute name="colspan"/>
392
+ </optional>
393
+ <optional>
394
+ <attribute name="rowspan"/>
395
+ </optional>
396
+ <optional>
397
+ <attribute name="align">
398
+ <choice>
399
+ <value>left</value>
400
+ <value>right</value>
401
+ <value>center</value>
402
+ </choice>
403
+ </attribute>
404
+ </optional>
405
+ <choice>
406
+ <zeroOrMore>
407
+ <ref name="TextElement"/>
408
+ </zeroOrMore>
409
+ <oneOrMore>
410
+ <ref name="paragraph-with-footnote"/>
411
+ </oneOrMore>
412
+ </choice>
413
+ </element>
414
+ </define>
415
+ <define name="th">
416
+ <element name="th">
417
+ <optional>
418
+ <attribute name="colspan"/>
419
+ </optional>
420
+ <optional>
421
+ <attribute name="rowspan"/>
422
+ </optional>
423
+ <optional>
424
+ <attribute name="align">
425
+ <choice>
426
+ <value>left</value>
427
+ <value>right</value>
428
+ <value>center</value>
429
+ </choice>
430
+ </attribute>
431
+ </optional>
432
+ <choice>
433
+ <zeroOrMore>
434
+ <ref name="TextElement"/>
435
+ </zeroOrMore>
436
+ <oneOrMore>
437
+ <ref name="paragraph-with-footnote"/>
438
+ </oneOrMore>
439
+ </choice>
440
+ </element>
441
+ </define>
442
+ <define name="example">
443
+ <element name="example">
444
+ <attribute name="id">
445
+ <data type="ID"/>
446
+ </attribute>
447
+ <optional>
448
+ <attribute name="unnumbered">
449
+ <data type="boolean"/>
450
+ </attribute>
451
+ </optional>
452
+ <optional>
453
+ <attribute name="subsequence"/>
454
+ </optional>
455
+ <optional>
456
+ <ref name="tname"/>
457
+ </optional>
458
+ <oneOrMore>
459
+ <choice>
460
+ <ref name="formula"/>
461
+ <ref name="ul"/>
462
+ <ref name="ol"/>
463
+ <ref name="dl"/>
464
+ <ref name="quote"/>
465
+ <ref name="sourcecode"/>
466
+ <ref name="paragraph-with-footnote"/>
467
+ </choice>
468
+ </oneOrMore>
469
+ <zeroOrMore>
470
+ <ref name="note"/>
471
+ </zeroOrMore>
472
+ </element>
473
+ </define>
474
+ <define name="admonition">
475
+ <element name="admonition">
476
+ <attribute name="type">
477
+ <ref name="AdmonitionType"/>
478
+ </attribute>
479
+ <optional>
480
+ <attribute name="class"/>
481
+ </optional>
482
+ <attribute name="id">
483
+ <data type="ID"/>
484
+ </attribute>
485
+ <optional>
486
+ <attribute name="uri">
487
+ <data type="anyURI"/>
488
+ </attribute>
489
+ </optional>
490
+ <optional>
491
+ <ref name="tname"/>
492
+ </optional>
493
+ <zeroOrMore>
494
+ <ref name="paragraph-with-footnote"/>
495
+ </zeroOrMore>
496
+ <zeroOrMore>
497
+ <ref name="note"/>
498
+ </zeroOrMore>
499
+ </element>
500
+ </define>
501
+ <define name="AdmonitionType">
502
+ <choice>
503
+ <value>warning</value>
504
+ <value>note</value>
505
+ <value>tip</value>
506
+ <value>important</value>
507
+ <value>caution</value>
508
+ <value>statement</value>
509
+ </choice>
510
+ </define>
511
+ <define name="figure">
512
+ <element name="figure">
513
+ <attribute name="id">
514
+ <data type="ID"/>
515
+ </attribute>
516
+ <optional>
517
+ <attribute name="unnumbered">
518
+ <data type="boolean"/>
519
+ </attribute>
520
+ </optional>
521
+ <optional>
522
+ <attribute name="subsequence"/>
523
+ </optional>
524
+ <optional>
525
+ <attribute name="class"/>
526
+ </optional>
527
+ <optional>
528
+ <ref name="source"/>
529
+ </optional>
530
+ <optional>
531
+ <ref name="tname"/>
532
+ </optional>
533
+ <choice>
534
+ <ref name="image"/>
535
+ <ref name="video"/>
536
+ <ref name="audio"/>
537
+ <ref name="pre"/>
538
+ <oneOrMore>
539
+ <ref name="paragraph-with-footnote"/>
540
+ </oneOrMore>
541
+ <zeroOrMore>
542
+ <ref name="figure"/>
543
+ </zeroOrMore>
544
+ </choice>
545
+ <zeroOrMore>
546
+ <ref name="fn"/>
547
+ </zeroOrMore>
548
+ <optional>
549
+ <ref name="dl"/>
550
+ </optional>
551
+ <zeroOrMore>
552
+ <ref name="note"/>
553
+ </zeroOrMore>
554
+ </element>
555
+ </define>
556
+ <define name="TextElement">
557
+ <choice>
558
+ <text/>
559
+ <ref name="em"/>
560
+ <ref name="eref"/>
561
+ <ref name="strong"/>
562
+ <ref name="stem"/>
563
+ <ref name="sub"/>
564
+ <ref name="sup"/>
565
+ <ref name="tt"/>
566
+ <ref name="underline"/>
567
+ <ref name="keyword"/>
568
+ <ref name="ruby"/>
569
+ <ref name="strike"/>
570
+ <ref name="smallcap"/>
571
+ <ref name="xref"/>
572
+ <ref name="br"/>
573
+ <ref name="hyperlink"/>
574
+ <ref name="hr"/>
575
+ <ref name="pagebreak"/>
576
+ <ref name="bookmark"/>
577
+ <ref name="image"/>
578
+ <ref name="index"/>
579
+ </choice>
580
+ </define>
581
+ <define name="PureTextElement">
582
+ <choice>
583
+ <text/>
584
+ <ref name="em"/>
585
+ <ref name="strong"/>
586
+ <ref name="sub"/>
587
+ <ref name="sup"/>
588
+ <ref name="tt"/>
589
+ <ref name="underline"/>
590
+ <ref name="strike"/>
591
+ <ref name="smallcap"/>
592
+ <ref name="br"/>
593
+ </choice>
594
+ </define>
595
+ <define name="source">
596
+ <element name="source">
597
+ <ref name="TypedUri"/>
598
+ </element>
599
+ </define>
600
+ <define name="em">
601
+ <element name="em">
602
+ <zeroOrMore>
603
+ <choice>
604
+ <ref name="PureTextElement"/>
605
+ <ref name="stem"/>
606
+ </choice>
607
+ </zeroOrMore>
608
+ </element>
609
+ </define>
610
+ <define name="strong">
611
+ <element name="strong">
612
+ <zeroOrMore>
613
+ <choice>
614
+ <ref name="PureTextElement"/>
615
+ <ref name="stem"/>
616
+ </choice>
617
+ </zeroOrMore>
618
+ </element>
619
+ </define>
620
+ <define name="tt">
621
+ <element name="tt">
622
+ <zeroOrMore>
623
+ <ref name="PureTextElement"/>
624
+ </zeroOrMore>
625
+ </element>
626
+ </define>
627
+ <define name="keyword">
628
+ <element name="keyword">
629
+ <zeroOrMore>
630
+ <ref name="PureTextElement"/>
631
+ </zeroOrMore>
632
+ </element>
633
+ </define>
634
+ <define name="sub">
635
+ <element name="sub">
636
+ <zeroOrMore>
637
+ <ref name="PureTextElement"/>
638
+ </zeroOrMore>
639
+ </element>
640
+ </define>
641
+ <define name="sup">
642
+ <element name="sup">
643
+ <zeroOrMore>
644
+ <ref name="PureTextElement"/>
645
+ </zeroOrMore>
646
+ </element>
647
+ </define>
648
+ <define name="strike">
649
+ <element name="strike">
650
+ <zeroOrMore>
651
+ <ref name="PureTextElement"/>
652
+ </zeroOrMore>
653
+ </element>
654
+ </define>
655
+ <define name="underline">
656
+ <element name="underline">
657
+ <zeroOrMore>
658
+ <ref name="PureTextElement"/>
659
+ </zeroOrMore>
660
+ </element>
661
+ </define>
662
+ <define name="smallcap">
663
+ <element name="smallcap">
664
+ <zeroOrMore>
665
+ <ref name="PureTextElement"/>
666
+ </zeroOrMore>
667
+ </element>
668
+ </define>
669
+ <define name="ruby">
670
+ <element name="ruby">
671
+ <zeroOrMore>
672
+ <choice>
673
+ <ref name="PureTextElement"/>
674
+ <ref name="rp"/>
675
+ <ref name="rt"/>
676
+ </choice>
677
+ </zeroOrMore>
678
+ </element>
679
+ </define>
680
+ <define name="rp">
681
+ <element name="rp">
682
+ <zeroOrMore>
683
+ <ref name="PureTextElement"/>
684
+ </zeroOrMore>
685
+ </element>
686
+ </define>
687
+ <define name="rt">
688
+ <element name="rt">
689
+ <zeroOrMore>
690
+ <ref name="PureTextElement"/>
691
+ </zeroOrMore>
692
+ </element>
693
+ </define>
694
+ <define name="br">
695
+ <element name="br">
696
+ <empty/>
697
+ </element>
698
+ </define>
699
+ <define name="hr">
700
+ <element name="hr">
701
+ <empty/>
702
+ </element>
703
+ </define>
704
+ <define name="pagebreak">
705
+ <element name="pagebreak">
706
+ <empty/>
707
+ </element>
708
+ </define>
709
+ <define name="index">
710
+ <element name="index">
711
+ <attribute name="primary"/>
712
+ <optional>
713
+ <attribute name="secondary"/>
714
+ </optional>
715
+ <optional>
716
+ <attribute name="tertiary"/>
717
+ </optional>
718
+ </element>
719
+ </define>
720
+ <!-- bare ID element, used for referencing arbitrary spans of text -->
721
+ <define name="bookmark">
722
+ <element name="bookmark">
723
+ <attribute name="id">
724
+ <data type="ID"/>
725
+ </attribute>
726
+ <empty/>
727
+ </element>
728
+ </define>
729
+ <define name="ReferenceFormat">
730
+ <choice>
731
+ <value>external</value>
732
+ <value>inline</value>
733
+ <value>footnote</value>
734
+ <value>callout</value>
735
+ </choice>
736
+ </define>
737
+ <define name="eref">
738
+ <element name="eref">
739
+ <ref name="erefType"/>
740
+ </element>
741
+ </define>
742
+ <define name="erefType">
743
+ <optional>
744
+ <attribute name="normative">
745
+ <data type="boolean"/>
746
+ </attribute>
747
+ </optional>
748
+ <attribute name="citeas"/>
749
+ <attribute name="type">
750
+ <ref name="ReferenceFormat"/>
751
+ </attribute>
752
+ <optional>
753
+ <attribute name="alt"/>
754
+ </optional>
755
+ <ref name="CitationType"/>
756
+ <text/>
757
+ </define>
758
+ <define name="hyperlink">
759
+ <element name="link">
760
+ <attribute name="target">
761
+ <data type="anyURI"/>
762
+ </attribute>
763
+ <attribute name="type">
764
+ <ref name="ReferenceFormat"/>
765
+ </attribute>
766
+ <optional>
767
+ <attribute name="alt"/>
768
+ </optional>
769
+ <text/>
770
+ </element>
771
+ </define>
772
+ <define name="xref">
773
+ <element name="xref">
774
+ <attribute name="target">
775
+ <data type="IDREF"/>
776
+ </attribute>
777
+ <attribute name="type">
778
+ <ref name="ReferenceFormat"/>
779
+ </attribute>
780
+ <optional>
781
+ <attribute name="alt"/>
782
+ </optional>
783
+ <text/>
784
+ </element>
785
+ </define>
786
+ <define name="fn">
787
+ <element name="fn">
788
+ <attribute name="reference"/>
789
+ <oneOrMore>
790
+ <ref name="paragraph"/>
791
+ </oneOrMore>
792
+ </element>
793
+ </define>
794
+ <!--
795
+ This is xref with fixed @type="footnote", and @target built in as paragraph+
796
+ @reference replaces ReferenceElement/text
797
+ so <fn reference="2"><p>This is a footnote</p></fn>
798
+ corresponds to
799
+ <eref type="footnote" target="fn2">2</xref> <p id="fn2">This is a footnote</p>
800
+ -->
801
+ <define name="callout">
802
+ <element name="callout">
803
+ <attribute name="target">
804
+ <data type="IDREF"/>
805
+ </attribute>
806
+ <text/>
807
+ </element>
808
+ </define>
809
+ <!--
810
+ This is xref with fixed @type="callout"; the target by convention is in an annotation in the same source code snippet
811
+ so <callout target="xyz">1</callout>
812
+ corresponds to <xref type="callout" target="xyz">1</xref>
813
+ -->
814
+ <define name="image">
815
+ <element name="image">
816
+ <attribute name="id">
817
+ <data type="ID"/>
818
+ </attribute>
819
+ <attribute name="src">
820
+ <data type="anyURI"/>
821
+ </attribute>
822
+ <attribute name="mimetype"/>
823
+ <optional>
824
+ <attribute name="filename"/>
825
+ </optional>
826
+ <optional>
827
+ <attribute name="width">
828
+ <choice>
829
+ <data type="int"/>
830
+ <value>auto</value>
831
+ </choice>
832
+ </attribute>
833
+ </optional>
834
+ <optional>
835
+ <attribute name="height">
836
+ <choice>
837
+ <data type="int"/>
838
+ <value>auto</value>
839
+ </choice>
840
+ </attribute>
841
+ </optional>
842
+ <optional>
843
+ <attribute name="alt"/>
844
+ </optional>
845
+ <optional>
846
+ <attribute name="title"/>
847
+ </optional>
848
+ <optional>
849
+ <attribute name="longdesc">
850
+ <data type="anyURI"/>
851
+ </attribute>
852
+ </optional>
853
+ </element>
854
+ </define>
855
+ <define name="video">
856
+ <element name="video">
857
+ <attribute name="id">
858
+ <data type="ID"/>
859
+ </attribute>
860
+ <attribute name="src">
861
+ <data type="anyURI"/>
862
+ </attribute>
863
+ <attribute name="mimetype"/>
864
+ <optional>
865
+ <attribute name="filename"/>
866
+ </optional>
867
+ <optional>
868
+ <attribute name="width">
869
+ <choice>
870
+ <data type="int"/>
871
+ <value>auto</value>
872
+ </choice>
873
+ </attribute>
874
+ </optional>
875
+ <optional>
876
+ <attribute name="height">
877
+ <choice>
878
+ <data type="int"/>
879
+ <value>auto</value>
880
+ </choice>
881
+ </attribute>
882
+ </optional>
883
+ <optional>
884
+ <attribute name="alt"/>
885
+ </optional>
886
+ <optional>
887
+ <attribute name="title"/>
888
+ </optional>
889
+ <optional>
890
+ <attribute name="longdesc">
891
+ <data type="anyURI"/>
892
+ </attribute>
893
+ </optional>
894
+ <zeroOrMore>
895
+ <ref name="altsource"/>
896
+ </zeroOrMore>
897
+ </element>
898
+ </define>
899
+ <define name="audio">
900
+ <element name="audio">
901
+ <attribute name="id">
902
+ <data type="ID"/>
903
+ </attribute>
904
+ <attribute name="src">
905
+ <data type="anyURI"/>
906
+ </attribute>
907
+ <attribute name="mimetype"/>
908
+ <optional>
909
+ <attribute name="filename"/>
910
+ </optional>
911
+ <optional>
912
+ <attribute name="alt"/>
913
+ </optional>
914
+ <optional>
915
+ <attribute name="title"/>
916
+ </optional>
917
+ <optional>
918
+ <attribute name="longdesc">
919
+ <data type="anyURI"/>
920
+ </attribute>
921
+ </optional>
922
+ <zeroOrMore>
923
+ <ref name="altsource"/>
924
+ </zeroOrMore>
925
+ </element>
926
+ </define>
927
+ <define name="altsource">
928
+ <element name="altsource">
929
+ <attribute name="src">
930
+ <data type="anyURI"/>
931
+ </attribute>
932
+ <attribute name="mimetype"/>
933
+ <optional>
934
+ <attribute name="filename"/>
935
+ </optional>
936
+ </element>
937
+ </define>
938
+ <define name="stem">
939
+ <element name="stem">
940
+ <attribute name="type">
941
+ <choice>
942
+ <value>MathML</value>
943
+ <value>AsciiMath</value>
944
+ </choice>
945
+ </attribute>
946
+ <oneOrMore>
947
+ <choice>
948
+ <text/>
949
+ <ref name="AnyElement"/>
950
+ </choice>
951
+ </oneOrMore>
952
+ </element>
953
+ </define>
954
+ <define name="annotation">
955
+ <element name="annotation">
956
+ <attribute name="id">
957
+ <data type="ID"/>
958
+ </attribute>
959
+ <ref name="paragraph"/>
960
+ </element>
961
+ </define>
962
+ <define name="ul">
963
+ <element name="ul">
964
+ <attribute name="id">
965
+ <data type="ID"/>
966
+ </attribute>
967
+ <oneOrMore>
968
+ <ref name="li"/>
969
+ </oneOrMore>
970
+ <zeroOrMore>
971
+ <ref name="note"/>
972
+ </zeroOrMore>
973
+ </element>
974
+ </define>
975
+ <define name="li">
976
+ <element name="li">
977
+ <optional>
978
+ <attribute name="id">
979
+ <data type="ID"/>
980
+ </attribute>
981
+ </optional>
982
+ <oneOrMore>
983
+ <ref name="paragraph-with-footnote"/>
984
+ </oneOrMore>
985
+ </element>
986
+ </define>
987
+ <define name="ol">
988
+ <element name="ol">
989
+ <attribute name="id">
990
+ <data type="ID"/>
991
+ </attribute>
992
+ <attribute name="type">
993
+ <choice>
994
+ <value>roman</value>
995
+ <value>alphabet</value>
996
+ <value>arabic</value>
997
+ <value>roman_upper</value>
998
+ <value>alphabet_upper</value>
999
+ </choice>
1000
+ </attribute>
1001
+ <oneOrMore>
1002
+ <ref name="li"/>
1003
+ </oneOrMore>
1004
+ <zeroOrMore>
1005
+ <ref name="note"/>
1006
+ </zeroOrMore>
1007
+ </element>
1008
+ </define>
1009
+ <define name="dl">
1010
+ <element name="dl">
1011
+ <attribute name="id">
1012
+ <data type="ID"/>
1013
+ </attribute>
1014
+ <oneOrMore>
1015
+ <ref name="dt"/>
1016
+ <ref name="dd"/>
1017
+ </oneOrMore>
1018
+ <zeroOrMore>
1019
+ <ref name="note"/>
1020
+ </zeroOrMore>
1021
+ </element>
1022
+ </define>
1023
+ <define name="dt">
1024
+ <element name="dt">
1025
+ <zeroOrMore>
1026
+ <ref name="TextElement"/>
1027
+ </zeroOrMore>
1028
+ </element>
1029
+ </define>
1030
+ <define name="dd">
1031
+ <element name="dd">
1032
+ <zeroOrMore>
1033
+ <ref name="paragraph-with-footnote"/>
1034
+ </zeroOrMore>
1035
+ </element>
1036
+ </define>
1037
+ <define name="ext">
1038
+ <element name="ext">
1039
+ <ref name="BibDataExtensionType"/>
1040
+ </element>
1041
+ </define>
1042
+ <define name="BibDataExtensionType">
1043
+ <ref name="doctype"/>
1044
+ </define>
1045
+ <define name="doctype">
1046
+ <element name="doctype">
1047
+ <ref name="DocumentType"/>
1048
+ </element>
1049
+ </define>
1050
+ <define name="DocumentType">
1051
+ <value>document</value>
1052
+ </define>
1053
+ <define name="BibData">
1054
+ <ref name="BibliographicItem"/>
1055
+ <optional>
1056
+ <ref name="ext"/>
1057
+ </optional>
1058
+ </define>
1059
+ </grammar>