relaton-cie 1.7.pre1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: '07090f0526e67048feff6af31a4c186104f8a4a508fc4832abb3deb989fcaa8f'
4
+ data.tar.gz: 0e0fccc6f9c861a84454a54a29d661d5524528a98a734c280e00df7b02185905
5
+ SHA512:
6
+ metadata.gz: 57f4cfabfb927e44d6384ae3fe1887cf33c8d28bc5be40533a8b3263e5da9b35db83d8e9bfb0a844e6e8320222d514aca7ec6633e40558f6d12db9fd8d771483
7
+ data.tar.gz: cd953b81c865fc9f0c47d62178ed49c564d70be02e98357f5d47def4124f528c97f68db634e56b4cc4b3e426d45f0353aa7aa2358d0abff417e0661bc7bcebc5
@@ -0,0 +1,46 @@
1
+ # Auto-generated by Cimas: Do not edit it manually!
2
+ # See https://github.com/metanorma/cimas
3
+ name: rake
4
+
5
+ on:
6
+ push:
7
+ branches: [ master, main ]
8
+ tags: [ v* ]
9
+ pull_request:
10
+
11
+ jobs:
12
+ rake:
13
+ name: Test on Ruby ${{ matrix.ruby }} ${{ matrix.os }}
14
+ runs-on: ${{ matrix.os }}
15
+ continue-on-error: ${{ matrix.experimental }}
16
+ strategy:
17
+ fail-fast: false
18
+ matrix:
19
+ ruby: [ '2.7', '2.6', '2.5', '2.4' ]
20
+ os: [ ubuntu-latest, windows-latest, macos-latest ]
21
+ experimental: [ false ]
22
+ include:
23
+ - ruby: '3.0'
24
+ os: 'ubuntu-latest'
25
+ experimental: true
26
+ - ruby: '3.0'
27
+ os: 'windows-latest'
28
+ experimental: true
29
+ - ruby: '3.0'
30
+ os: 'macos-latest'
31
+ experimental: true
32
+ steps:
33
+ - uses: actions/checkout@v2
34
+ with:
35
+ submodules: true
36
+
37
+ # https://github.com/ruby-debug/debase/issues/89#issuecomment-686827382
38
+ - if: matrix.os == 'macos-latest' && matrix.ruby == '2.5'
39
+ run: echo BUNDLE_BUILD__DEBASE="--with-cflags=\"-Wno-error=implicit-function-declaration\"" >> $GITHUB_ENV
40
+
41
+ - uses: ruby/setup-ruby@v1
42
+ with:
43
+ ruby-version: ${{ matrix.ruby }}
44
+ bundler-cache: true
45
+
46
+ - run: bundle exec rake
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
12
+ .rubocop-https---raw-githubusercontent-com-riboseinc-oss-guides-master-ci-rubocop-yml
13
+ Gemfile.lock
14
+ .vscode/
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -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.4
9
+ Rails:
10
+ Enabled: false
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in relaton_cie.gemspec
4
+ gemspec
5
+
6
+ gem "rake", "~> 12.0"
7
+ gem "rspec", "~> 3.0"
data/LICENSE.txt 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.
data/README.adoc ADDED
@@ -0,0 +1,139 @@
1
+ = RelatonCie
2
+
3
+ image:https://img.shields.io/gem/v/relaton-cie.svg["Gem Version", link="https://rubygems.org/gems/relaton-cie"]
4
+ image:https://github.com/relaton/relaton-cie/workflows/macos/badge.svg["Build Status (macOS)", link="https://github.com/relaton/relaton-cie/actions?workflow=macos"]
5
+ image:https://github.com/relaton/relaton-cie/workflows/windows/badge.svg["Build Status (Windows)", link="https://github.com/relaton/relaton-cie/actions?workflow=windows"]
6
+ image:https://github.com/relaton/relaton-cie/workflows/ubuntu/badge.svg["Build Status (Ubuntu)", link="https://github.com/relaton/relaton-cie/actions?workflow=ubuntu"]
7
+ image:https://codeclimate.com/github/relaton/relaton-cie/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/relaton/relaton-cie"]
8
+ image:https://img.shields.io/github/issues-pr-raw/relaton/relaton-cie.svg["Pull Requests", link="https://github.com/relaton/relaton-cie/pulls"]
9
+ image:https://img.shields.io/github/commits-since/relaton/relaton-cie/latest.svg["Commits since latest",link="https://github.com/relaton/relaton-cie/releases"]
10
+
11
+ RelatonCie is a Ruby gem that search and fetch standards from the https://www.techstreet.com/cie/searches/31156444[International Commision on Illuminantion].
12
+
13
+ == Installation
14
+
15
+ Add this line to your application's Gemfile:
16
+
17
+ [source,ruby]
18
+ ----
19
+ gem 'relaton-cie'
20
+ ----
21
+
22
+ And then execute:
23
+
24
+ $ bundle install
25
+
26
+ Or install it yourself as:
27
+
28
+ $ gem install relaton-cie
29
+
30
+ == Usage
31
+
32
+ === Search document
33
+
34
+ [source,ruby]
35
+ ----
36
+ require 'relaton_cie'
37
+ => true
38
+
39
+ item = RelatonCie::CieBibliography.get 'CIE 001-1980'
40
+ [relaton-cie] ("CIE 001-1980") fetching...
41
+ [relaton-cie] ("CIE 001-1980") found CIE 001-1980
42
+ => #<RelatonBib::BibliographicItem:0x007fb3f6098920
43
+ ...
44
+
45
+ # Return nil if document doesn't exist.
46
+ RelatonCie::CieBibliography.get '1111'
47
+ [relaton-cie] ("1111") fetching...
48
+ [relaton-cie] WARNING no match found online for 1111. The code must be exactly like it is on the standards website.
49
+ => nil
50
+ ----
51
+
52
+ === Serialization
53
+
54
+ [source,ruby]
55
+ ----
56
+ item.to_xml
57
+ "<bibitem id="CIE001-1980" type="standard">
58
+ <fetched>2021-03-17</fetched>
59
+ <title type="title-main" format="text/plain">
60
+ Guidelines for minimizing urban sky glow near astronomical observatories (Joint Publication IAU/CIE)
61
+ </title>
62
+ <title type="main" format="text/plain">
63
+ Guidelines for minimizing urban sky glow near astronomical observatories (Joint Publication IAU/CIE)
64
+ </title>
65
+ <uri type="src">https://www.techstreet.com/cie/standards/cie-001-1980?product_id=1210107</uri>
66
+ <docidentifier type="CIE">CIE 001-1980</docidentifier>
67
+ <docidentifier type="ISBN">9783901906657</docidentifier>
68
+ <date type="published">
69
+ <on>1980-01-01</on>
70
+ </date>
71
+ <contributor>
72
+ <role type="publisher"/>
73
+ <organization>
74
+ <name>Commission Internationale de L'Eclairage</name>
75
+ <abbreviation>CIE</abbreviation>
76
+ <uri>cie.co.at</uri>
77
+ </organization>
78
+ </contributor>
79
+ <language>en</language>
80
+ <script>Latn</script>
81
+ <abstract format="text/plain" language="en" script="Latn">
82
+ The increase of outdoor lighting in urban areas has resulted in levels of sky glow which seriously threaten astronomical observatories, even where these have purposely been located more than 100 km from large cities. The International Astronomical Union (IAU) and the CIE have worked together to prepare these guidelines in order to stimulate collective action that minimizes the degradation of the astronomical environment near cities.
83
+
84
+ The problem and its solutions are stated in a manner that provides a basis for understanding, cooperation, and action by astronomers, lighting engineers and public authorities. The report explains the effect of man-made sky glow, the degree of glow likely to be produced by lighting near an observatory, the level above which sky glow should not be allowed to rise, and how it can be contained by good lighting practice and public ordinances.
85
+
86
+ The publication contains 24 pages and 2 figures.
87
+
88
+ This publication has been prepared by:
89
+
90
+ * R. Cayrel and F. G. Smith (IAU)
91
+ * A. J. Fisher and J. B. de Boer (CIE)
92
+ </abstract>
93
+ </bibitem>"
94
+ ----
95
+
96
+ With `bibdata: true` option XML output wrapped with `bibdata` element and `ext` element added.
97
+ [source,ruby]
98
+ ----
99
+ item.to_xml bibdata: true
100
+ "<bibdata type="standard">
101
+ <fetched>2021-03-17</fetched>
102
+ <title type="title-main" format="text/plain">
103
+ Guidelines for minimizing urban sky glow near astronomical observatories (Joint Publication IAU/CIE)
104
+ </title>
105
+ <title type="main" format="text/plain">
106
+ Guidelines for minimizing urban sky glow near astronomical observatories (Joint Publication IAU/CIE)
107
+ </title>
108
+ <uri type="src">https://www.techstreet.com/cie/standards/cie-001-1980?product_id=1210107</uri>
109
+ <docidentifier type="CIE">CIE 001-1980</docidentifier>
110
+ ...
111
+ <ext>
112
+ <doctype>document</doctype>
113
+ </ext>
114
+ </bibdata>"
115
+ ----
116
+
117
+ === Parse a file locally
118
+
119
+ [source,ruby]
120
+ ----
121
+ item = RelatonBib::XMLParser.from_xml File.read("spec/fixtures/bibdata.xml")
122
+ => #<RelatonBib::BibliographicItem:0x007fb4061aa498
123
+ ...
124
+ ----
125
+
126
+ == Development
127
+
128
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
129
+
130
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
131
+
132
+ == Contributing
133
+
134
+ Bug reports and pull requests are welcome on GitHub at https://github.com/relaton/relaton-cie.
135
+
136
+
137
+ == License
138
+
139
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -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
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "relaton_cie"
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__)
data/bin/setup ADDED
@@ -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,986 @@
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
+ <define name="document">
8
+ <element name="document">
9
+ <optional>
10
+ <attribute name="identifier"/>
11
+ </optional>
12
+ <ref name="bibdata"/>
13
+ <ref name="sections"/>
14
+ <zeroOrMore>
15
+ <ref name="references"/>
16
+ </zeroOrMore>
17
+ </element>
18
+ </define>
19
+ <define name="bibdata">
20
+ <element name="bibdata">
21
+ <ref name="BibData"/>
22
+ </element>
23
+ </define>
24
+ <define name="sections">
25
+ <element name="sections">
26
+ <oneOrMore>
27
+ <ref name="section"/>
28
+ </oneOrMore>
29
+ </element>
30
+ </define>
31
+ <define name="section">
32
+ <element name="section">
33
+ <ref name="Basic-Section"/>
34
+ <zeroOrMore>
35
+ <ref name="section"/>
36
+ </zeroOrMore>
37
+ </element>
38
+ </define>
39
+ <define name="Basic-Section">
40
+ <optional>
41
+ <attribute name="id">
42
+ <data type="ID"/>
43
+ </attribute>
44
+ </optional>
45
+ <optional>
46
+ <ref name="section-title"/>
47
+ </optional>
48
+ <optional>
49
+ <ref name="BasicBlock"/>
50
+ </optional>
51
+ <zeroOrMore>
52
+ <ref name="note"/>
53
+ </zeroOrMore>
54
+ </define>
55
+ <define name="references">
56
+ <element name="references">
57
+ <optional>
58
+ <attribute name="id">
59
+ <data type="ID"/>
60
+ </attribute>
61
+ </optional>
62
+ <optional>
63
+ <ref name="section-title"/>
64
+ </optional>
65
+ <zeroOrMore>
66
+ <ref name="BasicBlock"/>
67
+ </zeroOrMore>
68
+ <zeroOrMore>
69
+ <ref name="bibitem"/>
70
+ </zeroOrMore>
71
+ </element>
72
+ </define>
73
+ <define name="section-title">
74
+ <element name="title">
75
+ <zeroOrMore>
76
+ <ref name="TextElement"/>
77
+ </zeroOrMore>
78
+ </element>
79
+ </define>
80
+ <define name="BasicBlock">
81
+ <choice>
82
+ <ref name="paragraph-with-footnote"/>
83
+ <ref name="table"/>
84
+ <ref name="formula"/>
85
+ <ref name="admonition"/>
86
+ <ref name="ol"/>
87
+ <ref name="ul"/>
88
+ <ref name="dl"/>
89
+ <ref name="figure"/>
90
+ <ref name="quote"/>
91
+ <ref name="sourcecode"/>
92
+ <ref name="example"/>
93
+ <ref name="review"/>
94
+ <ref name="pre"/>
95
+ </choice>
96
+ </define>
97
+ <define name="paragraph">
98
+ <element name="p">
99
+ <ref name="ParagraphType"/>
100
+ </element>
101
+ </define>
102
+ <define name="Alignments">
103
+ <choice>
104
+ <value>left</value>
105
+ <value>right</value>
106
+ <value>center</value>
107
+ <value>justified</value>
108
+ </choice>
109
+ </define>
110
+ <define name="ParagraphType">
111
+ <attribute name="id">
112
+ <data type="ID"/>
113
+ </attribute>
114
+ <optional>
115
+ <attribute name="align">
116
+ <ref name="Alignments"/>
117
+ </attribute>
118
+ </optional>
119
+ <zeroOrMore>
120
+ <ref name="TextElement"/>
121
+ </zeroOrMore>
122
+ <zeroOrMore>
123
+ <ref name="note"/>
124
+ </zeroOrMore>
125
+ </define>
126
+ <define name="paragraph-with-footnote">
127
+ <element name="p">
128
+ <attribute name="id">
129
+ <data type="ID"/>
130
+ </attribute>
131
+ <optional>
132
+ <attribute name="align">
133
+ <ref name="Alignments"/>
134
+ </attribute>
135
+ </optional>
136
+ <zeroOrMore>
137
+ <choice>
138
+ <ref name="TextElement"/>
139
+ <ref name="fn"/>
140
+ </choice>
141
+ </zeroOrMore>
142
+ <zeroOrMore>
143
+ <ref name="note"/>
144
+ </zeroOrMore>
145
+ </element>
146
+ </define>
147
+ <define name="note">
148
+ <element name="note">
149
+ <attribute name="id">
150
+ <data type="ID"/>
151
+ </attribute>
152
+ <oneOrMore>
153
+ <ref name="paragraph"/>
154
+ </oneOrMore>
155
+ </element>
156
+ </define>
157
+ <define name="review">
158
+ <element name="review">
159
+ <attribute name="id">
160
+ <data type="ID"/>
161
+ </attribute>
162
+ <attribute name="reviewer"/>
163
+ <optional>
164
+ <attribute name="date">
165
+ <data type="dateTime"/>
166
+ </attribute>
167
+ </optional>
168
+ <attribute name="from">
169
+ <data type="IDREF"/>
170
+ </attribute>
171
+ <optional>
172
+ <attribute name="to">
173
+ <data type="IDREF"/>
174
+ </attribute>
175
+ </optional>
176
+ <oneOrMore>
177
+ <ref name="paragraph"/>
178
+ </oneOrMore>
179
+ </element>
180
+ </define>
181
+ <define name="formula">
182
+ <element name="formula">
183
+ <attribute name="id">
184
+ <data type="ID"/>
185
+ </attribute>
186
+ <optional>
187
+ <attribute name="unnumbered">
188
+ <data type="boolean"/>
189
+ </attribute>
190
+ </optional>
191
+ <ref name="stem"/>
192
+ <optional>
193
+ <ref name="dl"/>
194
+ </optional>
195
+ <zeroOrMore>
196
+ <ref name="note"/>
197
+ </zeroOrMore>
198
+ </element>
199
+ </define>
200
+ <define name="quote">
201
+ <element name="quote">
202
+ <attribute name="id">
203
+ <data type="ID"/>
204
+ </attribute>
205
+ <optional>
206
+ <attribute name="alignment">
207
+ <ref name="Alignments"/>
208
+ </attribute>
209
+ </optional>
210
+ <optional>
211
+ <ref name="quote-source"/>
212
+ </optional>
213
+ <optional>
214
+ <ref name="quote-author"/>
215
+ </optional>
216
+ <oneOrMore>
217
+ <ref name="paragraph-with-footnote"/>
218
+ </oneOrMore>
219
+ <zeroOrMore>
220
+ <ref name="note"/>
221
+ </zeroOrMore>
222
+ </element>
223
+ </define>
224
+ <define name="quote-source">
225
+ <element name="source">
226
+ <ref name="erefType"/>
227
+ </element>
228
+ </define>
229
+ <define name="quote-author">
230
+ <element name="author">
231
+ <text/>
232
+ </element>
233
+ </define>
234
+ <define name="sourcecode">
235
+ <element name="sourcecode">
236
+ <attribute name="id">
237
+ <data type="ID"/>
238
+ </attribute>
239
+ <optional>
240
+ <attribute name="unnumbered">
241
+ <data type="boolean"/>
242
+ </attribute>
243
+ </optional>
244
+ <optional>
245
+ <attribute name="lang"/>
246
+ </optional>
247
+ <optional>
248
+ <ref name="tname"/>
249
+ </optional>
250
+ <oneOrMore>
251
+ <choice>
252
+ <text/>
253
+ <ref name="callout"/>
254
+ </choice>
255
+ </oneOrMore>
256
+ <zeroOrMore>
257
+ <ref name="annotation"/>
258
+ </zeroOrMore>
259
+ <zeroOrMore>
260
+ <ref name="note"/>
261
+ </zeroOrMore>
262
+ </element>
263
+ </define>
264
+ <define name="pre">
265
+ <element name="pre">
266
+ <attribute name="id">
267
+ <data type="ID"/>
268
+ </attribute>
269
+ <optional>
270
+ <ref name="tname"/>
271
+ </optional>
272
+ <text/>
273
+ <zeroOrMore>
274
+ <ref name="note"/>
275
+ </zeroOrMore>
276
+ </element>
277
+ </define>
278
+ <define name="table">
279
+ <element name="table">
280
+ <attribute name="id">
281
+ <data type="ID"/>
282
+ </attribute>
283
+ <optional>
284
+ <attribute name="unnumbered">
285
+ <data type="boolean"/>
286
+ </attribute>
287
+ </optional>
288
+ <optional>
289
+ <attribute name="alt"/>
290
+ </optional>
291
+ <optional>
292
+ <attribute name="uri">
293
+ <data type="anyURI"/>
294
+ </attribute>
295
+ </optional>
296
+ <optional>
297
+ <ref name="tname"/>
298
+ </optional>
299
+ <optional>
300
+ <ref name="thead"/>
301
+ </optional>
302
+ <ref name="tbody"/>
303
+ <optional>
304
+ <ref name="tfoot"/>
305
+ </optional>
306
+ <zeroOrMore>
307
+ <ref name="table-note"/>
308
+ </zeroOrMore>
309
+ <optional>
310
+ <ref name="dl"/>
311
+ </optional>
312
+ </element>
313
+ </define>
314
+ <define name="tname">
315
+ <element name="name">
316
+ <text/>
317
+ </element>
318
+ </define>
319
+ <define name="tclass">
320
+ <element name="name">
321
+ <text/>
322
+ </element>
323
+ </define>
324
+ <define name="thead">
325
+ <element name="thead">
326
+ <ref name="tr"/>
327
+ </element>
328
+ </define>
329
+ <define name="tfoot">
330
+ <element name="tfoot">
331
+ <ref name="tr"/>
332
+ </element>
333
+ </define>
334
+ <define name="tbody">
335
+ <element name="tbody">
336
+ <oneOrMore>
337
+ <ref name="tr"/>
338
+ </oneOrMore>
339
+ </element>
340
+ </define>
341
+ <define name="table-note">
342
+ <element name="note">
343
+ <ref name="paragraph"/>
344
+ </element>
345
+ </define>
346
+ <define name="tr">
347
+ <element name="tr">
348
+ <oneOrMore>
349
+ <choice>
350
+ <ref name="td"/>
351
+ <ref name="th"/>
352
+ </choice>
353
+ </oneOrMore>
354
+ </element>
355
+ </define>
356
+ <define name="td">
357
+ <element name="td">
358
+ <optional>
359
+ <attribute name="colspan"/>
360
+ </optional>
361
+ <optional>
362
+ <attribute name="rowspan"/>
363
+ </optional>
364
+ <optional>
365
+ <attribute name="align">
366
+ <choice>
367
+ <value>left</value>
368
+ <value>right</value>
369
+ <value>center</value>
370
+ </choice>
371
+ </attribute>
372
+ </optional>
373
+ <choice>
374
+ <zeroOrMore>
375
+ <ref name="TextElement"/>
376
+ </zeroOrMore>
377
+ <oneOrMore>
378
+ <ref name="paragraph-with-footnote"/>
379
+ </oneOrMore>
380
+ </choice>
381
+ </element>
382
+ </define>
383
+ <define name="th">
384
+ <element name="th">
385
+ <optional>
386
+ <attribute name="colspan"/>
387
+ </optional>
388
+ <optional>
389
+ <attribute name="rowspan"/>
390
+ </optional>
391
+ <optional>
392
+ <attribute name="align">
393
+ <choice>
394
+ <value>left</value>
395
+ <value>right</value>
396
+ <value>center</value>
397
+ </choice>
398
+ </attribute>
399
+ </optional>
400
+ <choice>
401
+ <zeroOrMore>
402
+ <ref name="TextElement"/>
403
+ </zeroOrMore>
404
+ <oneOrMore>
405
+ <ref name="paragraph-with-footnote"/>
406
+ </oneOrMore>
407
+ </choice>
408
+ </element>
409
+ </define>
410
+ <define name="example">
411
+ <element name="example">
412
+ <attribute name="id">
413
+ <data type="ID"/>
414
+ </attribute>
415
+ <optional>
416
+ <attribute name="unnumbered">
417
+ <data type="boolean"/>
418
+ </attribute>
419
+ </optional>
420
+ <oneOrMore>
421
+ <choice>
422
+ <ref name="formula"/>
423
+ <ref name="ul"/>
424
+ <ref name="ol"/>
425
+ <ref name="dl"/>
426
+ <ref name="quote"/>
427
+ <ref name="sourcecode"/>
428
+ <ref name="paragraph-with-footnote"/>
429
+ </choice>
430
+ </oneOrMore>
431
+ <zeroOrMore>
432
+ <ref name="note"/>
433
+ </zeroOrMore>
434
+ </element>
435
+ </define>
436
+ <define name="admonition">
437
+ <element name="admonition">
438
+ <attribute name="type">
439
+ <ref name="AdmonitionType"/>
440
+ </attribute>
441
+ <optional>
442
+ <attribute name="class"/>
443
+ </optional>
444
+ <attribute name="id">
445
+ <data type="ID"/>
446
+ </attribute>
447
+ <optional>
448
+ <attribute name="uri">
449
+ <data type="anyURI"/>
450
+ </attribute>
451
+ </optional>
452
+ <optional>
453
+ <ref name="tname"/>
454
+ </optional>
455
+ <zeroOrMore>
456
+ <ref name="paragraph-with-footnote"/>
457
+ </zeroOrMore>
458
+ <zeroOrMore>
459
+ <ref name="note"/>
460
+ </zeroOrMore>
461
+ </element>
462
+ </define>
463
+ <define name="AdmonitionType">
464
+ <choice>
465
+ <value>warning</value>
466
+ <value>note</value>
467
+ <value>tip</value>
468
+ <value>important</value>
469
+ <value>caution</value>
470
+ <value>statement</value>
471
+ </choice>
472
+ </define>
473
+ <define name="figure">
474
+ <element name="figure">
475
+ <attribute name="id">
476
+ <data type="ID"/>
477
+ </attribute>
478
+ <optional>
479
+ <attribute name="unnumbered">
480
+ <data type="boolean"/>
481
+ </attribute>
482
+ </optional>
483
+ <optional>
484
+ <ref name="source"/>
485
+ </optional>
486
+ <optional>
487
+ <ref name="tname"/>
488
+ </optional>
489
+ <optional>
490
+ <ref name="tclass"/>
491
+ </optional>
492
+ <choice>
493
+ <ref name="image"/>
494
+ <ref name="pre"/>
495
+ <zeroOrMore>
496
+ <ref name="figure"/>
497
+ </zeroOrMore>
498
+ </choice>
499
+ <zeroOrMore>
500
+ <ref name="fn"/>
501
+ </zeroOrMore>
502
+ <optional>
503
+ <ref name="dl"/>
504
+ </optional>
505
+ <zeroOrMore>
506
+ <ref name="note"/>
507
+ </zeroOrMore>
508
+ </element>
509
+ </define>
510
+ <define name="TextElement">
511
+ <choice>
512
+ <text/>
513
+ <ref name="em"/>
514
+ <ref name="eref"/>
515
+ <ref name="strong"/>
516
+ <ref name="stem"/>
517
+ <ref name="sub"/>
518
+ <ref name="sup"/>
519
+ <ref name="tt"/>
520
+ <ref name="underline"/>
521
+ <ref name="keyword"/>
522
+ <ref name="ruby"/>
523
+ <ref name="strike"/>
524
+ <ref name="smallcap"/>
525
+ <ref name="xref"/>
526
+ <ref name="br"/>
527
+ <ref name="hyperlink"/>
528
+ <ref name="hr"/>
529
+ <ref name="pagebreak"/>
530
+ <ref name="bookmark"/>
531
+ <ref name="image"/>
532
+ </choice>
533
+ </define>
534
+ <define name="PureTextElement">
535
+ <choice>
536
+ <text/>
537
+ <ref name="em"/>
538
+ <ref name="strong"/>
539
+ <ref name="sub"/>
540
+ <ref name="sup"/>
541
+ <ref name="tt"/>
542
+ <ref name="underline"/>
543
+ <ref name="strike"/>
544
+ <ref name="smallcap"/>
545
+ <ref name="br"/>
546
+ </choice>
547
+ </define>
548
+ <define name="source">
549
+ <element name="source">
550
+ <ref name="TypedUri"/>
551
+ </element>
552
+ </define>
553
+ <define name="em">
554
+ <element name="em">
555
+ <zeroOrMore>
556
+ <ref name="PureTextElement"/>
557
+ </zeroOrMore>
558
+ </element>
559
+ </define>
560
+ <define name="strong">
561
+ <element name="strong">
562
+ <zeroOrMore>
563
+ <ref name="PureTextElement"/>
564
+ </zeroOrMore>
565
+ </element>
566
+ </define>
567
+ <define name="tt">
568
+ <element name="tt">
569
+ <zeroOrMore>
570
+ <ref name="PureTextElement"/>
571
+ </zeroOrMore>
572
+ </element>
573
+ </define>
574
+ <define name="keyword">
575
+ <element name="keyword">
576
+ <zeroOrMore>
577
+ <ref name="PureTextElement"/>
578
+ </zeroOrMore>
579
+ </element>
580
+ </define>
581
+ <define name="sub">
582
+ <element name="sub">
583
+ <zeroOrMore>
584
+ <ref name="PureTextElement"/>
585
+ </zeroOrMore>
586
+ </element>
587
+ </define>
588
+ <define name="sup">
589
+ <element name="sup">
590
+ <zeroOrMore>
591
+ <ref name="PureTextElement"/>
592
+ </zeroOrMore>
593
+ </element>
594
+ </define>
595
+ <define name="strike">
596
+ <element name="strike">
597
+ <zeroOrMore>
598
+ <ref name="PureTextElement"/>
599
+ </zeroOrMore>
600
+ </element>
601
+ </define>
602
+ <define name="underline">
603
+ <element name="underline">
604
+ <zeroOrMore>
605
+ <ref name="PureTextElement"/>
606
+ </zeroOrMore>
607
+ </element>
608
+ </define>
609
+ <define name="smallcap">
610
+ <element name="smallcap">
611
+ <zeroOrMore>
612
+ <ref name="PureTextElement"/>
613
+ </zeroOrMore>
614
+ </element>
615
+ </define>
616
+ <define name="ruby">
617
+ <element name="ruby">
618
+ <zeroOrMore>
619
+ <choice>
620
+ <ref name="PureTextElement"/>
621
+ <ref name="rp"/>
622
+ <ref name="rt"/>
623
+ </choice>
624
+ </zeroOrMore>
625
+ </element>
626
+ </define>
627
+ <define name="rp">
628
+ <element name="rp">
629
+ <zeroOrMore>
630
+ <ref name="PureTextElement"/>
631
+ </zeroOrMore>
632
+ </element>
633
+ </define>
634
+ <define name="rt">
635
+ <element name="rt">
636
+ <zeroOrMore>
637
+ <ref name="PureTextElement"/>
638
+ </zeroOrMore>
639
+ </element>
640
+ </define>
641
+ <define name="br">
642
+ <element name="br">
643
+ <empty/>
644
+ </element>
645
+ </define>
646
+ <define name="hr">
647
+ <element name="hr">
648
+ <empty/>
649
+ </element>
650
+ </define>
651
+ <define name="pagebreak">
652
+ <element name="pagebreak">
653
+ <empty/>
654
+ </element>
655
+ </define>
656
+ <!-- bare ID element, used for referencing arbitrary spans of text -->
657
+ <define name="bookmark">
658
+ <element name="bookmark">
659
+ <attribute name="id">
660
+ <data type="ID"/>
661
+ </attribute>
662
+ <empty/>
663
+ </element>
664
+ </define>
665
+ <define name="ReferenceFormat">
666
+ <choice>
667
+ <value>external</value>
668
+ <value>inline</value>
669
+ <value>footnote</value>
670
+ <value>callout</value>
671
+ </choice>
672
+ </define>
673
+ <define name="eref">
674
+ <element name="eref">
675
+ <ref name="erefType"/>
676
+ </element>
677
+ </define>
678
+ <define name="erefType">
679
+ <optional>
680
+ <attribute name="normative">
681
+ <data type="boolean"/>
682
+ </attribute>
683
+ </optional>
684
+ <attribute name="citeas"/>
685
+ <attribute name="type">
686
+ <ref name="ReferenceFormat"/>
687
+ </attribute>
688
+ <optional>
689
+ <attribute name="alt"/>
690
+ </optional>
691
+ <ref name="CitationType"/>
692
+ <text/>
693
+ </define>
694
+ <define name="hyperlink">
695
+ <element name="link">
696
+ <attribute name="target">
697
+ <data type="anyURI"/>
698
+ </attribute>
699
+ <attribute name="type">
700
+ <ref name="ReferenceFormat"/>
701
+ </attribute>
702
+ <optional>
703
+ <attribute name="alt"/>
704
+ </optional>
705
+ <text/>
706
+ </element>
707
+ </define>
708
+ <define name="xref">
709
+ <element name="xref">
710
+ <attribute name="target">
711
+ <data type="IDREF"/>
712
+ </attribute>
713
+ <attribute name="type">
714
+ <ref name="ReferenceFormat"/>
715
+ </attribute>
716
+ <optional>
717
+ <attribute name="alt"/>
718
+ </optional>
719
+ <text/>
720
+ </element>
721
+ </define>
722
+ <define name="fn">
723
+ <element name="fn">
724
+ <attribute name="reference"/>
725
+ <oneOrMore>
726
+ <ref name="paragraph"/>
727
+ </oneOrMore>
728
+ </element>
729
+ </define>
730
+ <!--
731
+ This is xref with fixed @type="footnote", and @target built in as paragraph+
732
+ @reference replaces ReferenceElement/text
733
+ so <fn reference="2"><p>This is a footnote</p></fn>
734
+ corresponds to
735
+ <eref type="footnote" target="fn2">2</xref> <p id="fn2">This is a footnote</p>
736
+ -->
737
+ <define name="callout">
738
+ <element name="callout">
739
+ <attribute name="target">
740
+ <data type="IDREF"/>
741
+ </attribute>
742
+ <text/>
743
+ </element>
744
+ </define>
745
+ <!--
746
+ This is xref with fixed @type="callout"; the target by convention is in an annotation in the same source code snippet
747
+ so <callout target="xyz">1</callout>
748
+ corresponds to <xref type="callout" target="xyz">1</xref>
749
+ -->
750
+ <define name="image">
751
+ <element name="image">
752
+ <attribute name="id">
753
+ <data type="ID"/>
754
+ </attribute>
755
+ <attribute name="src">
756
+ <data type="anyURI"/>
757
+ </attribute>
758
+ <attribute name="mimetype"/>
759
+ <optional>
760
+ <attribute name="filename"/>
761
+ </optional>
762
+ <optional>
763
+ <attribute name="width">
764
+ <choice>
765
+ <data type="int"/>
766
+ <value>auto</value>
767
+ </choice>
768
+ </attribute>
769
+ </optional>
770
+ <optional>
771
+ <attribute name="height">
772
+ <choice>
773
+ <data type="int"/>
774
+ <value>auto</value>
775
+ </choice>
776
+ </attribute>
777
+ </optional>
778
+ <optional>
779
+ <attribute name="alt"/>
780
+ </optional>
781
+ <optional>
782
+ <attribute name="longdesc">
783
+ <data type="anyURI"/>
784
+ </attribute>
785
+ </optional>
786
+ </element>
787
+ </define>
788
+ <define name="video">
789
+ <element name="image">
790
+ <attribute name="id">
791
+ <data type="ID"/>
792
+ </attribute>
793
+ <attribute name="src">
794
+ <data type="anyURI"/>
795
+ </attribute>
796
+ <attribute name="mimetype"/>
797
+ <optional>
798
+ <attribute name="filename"/>
799
+ </optional>
800
+ <optional>
801
+ <attribute name="width">
802
+ <choice>
803
+ <data type="int"/>
804
+ <value>auto</value>
805
+ </choice>
806
+ </attribute>
807
+ </optional>
808
+ <optional>
809
+ <attribute name="height">
810
+ <choice>
811
+ <data type="int"/>
812
+ <value>auto</value>
813
+ </choice>
814
+ </attribute>
815
+ </optional>
816
+ <optional>
817
+ <attribute name="alt"/>
818
+ </optional>
819
+ <optional>
820
+ <attribute name="longdesc">
821
+ <data type="anyURI"/>
822
+ </attribute>
823
+ </optional>
824
+ <zeroOrMore>
825
+ <ref name="altsource"/>
826
+ </zeroOrMore>
827
+ </element>
828
+ </define>
829
+ <define name="audio">
830
+ <element name="image">
831
+ <attribute name="id">
832
+ <data type="ID"/>
833
+ </attribute>
834
+ <attribute name="src">
835
+ <data type="anyURI"/>
836
+ </attribute>
837
+ <attribute name="mimetype"/>
838
+ <optional>
839
+ <attribute name="filename"/>
840
+ </optional>
841
+ <optional>
842
+ <attribute name="alt"/>
843
+ </optional>
844
+ <optional>
845
+ <attribute name="longdesc">
846
+ <data type="anyURI"/>
847
+ </attribute>
848
+ </optional>
849
+ <zeroOrMore>
850
+ <ref name="altsource"/>
851
+ </zeroOrMore>
852
+ </element>
853
+ </define>
854
+ <define name="altsource">
855
+ <element name="altsource">
856
+ <attribute name="src">
857
+ <data type="anyURI"/>
858
+ </attribute>
859
+ <attribute name="mimetype"/>
860
+ <optional>
861
+ <attribute name="filename"/>
862
+ </optional>
863
+ </element>
864
+ </define>
865
+ <define name="stem">
866
+ <element name="stem">
867
+ <attribute name="type">
868
+ <choice>
869
+ <value>MathML</value>
870
+ <value>AsciiMath</value>
871
+ </choice>
872
+ </attribute>
873
+ <oneOrMore>
874
+ <choice>
875
+ <text/>
876
+ <ref name="AnyElement"/>
877
+ </choice>
878
+ </oneOrMore>
879
+ </element>
880
+ </define>
881
+ <define name="annotation">
882
+ <element name="annotation">
883
+ <attribute name="id">
884
+ <data type="ID"/>
885
+ </attribute>
886
+ <ref name="paragraph"/>
887
+ </element>
888
+ </define>
889
+ <define name="ul">
890
+ <element name="ul">
891
+ <attribute name="id">
892
+ <data type="ID"/>
893
+ </attribute>
894
+ <oneOrMore>
895
+ <ref name="li"/>
896
+ </oneOrMore>
897
+ <zeroOrMore>
898
+ <ref name="note"/>
899
+ </zeroOrMore>
900
+ </element>
901
+ </define>
902
+ <define name="li">
903
+ <element name="li">
904
+ <optional>
905
+ <attribute name="id">
906
+ <data type="ID"/>
907
+ </attribute>
908
+ </optional>
909
+ <oneOrMore>
910
+ <ref name="paragraph-with-footnote"/>
911
+ </oneOrMore>
912
+ </element>
913
+ </define>
914
+ <define name="ol">
915
+ <element name="ol">
916
+ <attribute name="id">
917
+ <data type="ID"/>
918
+ </attribute>
919
+ <attribute name="type">
920
+ <choice>
921
+ <value>roman</value>
922
+ <value>alphabet</value>
923
+ <value>arabic</value>
924
+ <value>roman_upper</value>
925
+ <value>alphabet_upper</value>
926
+ </choice>
927
+ </attribute>
928
+ <oneOrMore>
929
+ <ref name="li"/>
930
+ </oneOrMore>
931
+ <zeroOrMore>
932
+ <ref name="note"/>
933
+ </zeroOrMore>
934
+ </element>
935
+ </define>
936
+ <define name="dl">
937
+ <element name="dl">
938
+ <attribute name="id">
939
+ <data type="ID"/>
940
+ </attribute>
941
+ <oneOrMore>
942
+ <ref name="dt"/>
943
+ <ref name="dd"/>
944
+ </oneOrMore>
945
+ <zeroOrMore>
946
+ <ref name="note"/>
947
+ </zeroOrMore>
948
+ </element>
949
+ </define>
950
+ <define name="dt">
951
+ <element name="dt">
952
+ <zeroOrMore>
953
+ <ref name="TextElement"/>
954
+ </zeroOrMore>
955
+ </element>
956
+ </define>
957
+ <define name="dd">
958
+ <element name="dd">
959
+ <zeroOrMore>
960
+ <ref name="paragraph-with-footnote"/>
961
+ </zeroOrMore>
962
+ </element>
963
+ </define>
964
+ <define name="ext">
965
+ <element name="ext">
966
+ <ref name="BibDataExtensionType"/>
967
+ </element>
968
+ </define>
969
+ <define name="BibDataExtensionType">
970
+ <ref name="doctype"/>
971
+ </define>
972
+ <define name="doctype">
973
+ <element name="doctype">
974
+ <ref name="DocumentType"/>
975
+ </element>
976
+ </define>
977
+ <define name="DocumentType">
978
+ <value>document</value>
979
+ </define>
980
+ <define name="BibData">
981
+ <ref name="BibliographicItem"/>
982
+ <optional>
983
+ <ref name="ext"/>
984
+ </optional>
985
+ </define>
986
+ </grammar>