metanorma-itu 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. checksums.yaml +7 -0
  2. data/.hound.yml +3 -0
  3. data/.rubocop.yml +10 -0
  4. data/.travis.yml +17 -0
  5. data/CODE_OF_CONDUCT.md +74 -0
  6. data/Gemfile +4 -0
  7. data/LICENSE +25 -0
  8. data/README.adoc +72 -0
  9. data/Rakefile +6 -0
  10. data/appveyor.yml +29 -0
  11. data/lib/asciidoctor/itu.rb +7 -0
  12. data/lib/asciidoctor/itu/biblio.rng +949 -0
  13. data/lib/asciidoctor/itu/converter.rb +164 -0
  14. data/lib/asciidoctor/itu/front.rb +182 -0
  15. data/lib/asciidoctor/itu/isodoc.rng +1132 -0
  16. data/lib/asciidoctor/itu/isostandard.rng +801 -0
  17. data/lib/asciidoctor/itu/itu.rng +223 -0
  18. data/lib/asciidoctor/itu/reqt.rng +162 -0
  19. data/lib/asciidoctor/itu/validate.rb +55 -0
  20. data/lib/isodoc/itu.rb +11 -0
  21. data/lib/isodoc/itu/base_convert.rb +210 -0
  22. data/lib/isodoc/itu/html/Logo_ITU.jpg +0 -0
  23. data/lib/isodoc/itu/html/header.html +162 -0
  24. data/lib/isodoc/itu/html/html_itu_intro.html +42 -0
  25. data/lib/isodoc/itu/html/html_itu_titlepage.html +144 -0
  26. data/lib/isodoc/itu/html/htmlstyle.scss +1167 -0
  27. data/lib/isodoc/itu/html/itu-document-comb.png +0 -0
  28. data/lib/isodoc/itu/html/itu.scss +707 -0
  29. data/lib/isodoc/itu/html/logo.png +0 -0
  30. data/lib/isodoc/itu/html/scripts.html +82 -0
  31. data/lib/isodoc/itu/html/scripts.pdf.html +70 -0
  32. data/lib/isodoc/itu/html/word_itu_intro.html +246 -0
  33. data/lib/isodoc/itu/html/word_itu_titlepage.html +283 -0
  34. data/lib/isodoc/itu/html/wordstyle.scss +1237 -0
  35. data/lib/isodoc/itu/html_convert.rb +72 -0
  36. data/lib/isodoc/itu/i18n-en.yaml +2 -0
  37. data/lib/isodoc/itu/metadata.rb +100 -0
  38. data/lib/isodoc/itu/pdf_convert.rb +70 -0
  39. data/lib/isodoc/itu/word_convert.rb +115 -0
  40. data/lib/metanorma-itu.rb +8 -0
  41. data/lib/metanorma/itu.rb +11 -0
  42. data/lib/metanorma/itu/processor.rb +43 -0
  43. data/lib/metanorma/itu/version.rb +5 -0
  44. data/metanorma-itu.gemspec +44 -0
  45. metadata +327 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 5929f61643c8dbafa66db621a66293f54bd32f6d49230c9f5bc7b2631a9d9fe0
4
+ data.tar.gz: e1f97d4f79ab995555c6b5aac7db3118aa96908f8722a4b1982875fa5f5f98d5
5
+ SHA512:
6
+ metadata.gz: 9680e50d0d3d1b447a9a647cc94a01cd1f1553f6b5f2a0edc1657781f4947c80a037818bf9046242109b282e0146d4dacd9c14f6bcde93edfdd1d96cfa7518ca
7
+ data.tar.gz: 6a353703d1015385bcb8741e17df7a42d622ca65a0a340cd7242a442a900f2a904a8f27d6f0c37aeed2b8d50116d96d00f275d0d97b7c24cbb2b5480e076fc19
data/.hound.yml ADDED
@@ -0,0 +1,3 @@
1
+ ruby:
2
+ Enabled: true
3
+ config_file: .rubocop.yml
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.3
9
+ Rails:
10
+ Enabled: true
data/.travis.yml ADDED
@@ -0,0 +1,17 @@
1
+ language: ruby
2
+ cache: bundler
3
+ os:
4
+ - linux
5
+ - osx
6
+ rvm:
7
+ - 2.5
8
+ - 2.4
9
+ - 2.3
10
+ - ruby-head
11
+ before_install:
12
+ - gem install bundler -v 2.0.1
13
+ - bundle install
14
+ - npm install -g puppeteer
15
+ matrix:
16
+ allow_failures:
17
+ - 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.
data/README.adoc ADDED
@@ -0,0 +1,72 @@
1
+ = metanorma-itu: Asciidoctor processor for ITU
2
+
3
+ image:https://img.shields.io/gem/v/metanorma-itu.svg["Gem Version", link="https://rubygems.org/gems/metanorma-itu"]
4
+ image:https://img.shields.io/travis/metanorma/metanorma-itu/master.svg["Build Status", link="https://travis-ci.org/metanorma/metanorma-itu"]
5
+ image:https://codeclimate.com/github/metanorma/metanorma-itu/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/metanorma/metanorma-itu"]
6
+ image:https://ci.appveyor.com/api/projects/status/lo05dblngrgx2tlq?svg=true["Appveyor Build Status", link="https://ci.appveyor.com/project/ribose/metanorma-itu"]
7
+
8
+ WARNING: This gem is still under development.
9
+
10
+ == Functionality
11
+
12
+ This gem processes http://asciidoctor.org/[Asciidoctor] documents following
13
+ a template for generating ITU documents.
14
+
15
+ The gem currently inherits from the https://github.com/metanorma/metanorma-standoc
16
+ gem, and aligns closely to it. Refer to the ISO gem documentation
17
+ for guidance, including https://github.com/metanorma/metanorma-iso/wiki/Guidance-for-authoring
18
+
19
+ The following outputs are generated.
20
+
21
+ * an XML representation of the document, intended as a document model for ITU documents.
22
+ * The XML representation is processed in turn to generate the following outputs
23
+ as end deliverable ITU documents.
24
+ ** HTML
25
+ ** http://asciimath.org[AsciiMathML] is to be used for mathematical formatting.
26
+ The gem uses the https://github.com/asciidoctor/asciimath[Ruby AsciiMath parser],
27
+ which is syntactically stricter than the common MathJax processor;
28
+ if you do not get expected results, try bracketing terms your in AsciiMathML
29
+ expressions.
30
+
31
+ == Usage
32
+
33
+ The preferred way to invoke this gem is via the `metanorma` script:
34
+
35
+ [source,console]
36
+ ----
37
+ $ metanorma --type itu a.adoc # output HTML
38
+ $ metanorma --type itu --extensions html a.adoc # output just HTML
39
+ $ metanorma --type itu --extensions xml a.adoc # output RSD XML
40
+ ----
41
+
42
+ The gem translates the document into Metanorma XML format, and then
43
+ validates its output against the Metanorma XML document model; errors are
44
+ reported to console against the XML, and are intended for users to
45
+ check that they have provided all necessary components of the
46
+ document.
47
+
48
+ The gem then converts the XML into HTML.
49
+
50
+ === Installation
51
+
52
+ If you are using a Mac, the https://github.com/metanorma/metanorma-macos-setup
53
+ repository has instructions on setting up your machine to run Metanorma
54
+ scripts such as this one. You need only run the following in a Terminal console:
55
+
56
+ [source,console]
57
+ ----
58
+ $ bash <(curl -s https://raw.githubusercontent.com/metanorma/metanorma-macos-setup/master/metanorma-setup)
59
+ $ gem install metanorma-acme
60
+ $ gem install metanorma-cli
61
+ ----
62
+
63
+ == Documentation
64
+
65
+ See https://www.metanorma.com/author/itu/[Write ITU-T documents with Metanorma].
66
+
67
+ == Examples
68
+
69
+ * link:spec/examples/rfc6350.adoc[] is an Metanorma Asciidoctor version of https://tools.ietf.org/html/rfc6350[RFC 6350].
70
+ * link:spec/examples/rfc6350.html[] is an HTML file generated from the Asciidoctor.
71
+ * link:spec/examples/rfc6350.doc[] is a Word document generated from the Asciidoctor.
72
+
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/appveyor.yml ADDED
@@ -0,0 +1,29 @@
1
+ version: '{build}'
2
+
3
+ environment:
4
+ matrix:
5
+ - RUBY_VERSION: 25
6
+ - RUBY_VERSION: 24
7
+ - RUBY_VERSION: _trunk
8
+
9
+ matrix:
10
+ allow_failures:
11
+ - RUBY_VERSION: _trunk
12
+
13
+ install:
14
+ - ps: . { iwr -useb https://raw.githubusercontent.com/metanorma/metanorma-build-scripts/master/appveyor.ps1 } | iex
15
+ - refreshenv
16
+
17
+ build_script:
18
+ - set PATH=C:\Ruby%RUBY_VERSION%\bin;%PATH%
19
+ - bundle update
20
+ - bundle install
21
+
22
+ before_test:
23
+ - ruby -v
24
+ - gem -v
25
+ - bundle -v
26
+
27
+ test_script:
28
+ - bundle exec rake
29
+
@@ -0,0 +1,7 @@
1
+ require "asciidoctor/itu/converter"
2
+
3
+ module Asciidoctor
4
+ module ITU
5
+
6
+ end
7
+ end
@@ -0,0 +1,949 @@
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
+ <!--
22
+ https://www.myintervals.com/blog/2009/05/20/iso-8601-date-validation-that-doesnt-suck/
23
+ iso8601date = xsd:string { pattern = "([\+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24\:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d([\.,]\d+)?)?([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?" }
24
+ Somewhat dumbed down for XSD regex:
25
+ -->
26
+ <define name="ISO8601DateTime">
27
+ <data type="string">
28
+ <param name="pattern">([\+\-]?\d{4})((-?)((0[1-9]|1[0-2])((-?)([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([\.,]\d+)?)?((:?)[0-5]\d([.,]\d+)?)?([zZ]|([\+\-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?</param>
29
+ </data>
30
+ </define>
31
+ <define name="ISO8601Date">
32
+ <data type="string">
33
+ <param name="pattern">([\+\-]?\d{4})((-?)((0[1-9]|1[0-2])((-?)([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6]))))?</param>
34
+ </data>
35
+ </define>
36
+ <define name="status">
37
+ <element name="status">
38
+ <ref name="stage"/>
39
+ <optional>
40
+ <ref name="substage"/>
41
+ </optional>
42
+ <optional>
43
+ <ref name="iteration"/>
44
+ </optional>
45
+ </element>
46
+ </define>
47
+ <define name="stage">
48
+ <element name="stage">
49
+ <text/>
50
+ </element>
51
+ </define>
52
+ <define name="substage">
53
+ <element name="substage">
54
+ <text/>
55
+ </element>
56
+ </define>
57
+ <define name="iteration">
58
+ <element name="iteration">
59
+ <text/>
60
+ </element>
61
+ </define>
62
+ <define name="language">
63
+ <element name="language">
64
+ <text/>
65
+ </element>
66
+ </define>
67
+ <define name="script">
68
+ <a:documentation>ISO-639</a:documentation>
69
+ <element name="script">
70
+ <text/>
71
+ </element>
72
+ </define>
73
+ <define name="edition">
74
+ <a:documentation>ISO-15924: Latn</a:documentation>
75
+ <element name="edition">
76
+ <text/>
77
+ </element>
78
+ </define>
79
+ <define name="LocalizedString">
80
+ <optional>
81
+ <!-- multiple languages and scripts possible: comma delimit them if so -->
82
+ <attribute name="language"/>
83
+ </optional>
84
+ <optional>
85
+ <attribute name="script"/>
86
+ </optional>
87
+ <text/>
88
+ </define>
89
+ <!--
90
+ Unlike UML, change type to format: type is overloaded
91
+ Would be need if plain were default value and could omit the attribute
92
+ Added LocalizedStringOrXsAny
93
+ -->
94
+ <define name="FormattedString">
95
+ <optional>
96
+ <!-- attribute format { ( "plain" | "html" | "docbook" | "tei" | "asciidoc" | "markdown" ) }?, -->
97
+ <attribute name="format">
98
+ <choice>
99
+ <value>text/plain</value>
100
+ <value>text/html</value>
101
+ <value>application/docbook+xml</value>
102
+ <value>application/tei+xml</value>
103
+ <value>text/x-asciidoc</value>
104
+ <value>text/markdown</value>
105
+ <value>application/x-isodoc+xml</value>
106
+ <text/>
107
+ </choice>
108
+ </attribute>
109
+ </optional>
110
+ <ref name="LocalizedStringOrXsAny"/>
111
+ </define>
112
+ <define name="LocalizedStringOrXsAny">
113
+ <optional>
114
+ <!-- multiple languages and scripts possible: comma delimit them if so -->
115
+ <attribute name="language"/>
116
+ </optional>
117
+ <optional>
118
+ <attribute name="script"/>
119
+ </optional>
120
+ <oneOrMore>
121
+ <choice>
122
+ <text/>
123
+ <ref name="AnyElement"/>
124
+ </choice>
125
+ </oneOrMore>
126
+ </define>
127
+ <define name="contributor">
128
+ <element name="contributor">
129
+ <zeroOrMore>
130
+ <ref name="role"/>
131
+ </zeroOrMore>
132
+ <ref name="ContributorInfo"/>
133
+ </element>
134
+ </define>
135
+ <define name="role">
136
+ <element name="role">
137
+ <optional>
138
+ <attribute name="type">
139
+ <choice>
140
+ <value>author</value>
141
+ <value>performer</value>
142
+ <value>publisher</value>
143
+ <value>editor</value>
144
+ <value>adapter</value>
145
+ <value>translator</value>
146
+ <value>distributor</value>
147
+ </choice>
148
+ </attribute>
149
+ </optional>
150
+ <zeroOrMore>
151
+ <ref name="roledescription"/>
152
+ </zeroOrMore>
153
+ </element>
154
+ </define>
155
+ <define name="ContributorInfo">
156
+ <choice>
157
+ <ref name="person"/>
158
+ <ref name="organization"/>
159
+ </choice>
160
+ </define>
161
+ <define name="roledescription">
162
+ <element name="description">
163
+ <ref name="FormattedString"/>
164
+ </element>
165
+ </define>
166
+ <define name="person">
167
+ <element name="person">
168
+ <optional>
169
+ <ref name="fullname"/>
170
+ </optional>
171
+ <zeroOrMore>
172
+ <ref name="affiliation"/>
173
+ </zeroOrMore>
174
+ <zeroOrMore>
175
+ <ref name="person-identifier"/>
176
+ </zeroOrMore>
177
+ <zeroOrMore>
178
+ <ref name="contact"/>
179
+ </zeroOrMore>
180
+ <zeroOrMore>
181
+ <ref name="uri"/>
182
+ </zeroOrMore>
183
+ </element>
184
+ </define>
185
+ <define name="fullname">
186
+ <element name="name">
187
+ <choice>
188
+ <group>
189
+ <zeroOrMore>
190
+ <ref name="prefix"/>
191
+ </zeroOrMore>
192
+ <zeroOrMore>
193
+ <ref name="forename"/>
194
+ </zeroOrMore>
195
+ <zeroOrMore>
196
+ <ref name="initial"/>
197
+ </zeroOrMore>
198
+ <ref name="surname"/>
199
+ <zeroOrMore>
200
+ <ref name="addition"/>
201
+ </zeroOrMore>
202
+ </group>
203
+ <ref name="completeName"/>
204
+ </choice>
205
+ <zeroOrMore>
206
+ <ref name="biblionote"/>
207
+ </zeroOrMore>
208
+ </element>
209
+ </define>
210
+ <define name="prefix">
211
+ <element name="prefix">
212
+ <ref name="LocalizedString"/>
213
+ </element>
214
+ </define>
215
+ <define name="initial">
216
+ <element name="initial">
217
+ <ref name="LocalizedString"/>
218
+ </element>
219
+ </define>
220
+ <define name="addition">
221
+ <element name="addition">
222
+ <ref name="LocalizedString"/>
223
+ </element>
224
+ </define>
225
+ <define name="surname">
226
+ <element name="surname">
227
+ <ref name="LocalizedString"/>
228
+ </element>
229
+ </define>
230
+ <define name="forename">
231
+ <element name="forename">
232
+ <ref name="LocalizedString"/>
233
+ </element>
234
+ </define>
235
+ <define name="completeName">
236
+ <element name="completename">
237
+ <ref name="LocalizedString"/>
238
+ </element>
239
+ </define>
240
+ <define name="affiliation">
241
+ <element name="affiliation">
242
+ <optional>
243
+ <ref name="affiliationname"/>
244
+ </optional>
245
+ <zeroOrMore>
246
+ <ref name="affiliationdescription"/>
247
+ </zeroOrMore>
248
+ <ref name="organization"/>
249
+ </element>
250
+ </define>
251
+ <define name="affiliationname">
252
+ <element name="name">
253
+ <ref name="LocalizedString"/>
254
+ </element>
255
+ </define>
256
+ <define name="affiliationdescription">
257
+ <element name="description">
258
+ <ref name="FormattedString"/>
259
+ </element>
260
+ </define>
261
+ <define name="organization">
262
+ <element name="organization">
263
+ <ref name="orgname"/>
264
+ <optional>
265
+ <ref name="subdivision"/>
266
+ </optional>
267
+ <optional>
268
+ <ref name="abbreviation"/>
269
+ </optional>
270
+ <zeroOrMore>
271
+ <ref name="uri"/>
272
+ </zeroOrMore>
273
+ <zeroOrMore>
274
+ <ref name="org-identifier"/>
275
+ </zeroOrMore>
276
+ <zeroOrMore>
277
+ <ref name="contact"/>
278
+ </zeroOrMore>
279
+ </element>
280
+ </define>
281
+ <define name="orgname">
282
+ <element name="name">
283
+ <ref name="LocalizedString"/>
284
+ </element>
285
+ </define>
286
+ <define name="subdivision">
287
+ <element name="subdivision">
288
+ <ref name="LocalizedString"/>
289
+ </element>
290
+ </define>
291
+ <define name="abbreviation">
292
+ <element name="abbreviation">
293
+ <ref name="LocalizedString"/>
294
+ </element>
295
+ </define>
296
+ <define name="uri">
297
+ <element name="uri">
298
+ <optional>
299
+ <attribute name="type"/>
300
+ </optional>
301
+ <data type="anyURI"/>
302
+ </element>
303
+ </define>
304
+ <!-- TODO may change -->
305
+ <define name="contact">
306
+ <choice>
307
+ <ref name="address"/>
308
+ <ref name="phone"/>
309
+ <ref name="email"/>
310
+ <ref name="uri"/>
311
+ </choice>
312
+ </define>
313
+ <define name="phone">
314
+ <element name="phone">
315
+ <text/>
316
+ </element>
317
+ </define>
318
+ <define name="email">
319
+ <element name="email">
320
+ <text/>
321
+ </element>
322
+ </define>
323
+ <define name="address">
324
+ <element name="address">
325
+ <choice>
326
+ <!-- iso191606 TODO -->
327
+ <group>
328
+ <oneOrMore>
329
+ <ref name="street"/>
330
+ </oneOrMore>
331
+ <ref name="city"/>
332
+ <optional>
333
+ <ref name="state"/>
334
+ </optional>
335
+ <ref name="country"/>
336
+ <optional>
337
+ <ref name="postcode"/>
338
+ </optional>
339
+ </group>
340
+ <ref name="formattedAddress"/>
341
+ </choice>
342
+ </element>
343
+ </define>
344
+ <define name="street">
345
+ <element name="street">
346
+ <text/>
347
+ </element>
348
+ </define>
349
+ <define name="city">
350
+ <element name="city">
351
+ <text/>
352
+ </element>
353
+ </define>
354
+ <define name="state">
355
+ <element name="state">
356
+ <text/>
357
+ </element>
358
+ </define>
359
+ <define name="country">
360
+ <element name="country">
361
+ <text/>
362
+ </element>
363
+ </define>
364
+ <define name="postcode">
365
+ <element name="postcode">
366
+ <text/>
367
+ </element>
368
+ </define>
369
+ <define name="formattedAddress">
370
+ <element name="formattedAddress">
371
+ <text/>
372
+ </element>
373
+ </define>
374
+ <define name="person-identifier">
375
+ <element name="identifier">
376
+ <attribute name="type">
377
+ <choice>
378
+ <value>isni</value>
379
+ <value>uri</value>
380
+ </choice>
381
+ </attribute>
382
+ <text/>
383
+ </element>
384
+ </define>
385
+ <define name="org-identifier">
386
+ <element name="identifier">
387
+ <attribute name="type">
388
+ <choice>
389
+ <value>orcid</value>
390
+ <value>uri</value>
391
+ </choice>
392
+ </attribute>
393
+ <text/>
394
+ </element>
395
+ </define>
396
+ <define name="citation">
397
+ <element name="citation">
398
+ <ref name="CitationType"/>
399
+ </element>
400
+ </define>
401
+ <define name="CitationType">
402
+ <attribute name="bibitemid">
403
+ <data type="IDREF"/>
404
+ </attribute>
405
+ <zeroOrMore>
406
+ <ref name="locality"/>
407
+ </zeroOrMore>
408
+ <optional>
409
+ <ref name="date"/>
410
+ </optional>
411
+ </define>
412
+ <define name="date">
413
+ <element name="date">
414
+ <ref name="ISO8601Date"/>
415
+ </element>
416
+ </define>
417
+ <define name="locality">
418
+ <element name="locality">
419
+ <ref name="BibItemLocality"/>
420
+ </element>
421
+ </define>
422
+ <define name="BibItemLocality">
423
+ <attribute name="type">
424
+ <ref name="LocalityType"/>
425
+ </attribute>
426
+ <ref name="referenceFrom"/>
427
+ <optional>
428
+ <ref name="referenceTo"/>
429
+ </optional>
430
+ </define>
431
+ <define name="LocalityType">
432
+ <data type="string">
433
+ <param name="pattern">section|clause|part|paragraph|chapter|page|whole|table|annex|figure|note|list|example|volume|issue|locality:[a-zA-Z0-9_]+</param>
434
+ </data>
435
+ </define>
436
+ <define name="referenceFrom">
437
+ <element name="referenceFrom">
438
+ <text/>
439
+ </element>
440
+ </define>
441
+ <define name="referenceTo">
442
+ <element name="referenceTo">
443
+ <text/>
444
+ </element>
445
+ </define>
446
+ <!-- unlike UML, has id attribute; that results from including bibitem in a docmodel -->
447
+ <define name="bibitem">
448
+ <element name="bibitem">
449
+ <attribute name="id">
450
+ <data type="ID"/>
451
+ </attribute>
452
+ <ref name="BibliographicItem"/>
453
+ </element>
454
+ </define>
455
+ <define name="bibitem_no_id">
456
+ <element name="bibitem">
457
+ <ref name="BibliographicItem"/>
458
+ </element>
459
+ </define>
460
+ <define name="relaton_collection">
461
+ <element name="relaton-collection">
462
+ <optional>
463
+ <attribute name="type"/>
464
+ </optional>
465
+ <ref name="btitle"/>
466
+ <zeroOrMore>
467
+ <ref name="contributor"/>
468
+ </zeroOrMore>
469
+ <zeroOrMore>
470
+ <ref name="docrelation"/>
471
+ </zeroOrMore>
472
+ </element>
473
+ </define>
474
+ <define name="BibItemType" combine="choice">
475
+ <choice>
476
+ <value>article</value>
477
+ <value>book</value>
478
+ <value>booklet</value>
479
+ <value>conference</value>
480
+ <value>manual</value>
481
+ <value>proceedings</value>
482
+ <value>presentation</value>
483
+ <value>thesis</value>
484
+ <value>techreport</value>
485
+ <value>standard</value>
486
+ <value>unpublished</value>
487
+ <value>map</value>
488
+ <value>electronic resource</value>
489
+ <value>audiovisual</value>
490
+ <value>film</value>
491
+ <value>video</value>
492
+ <value>broadcast</value>
493
+ <value>graphic_work</value>
494
+ <value>music</value>
495
+ <value>patent</value>
496
+ <value>inbook</value>
497
+ <value>incollection</value>
498
+ <value>inproceedings</value>
499
+ <value>journal</value>
500
+ </choice>
501
+ </define>
502
+ <define name="BibliographicItem">
503
+ <optional>
504
+ <attribute name="type">
505
+ <ref name="BibItemType"/>
506
+ </attribute>
507
+ </optional>
508
+ <optional>
509
+ <ref name="fetched"/>
510
+ </optional>
511
+ <choice>
512
+ <oneOrMore>
513
+ <ref name="btitle"/>
514
+ </oneOrMore>
515
+ <ref name="formattedref"/>
516
+ </choice>
517
+ <zeroOrMore>
518
+ <ref name="bsource"/>
519
+ </zeroOrMore>
520
+ <zeroOrMore>
521
+ <ref name="docidentifier"/>
522
+ </zeroOrMore>
523
+ <optional>
524
+ <ref name="docnumber"/>
525
+ </optional>
526
+ <zeroOrMore>
527
+ <ref name="bdate"/>
528
+ </zeroOrMore>
529
+ <zeroOrMore>
530
+ <ref name="contributor"/>
531
+ </zeroOrMore>
532
+ <optional>
533
+ <ref name="edition"/>
534
+ </optional>
535
+ <optional>
536
+ <ref name="version"/>
537
+ </optional>
538
+ <zeroOrMore>
539
+ <ref name="biblionote"/>
540
+ </zeroOrMore>
541
+ <zeroOrMore>
542
+ <ref name="language"/>
543
+ </zeroOrMore>
544
+ <zeroOrMore>
545
+ <ref name="script"/>
546
+ </zeroOrMore>
547
+ <zeroOrMore>
548
+ <ref name="abstract"/>
549
+ </zeroOrMore>
550
+ <optional>
551
+ <ref name="status"/>
552
+ </optional>
553
+ <optional>
554
+ <ref name="copyright"/>
555
+ </optional>
556
+ <zeroOrMore>
557
+ <ref name="docrelation"/>
558
+ </zeroOrMore>
559
+ <zeroOrMore>
560
+ <ref name="series"/>
561
+ </zeroOrMore>
562
+ <optional>
563
+ <ref name="medium"/>
564
+ </optional>
565
+ <zeroOrMore>
566
+ <ref name="bplace"/>
567
+ </zeroOrMore>
568
+ <zeroOrMore>
569
+ <ref name="extent"/>
570
+ </zeroOrMore>
571
+ <zeroOrMore>
572
+ <ref name="accesslocation"/>
573
+ </zeroOrMore>
574
+ <optional>
575
+ <ref name="bclassification"/>
576
+ </optional>
577
+ <optional>
578
+ <ref name="validity"/>
579
+ </optional>
580
+ </define>
581
+ <define name="btitle">
582
+ <element name="title">
583
+ <ref name="TypedTitleString"/>
584
+ </element>
585
+ </define>
586
+ <define name="bsource">
587
+ <element name="uri">
588
+ <ref name="TypedUri"/>
589
+ </element>
590
+ </define>
591
+ <define name="formattedref">
592
+ <element name="formattedref">
593
+ <ref name="FormattedString"/>
594
+ </element>
595
+ </define>
596
+ <define name="fetched">
597
+ <element name="fetched">
598
+ <ref name="ISO8601DateTime"/>
599
+ </element>
600
+ </define>
601
+ <define name="validity">
602
+ <element name="validity">
603
+ <optional>
604
+ <ref name="validityBegins"/>
605
+ </optional>
606
+ <optional>
607
+ <ref name="validityEnds"/>
608
+ </optional>
609
+ <optional>
610
+ <ref name="validityRevision"/>
611
+ </optional>
612
+ </element>
613
+ </define>
614
+ <define name="validityBegins">
615
+ <element name="validityBegins">
616
+ <ref name="ISO8601DateTime"/>
617
+ </element>
618
+ </define>
619
+ <define name="validityEnds">
620
+ <element name="validityEnds">
621
+ <ref name="ISO8601DateTime"/>
622
+ </element>
623
+ </define>
624
+ <define name="validityRevision">
625
+ <element name="revision">
626
+ <ref name="ISO8601DateTime"/>
627
+ </element>
628
+ </define>
629
+ <define name="TypedTitleString">
630
+ <optional>
631
+ <attribute name="type">
632
+ <ref name="TitleType"/>
633
+ </attribute>
634
+ </optional>
635
+ <ref name="FormattedString"/>
636
+ </define>
637
+ <define name="TitleType">
638
+ <choice>
639
+ <value>alternative</value>
640
+ <value>original</value>
641
+ <value>unofficial</value>
642
+ <value>subtitle</value>
643
+ <value>main</value>
644
+ </choice>
645
+ </define>
646
+ <define name="TypedUri">
647
+ <optional>
648
+ <attribute name="type"/>
649
+ </optional>
650
+ <data type="anyURI"/>
651
+ </define>
652
+ <define name="DateType">
653
+ <optional>
654
+ <attribute name="text"/>
655
+ </optional>
656
+ <optional>
657
+ <ref name="ISO8601Date"/>
658
+ </optional>
659
+ </define>
660
+ <define name="BibliographicDateType">
661
+ <choice>
662
+ <value>published</value>
663
+ <value>accessed</value>
664
+ <value>created</value>
665
+ <value>implemented</value>
666
+ <value>obsoleted</value>
667
+ <value>confirmed</value>
668
+ <value>updated</value>
669
+ <value>issued</value>
670
+ <value>transmitted</value>
671
+ <value>copied</value>
672
+ <value>unchanged</value>
673
+ <value>circulated</value>
674
+ </choice>
675
+ </define>
676
+ <define name="bdate">
677
+ <element name="date">
678
+ <attribute name="type">
679
+ <choice>
680
+ <ref name="BibliographicDateType"/>
681
+ <text/>
682
+ </choice>
683
+ </attribute>
684
+ <choice>
685
+ <group>
686
+ <element name="from">
687
+ <ref name="ISO8601Date"/>
688
+ </element>
689
+ <optional>
690
+ <element name="to">
691
+ <ref name="ISO8601Date"/>
692
+ </element>
693
+ </optional>
694
+ </group>
695
+ <element name="on">
696
+ <ref name="ISO8601Date"/>
697
+ </element>
698
+ </choice>
699
+ </element>
700
+ </define>
701
+ <define name="docidentifier">
702
+ <element name="docidentifier">
703
+ <optional>
704
+ <attribute name="type"/>
705
+ </optional>
706
+ <text/>
707
+ </element>
708
+ </define>
709
+ <define name="docnumber">
710
+ <element name="docnumber">
711
+ <text/>
712
+ </element>
713
+ </define>
714
+ <define name="bclassification">
715
+ <element name="classification">
716
+ <optional>
717
+ <attribute name="type"/>
718
+ </optional>
719
+ <text/>
720
+ </element>
721
+ </define>
722
+ <define name="bplace">
723
+ <element name="place">
724
+ <text/>
725
+ </element>
726
+ </define>
727
+ <define name="medium">
728
+ <element name="medium">
729
+ <optional>
730
+ <ref name="form"/>
731
+ </optional>
732
+ <optional>
733
+ <ref name="size"/>
734
+ </optional>
735
+ <optional>
736
+ <ref name="scale"/>
737
+ </optional>
738
+ </element>
739
+ </define>
740
+ <define name="form">
741
+ <element name="form">
742
+ <text/>
743
+ </element>
744
+ </define>
745
+ <define name="size">
746
+ <element name="size">
747
+ <text/>
748
+ </element>
749
+ </define>
750
+ <define name="scale">
751
+ <element name="scale">
752
+ <text/>
753
+ </element>
754
+ </define>
755
+ <define name="accesslocation">
756
+ <element name="accesslocation">
757
+ <text/>
758
+ </element>
759
+ </define>
760
+ <define name="extent">
761
+ <element name="extent">
762
+ <ref name="BibItemLocality"/>
763
+ </element>
764
+ </define>
765
+ <define name="series">
766
+ <element name="series">
767
+ <optional>
768
+ <attribute name="type">
769
+ <ref name="SeriesType"/>
770
+ </attribute>
771
+ </optional>
772
+ <choice>
773
+ <ref name="formattedref"/>
774
+ <group>
775
+ <ref name="btitle"/>
776
+ <optional>
777
+ <ref name="bplace"/>
778
+ </optional>
779
+ <optional>
780
+ <ref name="seriesorganization"/>
781
+ </optional>
782
+ <optional>
783
+ <ref name="abbreviation"/>
784
+ </optional>
785
+ <optional>
786
+ <ref name="seriesfrom"/>
787
+ </optional>
788
+ <optional>
789
+ <ref name="seriesto"/>
790
+ </optional>
791
+ <optional>
792
+ <ref name="seriesnumber"/>
793
+ </optional>
794
+ <optional>
795
+ <ref name="seriespartnumber"/>
796
+ </optional>
797
+ </group>
798
+ </choice>
799
+ </element>
800
+ </define>
801
+ <define name="SeriesType">
802
+ <choice>
803
+ <value>main</value>
804
+ <value>alt</value>
805
+ </choice>
806
+ </define>
807
+ <define name="seriesorganization">
808
+ <element name="organization">
809
+ <text/>
810
+ </element>
811
+ </define>
812
+ <define name="seriesfrom">
813
+ <element name="from">
814
+ <ref name="ISO8601Date"/>
815
+ </element>
816
+ </define>
817
+ <define name="seriesto">
818
+ <element name="to">
819
+ <ref name="ISO8601Date"/>
820
+ </element>
821
+ </define>
822
+ <define name="seriesnumber">
823
+ <element name="number">
824
+ <text/>
825
+ </element>
826
+ </define>
827
+ <define name="seriespartnumber">
828
+ <element name="partnumber">
829
+ <text/>
830
+ </element>
831
+ </define>
832
+ <define name="biblionote">
833
+ <element name="note">
834
+ <optional>
835
+ <attribute name="type"/>
836
+ </optional>
837
+ <ref name="FormattedString"/>
838
+ </element>
839
+ </define>
840
+ <define name="abstract">
841
+ <element name="abstract">
842
+ <ref name="FormattedString"/>
843
+ </element>
844
+ </define>
845
+ <define name="copyright">
846
+ <element name="copyright">
847
+ <ref name="from"/>
848
+ <optional>
849
+ <ref name="to"/>
850
+ </optional>
851
+ <ref name="owner"/>
852
+ </element>
853
+ </define>
854
+ <define name="from">
855
+ <element name="from">
856
+ <data type="gYear"/>
857
+ </element>
858
+ </define>
859
+ <define name="to">
860
+ <element name="to">
861
+ <data type="gYear"/>
862
+ </element>
863
+ </define>
864
+ <define name="owner">
865
+ <element name="owner">
866
+ <ref name="ContributorInfo"/>
867
+ </element>
868
+ </define>
869
+ <define name="DocRelationType">
870
+ <choice>
871
+ <value>obsoletes</value>
872
+ <value>updates</value>
873
+ <value>updatedBy</value>
874
+ <value>complements</value>
875
+ <value>derivedFrom</value>
876
+ <value>translatedFrom</value>
877
+ <value>adoptedFrom</value>
878
+ <value>equivalent</value>
879
+ <value>identical</value>
880
+ <value>nonequivalent</value>
881
+ <value>includedIn</value>
882
+ <value>includes</value>
883
+ <value>instance</value>
884
+ <value>partOf</value>
885
+ <value>hasDraft</value>
886
+ </choice>
887
+ </define>
888
+ <define name="docrelation">
889
+ <element name="relation">
890
+ <attribute name="type">
891
+ <ref name="DocRelationType"/>
892
+ </attribute>
893
+ <element name="bibitem">
894
+ <ref name="BibliographicItem"/>
895
+ </element>
896
+ <zeroOrMore>
897
+ <ref name="locality"/>
898
+ </zeroOrMore>
899
+ </element>
900
+ </define>
901
+ <define name="version">
902
+ <element name="version">
903
+ <optional>
904
+ <ref name="revision-date"/>
905
+ </optional>
906
+ <zeroOrMore>
907
+ <ref name="draft"/>
908
+ </zeroOrMore>
909
+ </element>
910
+ </define>
911
+ <define name="vedition">
912
+ <element name="edition">
913
+ <data type="int"/>
914
+ </element>
915
+ </define>
916
+ <define name="revision-date">
917
+ <element name="revision-date">
918
+ <ref name="ISO8601Date"/>
919
+ </element>
920
+ </define>
921
+ <define name="draft">
922
+ <element name="draft">
923
+ <text/>
924
+ </element>
925
+ </define>
926
+ <!--
927
+ Anycontents = mixed {
928
+ https://github.com/relaxng/jing-trang/issues/211
929
+ https://lists.oasis-open.org/archives/office/200808/msg00024.html
930
+ https://lists.oasis-open.org/archives/office/200808/msg00099.html
931
+ For this to work, we will actually strip any attributes in the Anycontents before
932
+ passing it for validation. Horrible I know, but there are no good alternatives
933
+ that also allow us to do grammar inheritance
934
+ (attribute * { text } | Any)*
935
+ Any*
936
+ }
937
+ -->
938
+ <define name="AnyElement">
939
+ <element>
940
+ <anyName/>
941
+ <oneOrMore>
942
+ <choice>
943
+ <text/>
944
+ <ref name="AnyElement"/>
945
+ </choice>
946
+ </oneOrMore>
947
+ </element>
948
+ </define>
949
+ </grammar>