relaton-bsi 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: b828898945951664bebe072e4729142cdc0b1d4db3d8a8a89aca2c69810fd0ec
4
+ data.tar.gz: 5963c433c5f588749406998d48a5f41f8d6ad80332177389f5311ef75a9db200
5
+ SHA512:
6
+ metadata.gz: e04430358422a212584e341401a3a58fa083fc43928e02c9eede170705f625b960f230dabcf949302231e7e2ba5378da45923e560efd14a573b2b60fc67ddba5
7
+ data.tar.gz: 3ff635593bb350d2a8b86afd0ada9183cc49a2eeb07d6dcceeb54d3c614f11e04bb6d94ac97fd492ed77f5339493488d22b44bd1195412e185d56a41f1edeba5
@@ -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,13 @@
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
+ Gemfile.lock
13
+ .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,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in relaton_bsi.gemspec
6
+ gemspec
7
+
8
+ gem "rake", "~> 13.0"
9
+
10
+ gem "rspec", "~> 3.0"
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2021 Andrei Kislichenko
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.adoc ADDED
@@ -0,0 +1,168 @@
1
+ = RelatonBsi retrieve BSI Standards for bibliographic use using the BibliographicItem model
2
+
3
+ image:https://img.shields.io/gem/v/relaton-bsi.svg["Gem Version", link="https://rubygems.org/gems/relaton-bsi"]
4
+ image:https://github.com/relaton/relaton-bsi/workflows/macos/badge.svg["Build Status (macOS)", link="https://github.com/relaton/relaton-bsi/actions?workflow=macos"]
5
+ image:https://github.com/relaton/relaton-bsi/workflows/windows/badge.svg["Build Status (Windows)", link="https://github.com/relaton/relaton-bsi/actions?workflow=windows"]
6
+ image:https://github.com/relaton/relaton-bsi/workflows/ubuntu/badge.svg["Build Status (Ubuntu)", link="https://github.com/relaton/relaton-bsi/actions?workflow=ubuntu"]
7
+ image:https://codeclimate.com/github/relaton/relaton-bsi/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/relaton/relaton-bsi"]
8
+ image:https://img.shields.io/github/issues-pr-raw/relaton/relaton-bsi.svg["Pull Requests", link="https://github.com/relaton/relaton-bsi/pulls"]
9
+ image:https://img.shields.io/github/commits-since/relaton/relaton-bsi/latest.svg["Commits since latest",link="https://github.com/relaton/relaton-bsi/releases"]
10
+
11
+ RelatonBsi is a Ruby gem that implements the https://github.com/metanorma/metanorma-model-iso#iso-bibliographic-item[IsoBibliographicItem model].
12
+
13
+ == Installation
14
+
15
+ Add this line to your application's Gemfile:
16
+
17
+ [source,ruby]
18
+ ----
19
+ gem 'relaton-bsi'
20
+ ----
21
+
22
+ And then execute:
23
+
24
+ $ bundle install
25
+
26
+ Or install it yourself as:
27
+
28
+ $ gem install relaton-bsi
29
+
30
+ == Usage
31
+
32
+ === Search for a standard using keywords
33
+
34
+ [source,ruby]
35
+ ----
36
+ require 'relaton_bsi'
37
+
38
+ hit_collection = RelatonBsi::BsiBibliography.search("BSI BS EN ISO 8848")
39
+ => <RelatonBsi::HitCollection:0x007fead49fe1f8 @ref=BS EN ISO 8848 @fetched=false>
40
+
41
+ item = hit_collection[1].fetch
42
+ => #<RelatonBsi::BsiBibliographicItem:0x007fead494fbf8
43
+ ...
44
+ ----
45
+
46
+ === XML serialization
47
+ [source,ruby]
48
+ ----
49
+ item.to_xml
50
+ "<bibitem id="BSENISO8848-2017" type="standard">
51
+ <fetched>2021-04-23</fetched>
52
+ <title type="title-intro" format="text/plain" language="en" script="Latn">Small craft</title>
53
+ <title type="title-main" format="text/plain" language="en" script="Latn">Remote steering systems</title>
54
+ <title type="main" format="text/plain" language="en" script="Latn">Small craft - Remote steering systems</title>
55
+ <title type="title-main" format="text/plain" language="fr" script="Latn">Navires de plaisance. Appareils à gouverner commandés à distance</title>
56
+ <title type="main" format="text/plain" language="fr" script="Latn">Navires de plaisance. Appareils à gouverner commandés à distance</title>
57
+ <title type="title-main" format="text/plain" language="de" script="Latn">Kleine Wasserfahrzeuge. Steueranlagen</title>
58
+ <title type="main" format="text/plain" language="de" script="Latn">Kleine Wasserfahrzeuge. Steueranlagen</title>
59
+ <uri type="src">https://shop.bsigroup.com/ProductDetail?pid=000000000030415929</uri>
60
+ <docidentifier type="BSI">BS EN ISO 8848:2017</docidentifier>
61
+ <docidentifier type="ISBN">978 0 539 13462 9</docidentifier>
62
+ <date type="published">
63
+ <on>2021-04-14</on>
64
+ </date>
65
+ <contributor>
66
+ <role type="publisher"/>
67
+ <organization>
68
+ <name>British Standards Institution</name>
69
+ <abbreviation>BSI</abbreviation>
70
+ <uri>https://www.bsigroup.com/</uri>
71
+ </organization>
72
+ </contributor>
73
+ <language>en</language>
74
+ <script>Latn</script>
75
+ <abstract format="text/plain" language="en" script="Latn">Static loading, Testing conditions, Dimensions, Distant, Steering control devices, Specimen preparation, Deformation, Steering gear, Impact testing, Installation, Steering wheels, Fasteners, Boats, Vehicle components, Water transport engineering components, Mechanical testing </abstract>
76
+ <status>
77
+ <stage>Superseded, Withdrawn</stage>
78
+ </status>
79
+ <copyright>
80
+ <from>2021</from>
81
+ <owner>
82
+ <organization>
83
+ <name>British Standards Institution</name>
84
+ <abbreviation>BSI</abbreviation>
85
+ <uri>https://www.bsigroup.com/</uri>
86
+ </organization>
87
+ </owner>
88
+ </copyright>
89
+ <relation type="complements">
90
+ <bibitem type="standard">
91
+ <formattedref format="text/plain" language="en" script="Latn">BS EN 28848:1993</formattedref>
92
+ <uri type="src">https://shop.bsigroup.com/ProductDetail/?pid=000000000030046595</uri>
93
+ </bibitem>
94
+ </relation>
95
+ <place>London</place>
96
+ </bibitem>"
97
+ ----
98
+
99
+ With `bibdata: true` option XML output wrapped with `bibdata` element and `ext` element added.
100
+ [source,ruby]
101
+ ----
102
+ item.to_xml bibdata: true
103
+ "<bibdata type="standard">
104
+ <fetched>2021-04-23</fetched>
105
+ <title type="title-intro" format="text/plain" language="en" script="Latn">Small craft</title>
106
+ ...
107
+ <ext>
108
+ <editorialgroup>
109
+ <technical-committee>GME/33</technical-committee>
110
+ </editorialgroup>
111
+ <ics>
112
+ <code>47.080</code>
113
+ <text>Small craft</text>
114
+ </ics>
115
+ </ext>
116
+ </bibdata>"
117
+ ----
118
+
119
+ === Get code, and year
120
+ [source,ruby]
121
+ ----
122
+ RelatonBsi::BsiBibliographicItem RelatonBsi::BsiBibliography
123
+ [7] pry(main)> RelatonBsi::BsiBibliography.get "BSI BS EN ISO 8848:2021"
124
+ [relaton-bsi] ("BSI BS EN ISO 8848:2021") fetching...
125
+ [relaton-bsi] ("BSI BS EN ISO 8848:2021") found BS EN ISO 8848:2021
126
+ => #<RelatonBsi::BsiBibliographicItem:0x007feb14814ca8
127
+ ...
128
+
129
+ RelatonBsi::BsiBibliography.get "BSI BS EN ISO 8848", "2021"
130
+ [relaton-bsi] ("BSI BS EN ISO 8848") fetching...
131
+ [relaton-bsi] ("BSI BS EN ISO 8848") found BS EN ISO 8848:2021
132
+ => #<RelatonBsi::BsiBibliographicItem:0x007feaf59188a8
133
+ ...
134
+ ----
135
+
136
+ === Create bibliographic item form YAML
137
+ [source,ruby]
138
+ ----
139
+ hash = YAML.load_file 'spec/fixtures/bibdata.yaml'
140
+ => {"id"=>"BSENISO8848-2021",
141
+ ...
142
+
143
+ RelatonBsi::BsiBibliographicItem.from_hash hash
144
+ => #<RelatonBsi::BsiBibliographicItem:0x007feaf5109630
145
+ ...
146
+ ----
147
+
148
+ === Create bibliographic item from XML
149
+ [source,ruby]
150
+ ----
151
+ RelatonBsi::XMLParser.from_xml File.read("spec/fixtures/bibdata.xml", encoding: "UTF-8")
152
+ => #<RelatonBsi::BsiBibliographicItem:0x007feb14d50b68
153
+ ...
154
+ ----
155
+
156
+ == Development
157
+
158
+ 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.
159
+
160
+ 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 the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
161
+
162
+ == Contributing
163
+
164
+ Bug reports and pull requests are welcome on GitHub at https://github.com/relaton/relaton-bsi.
165
+
166
+ == License
167
+
168
+ 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,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ # require "rubocop/rake_task"
9
+
10
+ # RuboCop::RakeTask.new
11
+
12
+ task default: %i[spec]
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require "relaton_bsi"
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require "irb"
15
+ IRB.start(__FILE__)
data/bin/rspec ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'rspec' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "pathname"
12
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require "rubygems"
27
+ require "bundler/setup"
28
+
29
+ load Gem.bin_path("rspec-core", "rspec")
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>