asciidoctor-metanorma_sample 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +1 -0
  3. data/.travis.yml +13 -0
  4. data/CODE_OF_CONDUCT.md +74 -0
  5. data/Gemfile +8 -0
  6. data/LICENSE +25 -0
  7. data/README.adoc +13 -0
  8. data/Rakefile +6 -0
  9. data/asciidoctor-metanorma_sample.gemspec +46 -0
  10. data/bin/console +14 -0
  11. data/bin/rspec +18 -0
  12. data/bin/setup +8 -0
  13. data/lib/asciidoctor-sample.rb +10 -0
  14. data/lib/asciidoctor/sample.rb +9 -0
  15. data/lib/asciidoctor/sample/biblio.rng +631 -0
  16. data/lib/asciidoctor/sample/converter.rb +207 -0
  17. data/lib/asciidoctor/sample/isodoc.rng +1041 -0
  18. data/lib/asciidoctor/sample/isostandard.rng +1001 -0
  19. data/lib/asciidoctor/sample/pdf.js +31 -0
  20. data/lib/asciidoctor/sample/sample.rng +212 -0
  21. data/lib/asciidoctor/sample/version.rb +5 -0
  22. data/lib/isodoc/sample/html/header.html +184 -0
  23. data/lib/isodoc/sample/html/html_sample_intro.html +8 -0
  24. data/lib/isodoc/sample/html/html_sample_titlepage.html +106 -0
  25. data/lib/isodoc/sample/html/htmlstyle.scss +1028 -0
  26. data/lib/isodoc/sample/html/logo.jpg +0 -0
  27. data/lib/isodoc/sample/html/sample.scss +564 -0
  28. data/lib/isodoc/sample/html/scripts.html +82 -0
  29. data/lib/isodoc/sample/html/word_sample_intro.html +72 -0
  30. data/lib/isodoc/sample/html/word_sample_titlepage.html +75 -0
  31. data/lib/isodoc/sample/html/wordstyle.scss +1096 -0
  32. data/lib/isodoc/sample/html_convert.rb +198 -0
  33. data/lib/isodoc/sample/metadata.rb +85 -0
  34. data/lib/isodoc/sample/pdf_convert.rb +196 -0
  35. data/lib/isodoc/sample/word_convert.rb +155 -0
  36. data/lib/metanorma/sample.rb +7 -0
  37. data/lib/metanorma/sample/processor.rb +51 -0
  38. metadata +307 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 9e9e85e547834a8fa93f979a11cf8627790bbc0d8a173b9a02ffa6f584fe8224
4
+ data.tar.gz: a45dfa2ed8105bb64683500bd8aa8876ccf7b8d913131792f85a16bab6510514
5
+ SHA512:
6
+ metadata.gz: 00d0e33d075b75e4da1e15c195f5acc1b220e8a8045e637fbcc73656945a62b6b12a83531353d9d3dd9bd5c76fb75e66ba353db8f30b2eca09833a9f4084e2d8
7
+ data.tar.gz: b65cee493808e98c5e3fc319e2ca94539bba8bf094163bccb8c814118ed8c9de88dd01282ee3ef56216fe6b4092c8bfe0a5f19b89ddc96def9bf6ed73840218a
@@ -0,0 +1 @@
1
+ .DS_Store
@@ -0,0 +1,13 @@
1
+ dist: trusty
2
+ sudo: false
3
+ language: ruby
4
+ rvm:
5
+ - 2.5
6
+ - 2.4
7
+ - ruby-head
8
+ before_install:
9
+ - gem install bundler -v 1.16.1
10
+ - unset _JAVA_OPTIONS
11
+ matrix:
12
+ allow_failures:
13
+ - 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,8 @@
1
+ source "https://rubygems.org"
2
+ git_source(:github) {|repo| "https://github.com/#{repo}" }
3
+
4
+ gem "isodoc", github: "riboseinc/isodoc"
5
+ gem "asciidoctor-iso", github: "riboseinc/asciidoctor-iso"
6
+ gem "html2doc", github: "riboseinc/html2doc"
7
+
8
+ 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
+ = asciidoctor-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 "asciidoctor/sample/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "asciidoctor-metanorma_sample"
7
+ spec.version = Asciidoctor::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/asciidoctor-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 "asciidoctor-iso", "~> 0.9.3"
33
+ spec.add_dependency "isodoc", "~> 0.8.1"
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.50"
43
+ spec.add_development_dependency "simplecov", "~> 0.15"
44
+ spec.add_development_dependency "timecop", "~> 0.9"
45
+ spec.add_development_dependency "metanorma", "~> 0.2.5"
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,10 @@
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/word_convert"
5
+ require_relative "asciidoctor/sample/version"
6
+
7
+ if defined? Metanorma
8
+ require_relative "metanorma/sample"
9
+ Metanorma::Registry.instance.register(Metanorma::Sample::Processor)
10
+ end
@@ -0,0 +1,9 @@
1
+ require "asciidoctor/sample/version"
2
+
3
+ module Asciidoctor
4
+ module Sample
5
+
6
+ EXAMPLE_NAMESPACE = "https://open.ribose.com/standards/example"
7
+
8
+ end
9
+ end
@@ -0,0 +1,631 @@
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
+ <data type="int"/>
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>edition</value>
106
+ <value>publisher</value>
107
+ <text/>
108
+ </choice>
109
+ </attribute>
110
+ </optional>
111
+ <zeroOrMore>
112
+ <ref name="roledescription"/>
113
+ </zeroOrMore>
114
+ </element>
115
+ </define>
116
+ <define name="ContributorInfo">
117
+ <choice>
118
+ <ref name="person"/>
119
+ <ref name="organization"/>
120
+ </choice>
121
+ </define>
122
+ <define name="roledescription">
123
+ <element name="description">
124
+ <ref name="FormattedString"/>
125
+ </element>
126
+ </define>
127
+ <define name="person">
128
+ <element name="person">
129
+ <optional>
130
+ <ref name="fullname"/>
131
+ </optional>
132
+ <zeroOrMore>
133
+ <ref name="affiliation"/>
134
+ </zeroOrMore>
135
+ <zeroOrMore>
136
+ <ref name="person-identifier"/>
137
+ </zeroOrMore>
138
+ <zeroOrMore>
139
+ <ref name="contact"/>
140
+ </zeroOrMore>
141
+ <optional>
142
+ <ref name="uri"/>
143
+ </optional>
144
+ </element>
145
+ </define>
146
+ <define name="fullname">
147
+ <element name="name">
148
+ <zeroOrMore>
149
+ <ref name="prefix"/>
150
+ </zeroOrMore>
151
+ <zeroOrMore>
152
+ <ref name="forename"/>
153
+ </zeroOrMore>
154
+ <zeroOrMore>
155
+ <ref name="initial"/>
156
+ </zeroOrMore>
157
+ <ref name="surname"/>
158
+ <zeroOrMore>
159
+ <ref name="addition"/>
160
+ </zeroOrMore>
161
+ </element>
162
+ </define>
163
+ <define name="prefix">
164
+ <element name="prefix">
165
+ <ref name="LocalizedString"/>
166
+ </element>
167
+ </define>
168
+ <define name="initial">
169
+ <element name="initial">
170
+ <ref name="LocalizedString"/>
171
+ </element>
172
+ </define>
173
+ <define name="addition">
174
+ <element name="addition">
175
+ <ref name="LocalizedString"/>
176
+ </element>
177
+ </define>
178
+ <define name="surname">
179
+ <element name="surname">
180
+ <ref name="LocalizedString"/>
181
+ </element>
182
+ </define>
183
+ <define name="forename">
184
+ <element name="forename">
185
+ <ref name="LocalizedString"/>
186
+ </element>
187
+ </define>
188
+ <define name="affiliation">
189
+ <element name="affiliation">
190
+ <optional>
191
+ <ref name="affiliationname"/>
192
+ </optional>
193
+ <zeroOrMore>
194
+ <ref name="affiliationdescription"/>
195
+ </zeroOrMore>
196
+ <ref name="organization"/>
197
+ </element>
198
+ </define>
199
+ <define name="affiliationname">
200
+ <element name="name">
201
+ <ref name="LocalizedString"/>
202
+ </element>
203
+ </define>
204
+ <define name="affiliationdescription">
205
+ <element name="description">
206
+ <ref name="FormattedString"/>
207
+ </element>
208
+ </define>
209
+ <define name="organization">
210
+ <element name="organization">
211
+ <ref name="orgname"/>
212
+ <optional>
213
+ <ref name="abbreviation"/>
214
+ </optional>
215
+ <optional>
216
+ <ref name="uri"/>
217
+ </optional>
218
+ <zeroOrMore>
219
+ <ref name="org-identifier"/>
220
+ </zeroOrMore>
221
+ <zeroOrMore>
222
+ <ref name="contact"/>
223
+ </zeroOrMore>
224
+ </element>
225
+ </define>
226
+ <define name="orgname">
227
+ <element name="name">
228
+ <ref name="LocalizedString"/>
229
+ </element>
230
+ </define>
231
+ <define name="abbreviation">
232
+ <element name="abbreviation">
233
+ <ref name="LocalizedString"/>
234
+ </element>
235
+ </define>
236
+ <define name="uri">
237
+ <element name="uri">
238
+ <data type="anyURI"/>
239
+ </element>
240
+ </define>
241
+ <!-- TODO may change -->
242
+ <define name="contact">
243
+ <choice>
244
+ <ref name="address"/>
245
+ <ref name="phone"/>
246
+ <ref name="email"/>
247
+ <ref name="uri"/>
248
+ </choice>
249
+ </define>
250
+ <define name="phone">
251
+ <element name="phone">
252
+ <text/>
253
+ </element>
254
+ </define>
255
+ <define name="email">
256
+ <element name="email">
257
+ <text/>
258
+ </element>
259
+ </define>
260
+ <define name="address">
261
+ <element name="address">
262
+ <oneOrMore>
263
+ <!-- iso191606 TODO -->
264
+ <ref name="street"/>
265
+ </oneOrMore>
266
+ <ref name="city"/>
267
+ <optional>
268
+ <ref name="state"/>
269
+ </optional>
270
+ <ref name="country"/>
271
+ <optional>
272
+ <ref name="postcode"/>
273
+ </optional>
274
+ </element>
275
+ </define>
276
+ <define name="street">
277
+ <element name="street">
278
+ <text/>
279
+ </element>
280
+ </define>
281
+ <define name="city">
282
+ <element name="city">
283
+ <text/>
284
+ </element>
285
+ </define>
286
+ <define name="state">
287
+ <element name="state">
288
+ <text/>
289
+ </element>
290
+ </define>
291
+ <define name="country">
292
+ <element name="country">
293
+ <text/>
294
+ </element>
295
+ </define>
296
+ <define name="postcode">
297
+ <element name="postcode">
298
+ <text/>
299
+ </element>
300
+ </define>
301
+ <define name="person-identifier">
302
+ <element name="identifier">
303
+ <attribute name="type">
304
+ <choice>
305
+ <value>isni</value>
306
+ <value>uri</value>
307
+ </choice>
308
+ </attribute>
309
+ <text/>
310
+ </element>
311
+ </define>
312
+ <define name="org-identifier">
313
+ <element name="identifier">
314
+ <attribute name="type">
315
+ <choice>
316
+ <value>orcid</value>
317
+ <value>uri</value>
318
+ </choice>
319
+ </attribute>
320
+ <text/>
321
+ </element>
322
+ </define>
323
+ <define name="citation">
324
+ <element name="citation">
325
+ <ref name="CitationType"/>
326
+ </element>
327
+ </define>
328
+ <define name="CitationType">
329
+ <attribute name="bibitemid">
330
+ <data type="IDREF"/>
331
+ </attribute>
332
+ <zeroOrMore>
333
+ <ref name="locality"/>
334
+ </zeroOrMore>
335
+ <optional>
336
+ <ref name="date"/>
337
+ </optional>
338
+ </define>
339
+ <define name="date">
340
+ <element name="date">
341
+ <choice>
342
+ <data type="gYear"/>
343
+ <data type="date"/>
344
+ </choice>
345
+ </element>
346
+ </define>
347
+ <define name="locality">
348
+ <element name="locality">
349
+ <!-- attribute type { ( "section" | "clause" | "part" | "paragraph" | "chapter" | "page" | "whole" | "table" | "annex" | "figure" | "note" | "example" | ("locality:", text) ) }, -->
350
+ <attribute name="type">
351
+ <ref name="LocalityType"/>
352
+ </attribute>
353
+ <ref name="referenceFrom"/>
354
+ <optional>
355
+ <ref name="referenceTo"/>
356
+ </optional>
357
+ </element>
358
+ </define>
359
+ <define name="LocalityType">
360
+ <data type="string">
361
+ <param name="pattern">section|clause|part|paragraph|chapter|page|whole|table|annex|figure|note|example|locality:[a-zA-Z0-9_]+</param>
362
+ </data>
363
+ </define>
364
+ <define name="referenceFrom">
365
+ <element name="referenceFrom">
366
+ <text/>
367
+ </element>
368
+ </define>
369
+ <define name="referenceTo">
370
+ <element name="referenceTo">
371
+ <text/>
372
+ </element>
373
+ </define>
374
+ <!-- unlike UML, has id attribute; that results from including bibitem in a docmodel -->
375
+ <define name="bibitem">
376
+ <element name="bibitem">
377
+ <attribute name="id">
378
+ <data type="ID"/>
379
+ </attribute>
380
+ <ref name="BibliographicItem"/>
381
+ </element>
382
+ </define>
383
+ <define name="bibitem_no_id">
384
+ <element name="bibitem">
385
+ <ref name="BibliographicItem"/>
386
+ </element>
387
+ </define>
388
+ <define name="BibItemType" combine="choice">
389
+ <choice>
390
+ <value>article</value>
391
+ <value>book</value>
392
+ <value>booklet</value>
393
+ <value>conference</value>
394
+ <value>manual</value>
395
+ <value>proceedings</value>
396
+ <value>presentation</value>
397
+ <value>thesis</value>
398
+ <value>techreport</value>
399
+ <value>standard</value>
400
+ <value>unpublished</value>
401
+ </choice>
402
+ </define>
403
+ <define name="BibliographicItem">
404
+ <optional>
405
+ <attribute name="type">
406
+ <ref name="BibItemType"/>
407
+ </attribute>
408
+ </optional>
409
+ <choice>
410
+ <oneOrMore>
411
+ <ref name="btitle"/>
412
+ </oneOrMore>
413
+ <ref name="formattedref"/>
414
+ </choice>
415
+ <zeroOrMore>
416
+ <ref name="bsource"/>
417
+ </zeroOrMore>
418
+ <zeroOrMore>
419
+ <ref name="docidentifier"/>
420
+ </zeroOrMore>
421
+ <zeroOrMore>
422
+ <ref name="bdate"/>
423
+ </zeroOrMore>
424
+ <zeroOrMore>
425
+ <ref name="contributor"/>
426
+ </zeroOrMore>
427
+ <optional>
428
+ <ref name="edition"/>
429
+ </optional>
430
+ <zeroOrMore>
431
+ <ref name="biblionote"/>
432
+ </zeroOrMore>
433
+ <zeroOrMore>
434
+ <ref name="language"/>
435
+ </zeroOrMore>
436
+ <zeroOrMore>
437
+ <ref name="script"/>
438
+ </zeroOrMore>
439
+ <optional>
440
+ <ref name="abstract"/>
441
+ </optional>
442
+ <optional>
443
+ <ref name="status"/>
444
+ </optional>
445
+ <zeroOrMore>
446
+ <ref name="copyright"/>
447
+ </zeroOrMore>
448
+ <zeroOrMore>
449
+ <ref name="docrelation"/>
450
+ </zeroOrMore>
451
+ </define>
452
+ <define name="btitle">
453
+ <element name="title">
454
+ <ref name="FormattedString"/>
455
+ </element>
456
+ </define>
457
+ <define name="bsource">
458
+ <element name="source">
459
+ <ref name="TypedUri"/>
460
+ </element>
461
+ </define>
462
+ <define name="formattedref">
463
+ <element name="formattedref">
464
+ <ref name="FormattedString"/>
465
+ </element>
466
+ </define>
467
+ <define name="link">
468
+ <element name="link">
469
+ <ref name="TypedUri"/>
470
+ </element>
471
+ </define>
472
+ <define name="TypedUri">
473
+ <optional>
474
+ <attribute name="type"/>
475
+ </optional>
476
+ <data type="anyURI"/>
477
+ </define>
478
+ <define name="bdate">
479
+ <element name="date">
480
+ <attribute name="type">
481
+ <choice>
482
+ <value>published</value>
483
+ <value>accessed</value>
484
+ <value>created</value>
485
+ <value>implemented</value>
486
+ <value>obsoleted</value>
487
+ <value>confirmed</value>
488
+ <value>updated</value>
489
+ <value>issued</value>
490
+ </choice>
491
+ </attribute>
492
+ <!-- ( ( bfrom, bto? ) | date_on ) -->
493
+ <choice>
494
+ <group>
495
+ <element name="from">
496
+ <choice>
497
+ <data type="gYear"/>
498
+ <data type="date"/>
499
+ </choice>
500
+ </element>
501
+ <optional>
502
+ <element name="to">
503
+ <choice>
504
+ <data type="gYear"/>
505
+ <data type="date"/>
506
+ </choice>
507
+ </element>
508
+ </optional>
509
+ </group>
510
+ <element name="on">
511
+ <choice>
512
+ <data type="gYear"/>
513
+ <data type="date"/>
514
+ </choice>
515
+ </element>
516
+ </choice>
517
+ </element>
518
+ </define>
519
+ <define name="bfrom">
520
+ <element name="from">
521
+ <choice>
522
+ <data type="gYear"/>
523
+ <data type="date"/>
524
+ </choice>
525
+ </element>
526
+ </define>
527
+ <define name="bto">
528
+ <element name="to">
529
+ <choice>
530
+ <data type="gYear"/>
531
+ <data type="date"/>
532
+ </choice>
533
+ </element>
534
+ </define>
535
+ <define name="date_on">
536
+ <element name="on">
537
+ <choice>
538
+ <data type="gYear"/>
539
+ <data type="date"/>
540
+ </choice>
541
+ </element>
542
+ </define>
543
+ <define name="docidentifier">
544
+ <element name="docidentifier">
545
+ <optional>
546
+ <attribute name="type"/>
547
+ </optional>
548
+ <text/>
549
+ </element>
550
+ </define>
551
+ <define name="biblionote">
552
+ <element name="note">
553
+ <ref name="FormattedString"/>
554
+ </element>
555
+ </define>
556
+ <define name="abstract">
557
+ <element name="abstract">
558
+ <ref name="FormattedString"/>
559
+ </element>
560
+ </define>
561
+ <define name="copyright">
562
+ <element name="copyright">
563
+ <ref name="from"/>
564
+ <optional>
565
+ <ref name="to"/>
566
+ </optional>
567
+ <ref name="owner"/>
568
+ </element>
569
+ </define>
570
+ <define name="from">
571
+ <element name="from">
572
+ <data type="gYear"/>
573
+ </element>
574
+ </define>
575
+ <define name="to">
576
+ <element name="to">
577
+ <data type="gYear"/>
578
+ </element>
579
+ </define>
580
+ <define name="owner">
581
+ <element name="owner">
582
+ <ref name="ContributorInfo"/>
583
+ </element>
584
+ </define>
585
+ <define name="docrelation">
586
+ <element name="relation">
587
+ <attribute name="type">
588
+ <choice>
589
+ <value>parent</value>
590
+ <value>child</value>
591
+ <value>obsoletes</value>
592
+ <value>updates</value>
593
+ <value>updatedBy</value>
594
+ <value>complements</value>
595
+ <value>derivedFrom</value>
596
+ <value>adoptedFrom</value>
597
+ <value>equivalent</value>
598
+ <value>identical</value>
599
+ <value>nonequivalent</value>
600
+ </choice>
601
+ </attribute>
602
+ <element name="bibitem">
603
+ <ref name="BibliographicItem"/>
604
+ </element>
605
+ <zeroOrMore>
606
+ <ref name="locality"/>
607
+ </zeroOrMore>
608
+ </element>
609
+ </define>
610
+ <!--
611
+ Anycontents = mixed {
612
+ https://github.com/relaxng/jing-trang/issues/211
613
+ https://lists.oasis-open.org/archives/office/200808/msg00024.html
614
+ https://lists.oasis-open.org/archives/office/200808/msg00099.html
615
+ For this to work, we will actually strip any attributes in the Anycontents before
616
+ passing it for validation. Horrible I know, but there are no good alternatives
617
+ that also allow us to do grammar inheritance
618
+ (attribute * { text } | Any)*
619
+ Any*
620
+ }
621
+ -->
622
+ <define name="AnyElement">
623
+ <element>
624
+ <anyName/>
625
+ <choice>
626
+ <text/>
627
+ <ref name="AnyElement"/>
628
+ </choice>
629
+ </element>
630
+ </define>
631
+ </grammar>