metanorma-sample 1.0.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +1 -0
  3. data/.hound.yml +3 -0
  4. data/.rubocop.yml +10 -0
  5. data/.travis.yml +16 -0
  6. data/CODE_OF_CONDUCT.md +74 -0
  7. data/Gemfile +4 -0
  8. data/LICENSE +25 -0
  9. data/README.adoc +13 -0
  10. data/Rakefile +6 -0
  11. data/asciidoctor-metanorma_sample.gemspec +46 -0
  12. data/bin/console +14 -0
  13. data/bin/rspec +18 -0
  14. data/bin/setup +8 -0
  15. data/lib/asciidoctor-sample.rb +11 -0
  16. data/lib/asciidoctor/sample.rb +7 -0
  17. data/lib/asciidoctor/sample/biblio.rng +890 -0
  18. data/lib/asciidoctor/sample/converter.rb +162 -0
  19. data/lib/asciidoctor/sample/isodoc.rng +1091 -0
  20. data/lib/asciidoctor/sample/isostandard.rng +1068 -0
  21. data/lib/asciidoctor/sample/pdf.js +31 -0
  22. data/lib/asciidoctor/sample/sample.rng +196 -0
  23. data/lib/isodoc/sample/html/header.html +184 -0
  24. data/lib/isodoc/sample/html/html_sample_intro.html +8 -0
  25. data/lib/isodoc/sample/html/html_sample_titlepage.html +106 -0
  26. data/lib/isodoc/sample/html/htmlstyle.scss +1038 -0
  27. data/lib/isodoc/sample/html/logo.jpg +0 -0
  28. data/lib/isodoc/sample/html/sample.scss +644 -0
  29. data/lib/isodoc/sample/html/scripts.html +82 -0
  30. data/lib/isodoc/sample/html/scripts.pdf.html +70 -0
  31. data/lib/isodoc/sample/html/word_sample_intro.html +72 -0
  32. data/lib/isodoc/sample/html/word_sample_titlepage.html +75 -0
  33. data/lib/isodoc/sample/html/wordstyle.scss +1105 -0
  34. data/lib/isodoc/sample/html_convert.rb +120 -0
  35. data/lib/isodoc/sample/metadata.rb +74 -0
  36. data/lib/isodoc/sample/pdf_convert.rb +117 -0
  37. data/lib/isodoc/sample/word_convert.rb +98 -0
  38. data/lib/metanorma/sample.rb +7 -0
  39. data/lib/metanorma/sample/processor.rb +43 -0
  40. data/lib/metanorma/sample/version.rb +5 -0
  41. metadata +310 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 2c2e9242fe6f3b66d57f6db63c8da787fb79289a9bf9d244b1c35a08943b753c
4
+ data.tar.gz: ecc62ec3a128afecedcfd1ae875a44c01e4dcc1413bba385cff4a0fd32724e44
5
+ SHA512:
6
+ metadata.gz: 4c18cc0cea371dbb925b63df38f43c61a6a4599936e8a26003d8a63488db4832d0367252a9525e0c51473dd12f172ed288970928ac663d2ad67474def777f95b
7
+ data.tar.gz: 2be6aa30e3cac5c50cf1800e21fc693fc78a1ef0f27ea68c6777165e100a53ffea8900ae812b5024f62453b036dd2b1230b74ce972f0fbc61bbf0f22723da850
@@ -0,0 +1 @@
1
+ .DS_Store
@@ -0,0 +1,3 @@
1
+ ruby:
2
+ Enabled: true
3
+ config_file: .rubocop.yml
@@ -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,16 @@
1
+ dist: trusty
2
+ sudo: false
3
+ language: ruby
4
+ rvm:
5
+ - 2.5
6
+ - 2.4
7
+ - 2.3
8
+ - ruby-head
9
+ before_install:
10
+ - gem install bundler -v 1.16.1
11
+ - npm install -g puppeteer
12
+ - npm install
13
+ - unset _JAVA_OPTIONS
14
+ matrix:
15
+ allow_failures:
16
+ - rvm: ruby-head
@@ -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,4 @@
1
+ source "https://rubygems.org"
2
+ git_source(:github) {|repo| "https://github.com/#{repo}" }
3
+
4
+ gemspec
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,13 @@
1
+ = metanorma-sample: Sample Asciidoctor processor for Metanorma documents
2
+
3
+ ////
4
+ image:https://img.shields.io/gem/v/asciidoctor-metanorma_sample.svg["Gem Version", link="https://rubygems.org/gems/asciidoctor-metanorma_sample"]
5
+ image:https://img.shields.io/travis/riboseinc/asciidoctor-metanorma_sample/master.svg["Build Status", link="https://travis-ci.org/riboseinc/asciidoctor-metanorma_sample"]
6
+ image:https://codeclimate.com/github/riboseinc/asciidoctor-metanorma_sample/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/riboseinc/asciidoctor-metanorma_sample"]
7
+ ////
8
+
9
+ == Functionality
10
+
11
+ This is an example of a https://github.com/riboseinc/metanorma[Metanorma] gem for processing input formats (Asciidoctor) and generating output formats (Word, HTML, PDF).
12
+ It has been created as an exemplar for generating new instances of Metanorma gems, as illustrated in https://github.com/riboseinc/asciidoctor-iso/wiki/Gem-Customisation-Guide
13
+
@@ -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,46 @@
1
+ lib = File.expand_path("../lib", __FILE__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require "metanorma/sample/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "metanorma-sample"
7
+ spec.version = Metanorma::Sample::VERSION
8
+ spec.authors = ["Ribose Inc."]
9
+ spec.email = ["open.source@ribose.com"]
10
+
11
+ spec.summary = "Sample Metanorma Asciidoctor gem."
12
+ spec.description = <<~DESCRIPTION
13
+ Sample Metanorma Asciidoctor gem.
14
+
15
+ This gem is meant to be customised for any downstream use.
16
+ DESCRIPTION
17
+
18
+ spec.homepage = "https://github.com/riboseinc/metanorma-sample"
19
+ spec.license = "BSD-2-Clause"
20
+
21
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
22
+ f.match(%r{^(test|spec|features)/})
23
+ end
24
+ spec.bindir = "exe"
25
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
26
+ spec.require_paths = ["lib"]
27
+
28
+ spec.add_dependency "asciidoctor", "~> 1.5.7"
29
+ spec.add_dependency "htmlentities", "~> 4.3.4"
30
+ spec.add_dependency "ruby-jing"
31
+
32
+ spec.add_dependency "metanorma-standoc", "~> 1.0.0"
33
+ spec.add_dependency "isodoc", "~> 0.9.0"
34
+
35
+ spec.add_development_dependency "bundler", "~> 1.15"
36
+ spec.add_development_dependency "byebug", "~> 9.1"
37
+ spec.add_development_dependency "equivalent-xml", "~> 0.6"
38
+ spec.add_development_dependency "guard", "~> 2.14"
39
+ spec.add_development_dependency "guard-rspec", "~> 4.7"
40
+ spec.add_development_dependency "rake", "~> 12.0"
41
+ spec.add_development_dependency "rspec", "~> 3.6"
42
+ spec.add_development_dependency "rubocop", "= 0.54.0"
43
+ spec.add_development_dependency "simplecov", "~> 0.15"
44
+ spec.add_development_dependency "timecop", "~> 0.9"
45
+ spec.add_development_dependency "metanorma", "~> 0.3.0"
46
+ end
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "asciidoctor/sample"
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,18 @@
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")
18
+
@@ -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,11 @@
1
+ require "asciidoctor" unless defined? Asciidoctor::Converter
2
+ require_relative "asciidoctor/sample/converter"
3
+ require_relative "isodoc/sample/html_convert"
4
+ require_relative "isodoc/sample/pdf_convert"
5
+ require_relative "isodoc/sample/word_convert"
6
+ require_relative "metanorma/sample/version"
7
+
8
+ if defined? Metanorma
9
+ require_relative "metanorma/sample"
10
+ Metanorma::Registry.instance.register(Metanorma::Sample::Processor)
11
+ end
@@ -0,0 +1,7 @@
1
+ module Asciidoctor
2
+ module Sample
3
+
4
+ EXAMPLE_NAMESPACE = "https://open.ribose.com/standards/example"
5
+
6
+ end
7
+ end
@@ -0,0 +1,890 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+ instantiations of this grammar may replace leaf strings
4
+ with more elaborated types; e.g. title (text) replaced with
5
+ title-main, title-intro, title-part; type replaced with
6
+ enum.
7
+
8
+ some renaming at leaf nodes is permissible
9
+
10
+ obligations can change both from optional to mandatory,
11
+ and from mandatory to optional; optional elements may
12
+ be omitted; freely positioned alternatives may be replaced
13
+ with strict ordering
14
+
15
+ DO NOT introduce a namespace here. We do not want a distinct namespace
16
+ for these elements, and a distinct namespace for any grammar inheriting
17
+ these elements; we just want one namespace for any child grammars
18
+ of this.
19
+ -->
20
+ <grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
21
+ <define name="status">
22
+ <element name="status">
23
+ <ref name="LocalizedString"/>
24
+ </element>
25
+ </define>
26
+ <define name="language">
27
+ <element name="language">
28
+ <text/>
29
+ </element>
30
+ </define>
31
+ <define name="script">
32
+ <a:documentation>ISO-639</a:documentation>
33
+ <element name="script">
34
+ <text/>
35
+ </element>
36
+ </define>
37
+ <define name="edition">
38
+ <a:documentation>ISO-15924: Latn</a:documentation>
39
+ <element name="edition">
40
+ <text/>
41
+ </element>
42
+ </define>
43
+ <define name="LocalizedString">
44
+ <optional>
45
+ <!-- multiple languages and scripts possible: comma delimit them if so -->
46
+ <attribute name="language"/>
47
+ </optional>
48
+ <optional>
49
+ <attribute name="script"/>
50
+ </optional>
51
+ <text/>
52
+ </define>
53
+ <!--
54
+ Unlike UML, change type to format: type is overloaded
55
+ Would be need if plain were default value and could omit the attribute
56
+ Added LocalizedStringOrXsAny
57
+ -->
58
+ <define name="FormattedString">
59
+ <optional>
60
+ <!-- attribute format { ( "plain" | "html" | "docbook" | "tei" | "asciidoc" | "markdown" ) }?, -->
61
+ <attribute name="format">
62
+ <choice>
63
+ <value>text/plain</value>
64
+ <value>text/html</value>
65
+ <value>application/docbook+xml</value>
66
+ <value>application/tei+xml</value>
67
+ <value>text/x-asciidoc</value>
68
+ <value>text/markdown</value>
69
+ <value>application/x-isodoc+xml</value>
70
+ <text/>
71
+ </choice>
72
+ </attribute>
73
+ </optional>
74
+ <ref name="LocalizedStringOrXsAny"/>
75
+ </define>
76
+ <define name="LocalizedStringOrXsAny">
77
+ <optional>
78
+ <!-- multiple languages and scripts possible: comma delimit them if so -->
79
+ <attribute name="language"/>
80
+ </optional>
81
+ <optional>
82
+ <attribute name="script"/>
83
+ </optional>
84
+ <oneOrMore>
85
+ <choice>
86
+ <text/>
87
+ <ref name="AnyElement"/>
88
+ </choice>
89
+ </oneOrMore>
90
+ </define>
91
+ <define name="contributor">
92
+ <element name="contributor">
93
+ <zeroOrMore>
94
+ <ref name="role"/>
95
+ </zeroOrMore>
96
+ <ref name="ContributorInfo"/>
97
+ </element>
98
+ </define>
99
+ <define name="role">
100
+ <element name="role">
101
+ <optional>
102
+ <attribute name="type">
103
+ <choice>
104
+ <value>author</value>
105
+ <value>performer</value>
106
+ <value>publisher</value>
107
+ <value>editor</value>
108
+ <value>adapter</value>
109
+ <value>translator</value>
110
+ <value>distributor</value>
111
+ </choice>
112
+ </attribute>
113
+ </optional>
114
+ <zeroOrMore>
115
+ <ref name="roledescription"/>
116
+ </zeroOrMore>
117
+ </element>
118
+ </define>
119
+ <define name="ContributorInfo">
120
+ <choice>
121
+ <ref name="person"/>
122
+ <ref name="organization"/>
123
+ </choice>
124
+ </define>
125
+ <define name="roledescription">
126
+ <element name="description">
127
+ <ref name="FormattedString"/>
128
+ </element>
129
+ </define>
130
+ <define name="person">
131
+ <element name="person">
132
+ <optional>
133
+ <ref name="fullname"/>
134
+ </optional>
135
+ <zeroOrMore>
136
+ <ref name="affiliation"/>
137
+ </zeroOrMore>
138
+ <zeroOrMore>
139
+ <ref name="person-identifier"/>
140
+ </zeroOrMore>
141
+ <zeroOrMore>
142
+ <ref name="contact"/>
143
+ </zeroOrMore>
144
+ <optional>
145
+ <ref name="uri"/>
146
+ </optional>
147
+ </element>
148
+ </define>
149
+ <define name="fullname">
150
+ <element name="name">
151
+ <choice>
152
+ <group>
153
+ <zeroOrMore>
154
+ <ref name="prefix"/>
155
+ </zeroOrMore>
156
+ <zeroOrMore>
157
+ <ref name="forename"/>
158
+ </zeroOrMore>
159
+ <zeroOrMore>
160
+ <ref name="initial"/>
161
+ </zeroOrMore>
162
+ <ref name="surname"/>
163
+ <zeroOrMore>
164
+ <ref name="addition"/>
165
+ </zeroOrMore>
166
+ </group>
167
+ <ref name="completeName"/>
168
+ </choice>
169
+ <zeroOrMore>
170
+ <ref name="biblionote"/>
171
+ </zeroOrMore>
172
+ </element>
173
+ </define>
174
+ <define name="prefix">
175
+ <element name="prefix">
176
+ <ref name="LocalizedString"/>
177
+ </element>
178
+ </define>
179
+ <define name="initial">
180
+ <element name="initial">
181
+ <ref name="LocalizedString"/>
182
+ </element>
183
+ </define>
184
+ <define name="addition">
185
+ <element name="addition">
186
+ <ref name="LocalizedString"/>
187
+ </element>
188
+ </define>
189
+ <define name="surname">
190
+ <element name="surname">
191
+ <ref name="LocalizedString"/>
192
+ </element>
193
+ </define>
194
+ <define name="forename">
195
+ <element name="forename">
196
+ <ref name="LocalizedString"/>
197
+ </element>
198
+ </define>
199
+ <define name="completeName">
200
+ <element name="completename">
201
+ <ref name="LocalizedString"/>
202
+ </element>
203
+ </define>
204
+ <define name="affiliation">
205
+ <element name="affiliation">
206
+ <optional>
207
+ <ref name="affiliationname"/>
208
+ </optional>
209
+ <zeroOrMore>
210
+ <ref name="affiliationdescription"/>
211
+ </zeroOrMore>
212
+ <ref name="organization"/>
213
+ </element>
214
+ </define>
215
+ <define name="affiliationname">
216
+ <element name="name">
217
+ <ref name="LocalizedString"/>
218
+ </element>
219
+ </define>
220
+ <define name="affiliationdescription">
221
+ <element name="description">
222
+ <ref name="FormattedString"/>
223
+ </element>
224
+ </define>
225
+ <define name="organization">
226
+ <element name="organization">
227
+ <ref name="orgname"/>
228
+ <optional>
229
+ <ref name="subdivision"/>
230
+ </optional>
231
+ <optional>
232
+ <ref name="abbreviation"/>
233
+ </optional>
234
+ <optional>
235
+ <ref name="uri"/>
236
+ </optional>
237
+ <zeroOrMore>
238
+ <ref name="org-identifier"/>
239
+ </zeroOrMore>
240
+ <zeroOrMore>
241
+ <ref name="contact"/>
242
+ </zeroOrMore>
243
+ </element>
244
+ </define>
245
+ <define name="orgname">
246
+ <element name="name">
247
+ <ref name="LocalizedString"/>
248
+ </element>
249
+ </define>
250
+ <define name="subdivision">
251
+ <element name="subdivision">
252
+ <ref name="LocalizedString"/>
253
+ </element>
254
+ </define>
255
+ <define name="abbreviation">
256
+ <element name="abbreviation">
257
+ <ref name="LocalizedString"/>
258
+ </element>
259
+ </define>
260
+ <define name="uri">
261
+ <element name="uri">
262
+ <optional>
263
+ <attribute name="type"/>
264
+ </optional>
265
+ <data type="anyURI"/>
266
+ </element>
267
+ </define>
268
+ <!-- TODO may change -->
269
+ <define name="contact">
270
+ <choice>
271
+ <ref name="address"/>
272
+ <ref name="phone"/>
273
+ <ref name="email"/>
274
+ <ref name="uri"/>
275
+ </choice>
276
+ </define>
277
+ <define name="phone">
278
+ <element name="phone">
279
+ <text/>
280
+ </element>
281
+ </define>
282
+ <define name="email">
283
+ <element name="email">
284
+ <text/>
285
+ </element>
286
+ </define>
287
+ <define name="address">
288
+ <element name="address">
289
+ <oneOrMore>
290
+ <!-- iso191606 TODO -->
291
+ <ref name="street"/>
292
+ </oneOrMore>
293
+ <ref name="city"/>
294
+ <optional>
295
+ <ref name="state"/>
296
+ </optional>
297
+ <ref name="country"/>
298
+ <optional>
299
+ <ref name="postcode"/>
300
+ </optional>
301
+ </element>
302
+ </define>
303
+ <define name="street">
304
+ <element name="street">
305
+ <text/>
306
+ </element>
307
+ </define>
308
+ <define name="city">
309
+ <element name="city">
310
+ <text/>
311
+ </element>
312
+ </define>
313
+ <define name="state">
314
+ <element name="state">
315
+ <text/>
316
+ </element>
317
+ </define>
318
+ <define name="country">
319
+ <element name="country">
320
+ <text/>
321
+ </element>
322
+ </define>
323
+ <define name="postcode">
324
+ <element name="postcode">
325
+ <text/>
326
+ </element>
327
+ </define>
328
+ <define name="person-identifier">
329
+ <element name="identifier">
330
+ <attribute name="type">
331
+ <choice>
332
+ <value>isni</value>
333
+ <value>uri</value>
334
+ </choice>
335
+ </attribute>
336
+ <text/>
337
+ </element>
338
+ </define>
339
+ <define name="org-identifier">
340
+ <element name="identifier">
341
+ <attribute name="type">
342
+ <choice>
343
+ <value>orcid</value>
344
+ <value>uri</value>
345
+ </choice>
346
+ </attribute>
347
+ <text/>
348
+ </element>
349
+ </define>
350
+ <define name="citation">
351
+ <element name="citation">
352
+ <ref name="CitationType"/>
353
+ </element>
354
+ </define>
355
+ <define name="CitationType">
356
+ <attribute name="bibitemid">
357
+ <data type="IDREF"/>
358
+ </attribute>
359
+ <zeroOrMore>
360
+ <ref name="locality"/>
361
+ </zeroOrMore>
362
+ <optional>
363
+ <ref name="date"/>
364
+ </optional>
365
+ </define>
366
+ <define name="date">
367
+ <element name="date">
368
+ <choice>
369
+ <data type="gYear"/>
370
+ <data type="date"/>
371
+ </choice>
372
+ </element>
373
+ </define>
374
+ <define name="locality">
375
+ <element name="locality">
376
+ <ref name="BibItemLocality"/>
377
+ </element>
378
+ </define>
379
+ <define name="BibItemLocality">
380
+ <attribute name="type">
381
+ <ref name="LocalityType"/>
382
+ </attribute>
383
+ <ref name="referenceFrom"/>
384
+ <optional>
385
+ <ref name="referenceTo"/>
386
+ </optional>
387
+ </define>
388
+ <define name="LocalityType">
389
+ <data type="string">
390
+ <param name="pattern">section|clause|part|paragraph|chapter|page|whole|table|annex|figure|note|list|example|volume|issue|locality:[a-zA-Z0-9_]+</param>
391
+ </data>
392
+ </define>
393
+ <define name="referenceFrom">
394
+ <element name="referenceFrom">
395
+ <text/>
396
+ </element>
397
+ </define>
398
+ <define name="referenceTo">
399
+ <element name="referenceTo">
400
+ <text/>
401
+ </element>
402
+ </define>
403
+ <!-- unlike UML, has id attribute; that results from including bibitem in a docmodel -->
404
+ <define name="bibitem">
405
+ <element name="bibitem">
406
+ <attribute name="id">
407
+ <data type="ID"/>
408
+ </attribute>
409
+ <ref name="BibliographicItem"/>
410
+ </element>
411
+ </define>
412
+ <define name="bibitem_no_id">
413
+ <element name="bibitem">
414
+ <ref name="BibliographicItem"/>
415
+ </element>
416
+ </define>
417
+ <define name="relaton_collection">
418
+ <element name="relaton-collection">
419
+ <optional>
420
+ <attribute name="type"/>
421
+ </optional>
422
+ <ref name="btitle"/>
423
+ <zeroOrMore>
424
+ <ref name="contributor"/>
425
+ </zeroOrMore>
426
+ <zeroOrMore>
427
+ <ref name="docrelation"/>
428
+ </zeroOrMore>
429
+ </element>
430
+ </define>
431
+ <define name="BibItemType" combine="choice">
432
+ <choice>
433
+ <value>article</value>
434
+ <value>book</value>
435
+ <value>booklet</value>
436
+ <value>conference</value>
437
+ <value>manual</value>
438
+ <value>proceedings</value>
439
+ <value>presentation</value>
440
+ <value>thesis</value>
441
+ <value>techreport</value>
442
+ <value>standard</value>
443
+ <value>unpublished</value>
444
+ <value>map</value>
445
+ <value>electronic resource</value>
446
+ <value>audiovisual</value>
447
+ <value>film</value>
448
+ <value>video</value>
449
+ <value>broadcast</value>
450
+ <value>graphic work</value>
451
+ <value>music</value>
452
+ <value>patent</value>
453
+ <value>inbook</value>
454
+ <value>incollection</value>
455
+ <value>inproceedings</value>
456
+ </choice>
457
+ </define>
458
+ <define name="BibliographicItem">
459
+ <optional>
460
+ <attribute name="type">
461
+ <ref name="BibItemType"/>
462
+ </attribute>
463
+ </optional>
464
+ <optional>
465
+ <ref name="fetched"/>
466
+ </optional>
467
+ <choice>
468
+ <oneOrMore>
469
+ <ref name="btitle"/>
470
+ </oneOrMore>
471
+ <ref name="formattedref"/>
472
+ </choice>
473
+ <zeroOrMore>
474
+ <ref name="bsource"/>
475
+ </zeroOrMore>
476
+ <zeroOrMore>
477
+ <ref name="docidentifier"/>
478
+ </zeroOrMore>
479
+ <optional>
480
+ <ref name="docnumber"/>
481
+ </optional>
482
+ <zeroOrMore>
483
+ <ref name="bdate"/>
484
+ </zeroOrMore>
485
+ <zeroOrMore>
486
+ <ref name="contributor"/>
487
+ </zeroOrMore>
488
+ <optional>
489
+ <ref name="edition"/>
490
+ </optional>
491
+ <zeroOrMore>
492
+ <ref name="biblionote"/>
493
+ </zeroOrMore>
494
+ <zeroOrMore>
495
+ <ref name="language"/>
496
+ </zeroOrMore>
497
+ <zeroOrMore>
498
+ <ref name="script"/>
499
+ </zeroOrMore>
500
+ <optional>
501
+ <ref name="abstract"/>
502
+ </optional>
503
+ <optional>
504
+ <ref name="status"/>
505
+ </optional>
506
+ <optional>
507
+ <ref name="copyright"/>
508
+ </optional>
509
+ <zeroOrMore>
510
+ <ref name="docrelation"/>
511
+ </zeroOrMore>
512
+ <zeroOrMore>
513
+ <ref name="series"/>
514
+ </zeroOrMore>
515
+ <optional>
516
+ <ref name="medium"/>
517
+ </optional>
518
+ <zeroOrMore>
519
+ <ref name="bplace"/>
520
+ </zeroOrMore>
521
+ <zeroOrMore>
522
+ <ref name="extent"/>
523
+ </zeroOrMore>
524
+ <zeroOrMore>
525
+ <ref name="accesslocation"/>
526
+ </zeroOrMore>
527
+ <optional>
528
+ <ref name="bclassification"/>
529
+ </optional>
530
+ <optional>
531
+ <ref name="validity"/>
532
+ </optional>
533
+ </define>
534
+ <define name="btitle">
535
+ <element name="title">
536
+ <ref name="TypedTitleString"/>
537
+ </element>
538
+ </define>
539
+ <define name="bsource">
540
+ <element name="uri">
541
+ <ref name="TypedUri"/>
542
+ </element>
543
+ </define>
544
+ <define name="formattedref">
545
+ <element name="formattedref">
546
+ <ref name="FormattedString"/>
547
+ </element>
548
+ </define>
549
+ <define name="fetched">
550
+ <element name="fetched">
551
+ <choice>
552
+ <data type="dateTime"/>
553
+ <data type="date"/>
554
+ </choice>
555
+ </element>
556
+ </define>
557
+ <define name="validity">
558
+ <element name="validity">
559
+ <optional>
560
+ <ref name="validityBegins"/>
561
+ </optional>
562
+ <optional>
563
+ <ref name="validityEnds"/>
564
+ </optional>
565
+ <optional>
566
+ <ref name="validityRevision"/>
567
+ </optional>
568
+ </element>
569
+ </define>
570
+ <define name="validityBegins">
571
+ <element name="validityBegins">
572
+ <choice>
573
+ <data type="dateTime"/>
574
+ <data type="date"/>
575
+ </choice>
576
+ </element>
577
+ </define>
578
+ <define name="validityEnds">
579
+ <element name="validityEnds">
580
+ <choice>
581
+ <data type="dateTime"/>
582
+ <data type="date"/>
583
+ </choice>
584
+ </element>
585
+ </define>
586
+ <define name="validityRevision">
587
+ <element name="revision">
588
+ <choice>
589
+ <data type="dateTime"/>
590
+ <data type="date"/>
591
+ </choice>
592
+ </element>
593
+ </define>
594
+ <define name="TypedTitleString">
595
+ <optional>
596
+ <attribute name="type">
597
+ <ref name="TitleType"/>
598
+ </attribute>
599
+ </optional>
600
+ <ref name="FormattedString"/>
601
+ </define>
602
+ <define name="TitleType">
603
+ <choice>
604
+ <value>alternative</value>
605
+ <value>original</value>
606
+ <value>unofficial</value>
607
+ <value>subtitle</value>
608
+ <value>main</value>
609
+ </choice>
610
+ </define>
611
+ <define name="TypedUri">
612
+ <optional>
613
+ <attribute name="type"/>
614
+ </optional>
615
+ <data type="anyURI"/>
616
+ </define>
617
+ <define name="DateType">
618
+ <optional>
619
+ <attribute name="text"/>
620
+ </optional>
621
+ <optional>
622
+ <choice>
623
+ <data type="gYear"/>
624
+ <data type="date"/>
625
+ </choice>
626
+ </optional>
627
+ </define>
628
+ <define name="bdate">
629
+ <element name="date">
630
+ <attribute name="type">
631
+ <choice>
632
+ <value>published</value>
633
+ <value>accessed</value>
634
+ <value>created</value>
635
+ <value>implemented</value>
636
+ <value>obsoleted</value>
637
+ <value>confirmed</value>
638
+ <value>updated</value>
639
+ <value>issued</value>
640
+ <value>transmitted</value>
641
+ <value>copied</value>
642
+ <value>unchanged</value>
643
+ <value>circulated</value>
644
+ <text/>
645
+ </choice>
646
+ </attribute>
647
+ <choice>
648
+ <group>
649
+ <element name="from">
650
+ <choice>
651
+ <data type="gYear"/>
652
+ <data type="date"/>
653
+ </choice>
654
+ </element>
655
+ <optional>
656
+ <element name="to">
657
+ <choice>
658
+ <data type="gYear"/>
659
+ <data type="date"/>
660
+ </choice>
661
+ </element>
662
+ </optional>
663
+ </group>
664
+ <element name="on">
665
+ <choice>
666
+ <data type="gYear"/>
667
+ <data type="date"/>
668
+ </choice>
669
+ </element>
670
+ </choice>
671
+ </element>
672
+ </define>
673
+ <define name="docidentifier">
674
+ <element name="docidentifier">
675
+ <optional>
676
+ <attribute name="type"/>
677
+ </optional>
678
+ <text/>
679
+ </element>
680
+ </define>
681
+ <define name="docnumber">
682
+ <element name="docnumber">
683
+ <text/>
684
+ </element>
685
+ </define>
686
+ <define name="bclassification">
687
+ <element name="classification">
688
+ <optional>
689
+ <attribute name="type"/>
690
+ </optional>
691
+ <text/>
692
+ </element>
693
+ </define>
694
+ <define name="bplace">
695
+ <element name="place">
696
+ <text/>
697
+ </element>
698
+ </define>
699
+ <define name="medium">
700
+ <element name="medium">
701
+ <optional>
702
+ <ref name="form"/>
703
+ </optional>
704
+ <optional>
705
+ <ref name="size"/>
706
+ </optional>
707
+ <optional>
708
+ <ref name="scale"/>
709
+ </optional>
710
+ </element>
711
+ </define>
712
+ <define name="form">
713
+ <element name="form">
714
+ <text/>
715
+ </element>
716
+ </define>
717
+ <define name="size">
718
+ <element name="size">
719
+ <text/>
720
+ </element>
721
+ </define>
722
+ <define name="scale">
723
+ <element name="scale">
724
+ <text/>
725
+ </element>
726
+ </define>
727
+ <define name="accesslocation">
728
+ <element name="accesslocation">
729
+ <text/>
730
+ </element>
731
+ </define>
732
+ <define name="extent">
733
+ <element name="extent">
734
+ <ref name="BibItemLocality"/>
735
+ </element>
736
+ </define>
737
+ <define name="series">
738
+ <element name="series">
739
+ <optional>
740
+ <attribute name="type">
741
+ <choice>
742
+ <value>main</value>
743
+ <value>alt</value>
744
+ </choice>
745
+ </attribute>
746
+ </optional>
747
+ <choice>
748
+ <ref name="btitle"/>
749
+ <ref name="formattedref"/>
750
+ </choice>
751
+ <optional>
752
+ <ref name="bplace"/>
753
+ </optional>
754
+ <optional>
755
+ <ref name="seriesorganization"/>
756
+ </optional>
757
+ <optional>
758
+ <ref name="abbreviation"/>
759
+ </optional>
760
+ <optional>
761
+ <ref name="seriesfrom"/>
762
+ </optional>
763
+ <optional>
764
+ <ref name="seriesto"/>
765
+ </optional>
766
+ <optional>
767
+ <ref name="seriesnumber"/>
768
+ </optional>
769
+ <optional>
770
+ <ref name="seriespartnumber"/>
771
+ </optional>
772
+ </element>
773
+ </define>
774
+ <define name="seriesorganization">
775
+ <element name="organization">
776
+ <text/>
777
+ </element>
778
+ </define>
779
+ <define name="seriesfrom">
780
+ <element name="from">
781
+ <choice>
782
+ <data type="dateTime"/>
783
+ <data type="date"/>
784
+ <data type="gYear"/>
785
+ </choice>
786
+ </element>
787
+ </define>
788
+ <define name="seriesto">
789
+ <element name="to">
790
+ <choice>
791
+ <data type="dateTime"/>
792
+ <data type="date"/>
793
+ <data type="gYear"/>
794
+ </choice>
795
+ </element>
796
+ </define>
797
+ <define name="seriesnumber">
798
+ <element name="number">
799
+ <text/>
800
+ </element>
801
+ </define>
802
+ <define name="seriespartnumber">
803
+ <element name="partnumber">
804
+ <text/>
805
+ </element>
806
+ </define>
807
+ <define name="biblionote">
808
+ <element name="note">
809
+ <ref name="FormattedString"/>
810
+ </element>
811
+ </define>
812
+ <define name="abstract">
813
+ <element name="abstract">
814
+ <ref name="FormattedString"/>
815
+ </element>
816
+ </define>
817
+ <define name="copyright">
818
+ <element name="copyright">
819
+ <ref name="from"/>
820
+ <optional>
821
+ <ref name="to"/>
822
+ </optional>
823
+ <ref name="owner"/>
824
+ </element>
825
+ </define>
826
+ <define name="from">
827
+ <element name="from">
828
+ <data type="gYear"/>
829
+ </element>
830
+ </define>
831
+ <define name="to">
832
+ <element name="to">
833
+ <data type="gYear"/>
834
+ </element>
835
+ </define>
836
+ <define name="owner">
837
+ <element name="owner">
838
+ <ref name="ContributorInfo"/>
839
+ </element>
840
+ </define>
841
+ <define name="docrelation">
842
+ <element name="relation">
843
+ <attribute name="type">
844
+ <choice>
845
+ <value>obsoletes</value>
846
+ <value>updates</value>
847
+ <value>updatedBy</value>
848
+ <value>complements</value>
849
+ <value>derivedFrom</value>
850
+ <value>translatedFrom</value>
851
+ <value>adoptedFrom</value>
852
+ <value>equivalent</value>
853
+ <value>identical</value>
854
+ <value>nonequivalent</value>
855
+ <value>includedIn</value>
856
+ <value>includes</value>
857
+ <value>instance</value>
858
+ <value>partOf</value>
859
+ </choice>
860
+ </attribute>
861
+ <element name="bibitem">
862
+ <ref name="BibliographicItem"/>
863
+ </element>
864
+ <zeroOrMore>
865
+ <ref name="locality"/>
866
+ </zeroOrMore>
867
+ </element>
868
+ </define>
869
+ <!--
870
+ Anycontents = mixed {
871
+ https://github.com/relaxng/jing-trang/issues/211
872
+ https://lists.oasis-open.org/archives/office/200808/msg00024.html
873
+ https://lists.oasis-open.org/archives/office/200808/msg00099.html
874
+ For this to work, we will actually strip any attributes in the Anycontents before
875
+ passing it for validation. Horrible I know, but there are no good alternatives
876
+ that also allow us to do grammar inheritance
877
+ (attribute * { text } | Any)*
878
+ Any*
879
+ }
880
+ -->
881
+ <define name="AnyElement">
882
+ <element>
883
+ <anyName/>
884
+ <choice>
885
+ <text/>
886
+ <ref name="AnyElement"/>
887
+ </choice>
888
+ </element>
889
+ </define>
890
+ </grammar>