metanorma-m3d 1.0.0

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 (50) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +1 -0
  3. data/.travis.yml +15 -0
  4. data/CODE_OF_CONDUCT.md +74 -0
  5. data/Gemfile +4 -0
  6. data/LICENSE +25 -0
  7. data/README.adoc +170 -0
  8. data/Rakefile +6 -0
  9. data/asciidoctor-m3d.gemspec.old +54 -0
  10. data/bin/console +14 -0
  11. data/bin/rspec +18 -0
  12. data/bin/setup +8 -0
  13. data/lib/asciidoctor-m3d.rb +10 -0
  14. data/lib/asciidoctor/m3d.rb +7 -0
  15. data/lib/asciidoctor/m3d/biblio.rng +836 -0
  16. data/lib/asciidoctor/m3d/converter.rb +188 -0
  17. data/lib/asciidoctor/m3d/html/dots-w@2x.png +0 -0
  18. data/lib/asciidoctor/m3d/html/dots@2x.png +0 -0
  19. data/lib/asciidoctor/m3d/html/header.html +184 -0
  20. data/lib/asciidoctor/m3d/html/html_m3d_intro.html +8 -0
  21. data/lib/asciidoctor/m3d/html/html_m3d_titlepage.html +95 -0
  22. data/lib/asciidoctor/m3d/html/htmlstyle.scss +797 -0
  23. data/lib/asciidoctor/m3d/html/m3d.scss +549 -0
  24. data/lib/asciidoctor/m3d/html/scripts.html +68 -0
  25. data/lib/asciidoctor/m3d/isodoc.rng +1059 -0
  26. data/lib/asciidoctor/m3d/isostandard.rng +1001 -0
  27. data/lib/asciidoctor/m3d/m3d.rng +154 -0
  28. data/lib/asciidoctor/m3d/version.rb +5 -0
  29. data/lib/isodoc/m3d/html/dots-w@2x.png +0 -0
  30. data/lib/isodoc/m3d/html/dots@2x.png +0 -0
  31. data/lib/isodoc/m3d/html/header.html +219 -0
  32. data/lib/isodoc/m3d/html/html_m3d_intro.html +14 -0
  33. data/lib/isodoc/m3d/html/html_m3d_titlepage.html +102 -0
  34. data/lib/isodoc/m3d/html/htmlstyle.scss +1001 -0
  35. data/lib/isodoc/m3d/html/logo.jpg +0 -0
  36. data/lib/isodoc/m3d/html/m3-logo.png +0 -0
  37. data/lib/isodoc/m3d/html/m3d.scss +697 -0
  38. data/lib/isodoc/m3d/html/scripts.html +82 -0
  39. data/lib/isodoc/m3d/html/word_m3d_intro.html +10 -0
  40. data/lib/isodoc/m3d/html/word_m3d_titlepage.html +58 -0
  41. data/lib/isodoc/m3d/html/wordstyle.scss +1003 -0
  42. data/lib/isodoc/m3d/m3dhtmlconvert.rb +154 -0
  43. data/lib/isodoc/m3d/m3dhtmlrender.rb +68 -0
  44. data/lib/isodoc/m3d/m3dwordconvert.rb +105 -0
  45. data/lib/isodoc/m3d/m3wordrender.rb +68 -0
  46. data/lib/isodoc/m3d/metadata.rb +87 -0
  47. data/lib/metanorma/m3d.rb +7 -0
  48. data/lib/metanorma/m3d/processor.rb +41 -0
  49. data/metanorma-m3d.gemspec +55 -0
  50. metadata +419 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 70e6eded3f2bfba0260ed6c0795d0798865c04b8b350b488cfb4d4fcbf6bfdb6
4
+ data.tar.gz: 54865bdd989cc1f83a7ce6bf7c6507d0145bf9ad827e8b8c935b2c7d91e4d185
5
+ SHA512:
6
+ metadata.gz: b1a58babb1f325a3098432faf9eb1fa730c26dee01aad64821122344f557dcb0ac71158022b3eb7c9f035108197b0f9750ed30f42ec98871a76f33fcd1a81a93
7
+ data.tar.gz: 9fdeb98e902eedc910a492f20483d0863e69c7b1dd797e6c7f449211770c85e5d80e575741054bb61b76ba108faa349707c6d4f5fe6cbfd6d0f790e7a561febf
data/.gitignore ADDED
@@ -0,0 +1 @@
1
+ .DS_Store
data/.travis.yml ADDED
@@ -0,0 +1,15 @@
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
+ - unset _JAVA_OPTIONS
12
+ matrix:
13
+ allow_failures:
14
+ - rvm: ruby-head
15
+
@@ -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 open.source@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,170 @@
1
+ = AsciiM3D: Asciidoctor processor for Ribose Standard Documents (M3D)
2
+
3
+ image:https://img.shields.io/gem/v/metanorma-m3d.svg["Gem Version", link="https://rubygems.org/gems/metanorma-m3d"]
4
+ image:https://img.shields.io/travis/riboseinc/metanorma-m3d/master.svg["Build Status", link="https://travis-ci.org/riboseinc/metanorma-m3d"]
5
+ image:https://codeclimate.com/github/riboseinc/metanorma-m3d/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/riboseinc/metanorma-m3d"]
6
+
7
+ WARNING: This gem is still under development.
8
+
9
+ _Formerly known as_ `asciidoctor-m3d`.
10
+
11
+ == Functionality
12
+
13
+ This gem processes http://asciidoctor.org/[Asciidoctor] documents following
14
+ a template for generating M3D documents.
15
+
16
+ The gem currently inherits from the https://github.com/riboseinc/metanorma-standoc
17
+ gem, and aligns closely to it. Refer to the ISO gem documentation
18
+ for guidance, including https://github.com/riboseinc/metanorma-iso/wiki/Guidance-for-authoring
19
+
20
+ The following outputs are generated.
21
+
22
+ * (Optional) An HTML preview generated directly from the Asciidoctor document,
23
+ using native Asciidoctor formatting.
24
+ ** http://asciimath.org[AsciiMathML] is to be used for mathematical formatting.
25
+ The gem uses the https://github.com/asciidoctor/asciimath[Ruby AsciiMath parser],
26
+ which is syntactically stricter than the common MathJax processor;
27
+ if you do not get expected results, try bracketing terms your in AsciiMathML
28
+ expressions.
29
+ * an XML representation of the document, intended as a document model for M3D
30
+ International Standards.
31
+ * The XML representation is processed in turn to generate the following outputs
32
+ as end deliverable M3D standard drafts.
33
+ ** HTML
34
+ ** DOC
35
+
36
+ This AsciiDoc syntax for writing M3D standards is hereby named "AsciiM3D".
37
+
38
+ == Usage
39
+
40
+ The preferred way to invoke this gem is via the `metanorma` script:
41
+
42
+ [source,console]
43
+ ----
44
+ $ metanorma --type m3d a.adoc # output HTML and DOC
45
+ $ metanorma --type m3d --extensions html a.adoc # output just HTML
46
+ $ metanorma --type m3d --extensions pdf a.adoc # output just DOC
47
+ $ metanorma --type m3d --extensions xml a.adoc # output M3D XML
48
+ ----
49
+
50
+ The gem translates the document into M3D XML format, and then
51
+ validates its output against the M3D XML document model; errors are
52
+ reported to console against the XML, and are intended for users to
53
+ check that they have provided all necessary components of the
54
+ document.
55
+
56
+ The gem then converts the XML into HTML and PDF.
57
+
58
+ The gem can also be invoked directly within asciidoctor, though this is deprecated:
59
+
60
+ [source,console]
61
+ ----
62
+ $ asciidoctor -b m3d -r 'metanorma-m3d' a.adoc
63
+ ----
64
+
65
+ === Installation
66
+
67
+ If you are using a Mac, the https://github.com/riboseinc/metanorma-macos-setup
68
+ repository has instructions on setting up your machine to run Metanorma
69
+ scripts such as this one. You need only run the following in a Terminal console:
70
+
71
+ [source,console]
72
+ ----
73
+ $ bash <(curl -s https://raw.githubusercontent.com/riboseinc/metanorma-macos-setup/master/metanorma-setup)
74
+ $ gem install metanorma-m3d
75
+ ----
76
+
77
+
78
+ == Approach
79
+
80
+ === Document model
81
+
82
+ The Ribose Standard Document model is an instance of the
83
+ https://github.com/riboseinc/isodoc-models[StandardDocument model].
84
+
85
+ The M3D format ("M3D XML") intends to introduce rigor into the M3D
86
+ standards authoring process, and is prescribed in a separate document.
87
+
88
+ M3D XML is still under development, but it already contains all the markup
89
+ needed to render a M3D document into HTML.
90
+
91
+ === Asciidoctor
92
+
93
+ Asciidoctor has been selected as the authoring tool to generate the document
94
+ model representation of M3D standards. It is a document formatting tool like
95
+ Markdown and DocBook, which combines the relative ease of use of the former
96
+ (using relatively lightweight markup), and the rigor and expressively of the
97
+ latter (it has a well-defined syntax, and was in fact initially developed as a
98
+ DocBook document authoring tool). Asciidoctor has built-in capability to output
99
+ Text, DocBook and HTML; so it can be used to preview the file as it is being
100
+ authored.
101
+
102
+ Note that in order to generate HTML preview output close to what is intended
103
+ in the M3D standard, the Asciidoc
104
+ document includes a fair amount of formatting instructions (e.g. disabling
105
+ section numbering where appropriate, the titling of Appendixes as Annexes), as
106
+ well as M3D boilerplate text, and predefined section headers (sections are
107
+ recognised by fixed titles such as `Normative References`). Authoring M3D
108
+ standards in this fashion assumes that users will be populating an Asciidoc
109
+ template, and not removing needed formatting instructions.
110
+
111
+ == Document Attributes
112
+
113
+ The gem relies on Asciidoctor document attributes to provide necessary
114
+ metadata about the document. These include:
115
+
116
+ `:edition:`:: The document edition
117
+
118
+ `:revdate:`:: The date the document was last updated
119
+
120
+ `:copyright-year:`:: The year which will be claimed as when the copyright for
121
+ the document was issued
122
+
123
+ `:title:`:: The main component of the English title of the document
124
+ (mandatory). (The first line of the AsciiDoc document, which contains the title
125
+ introduced with `=`, is ignored)
126
+
127
+ `:doctype:`:: The document type (see M3D deliverables: The different types of
128
+ M3D publications) (mandatory). The permitted types are:
129
+ +
130
+ --
131
+ code:: Code Artifact
132
+ presentation:: Presentation
133
+ proposal:: Proposal; includes IETF DRAFT
134
+ standard:: Recommendation; includes IETF RFC
135
+ report:: report
136
+ --
137
+
138
+ `:status:``:: The document status. The permitted types are: `proposal`,
139
+ `working-draft`, `committee-draft`, `draft-standard`, `final-draft`,
140
+ `published`, `withdrawn`.
141
+
142
+ `:technical-committee:`:: The name of the relevant M3D technical committee
143
+ (mandatory)
144
+
145
+ `:language:` :: The language of the document (only `en` for now) (mandatory)
146
+
147
+ `:url:` :: The URL that the HTML version of the document will be published to
148
+ (optional)
149
+
150
+ The attribute `:draft:`, if present, includes review notes in the XML output;
151
+ these are otherwise suppressed.
152
+
153
+ == AsciiM3D features not also present in AsciiISO
154
+
155
+ * `+[keyword]#...#+`: encodes keywords, such as "MUST", "MUST NOT". (Encoded as
156
+ `<span class="keyword">...</span>`.
157
+
158
+ == Data Models
159
+
160
+ The M3D Standard Document format is an instance of the
161
+ https://github.com/riboseinc/isodoc-models[StandardDocument model]. Details of
162
+ this general model can be found on its page. Details of the M3D modifications
163
+ to this general model can be found on the https://github.com/riboseinc/m3d[M3D model]
164
+ repository.
165
+
166
+ == Examples
167
+
168
+ * link:spec/examples/rfc6350.adoc[] is an AsciiM3D version of https://tools.ietf.org/html/rfc6350[RFC 6350].
169
+ * link:spec/examples/rfc6350.html[] is an HTML file generated from the AsciiM3D.
170
+ * link:spec/examples/rfc6350.doc[] is a Word document generated from the AsciiM3D.
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
@@ -0,0 +1,54 @@
1
+ lib = File.expand_path("../lib", __FILE__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require "asciidoctor/m3d/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "asciidoctor-m3d"
7
+ spec.version = Asciidoctor::M3d::VERSION
8
+ spec.authors = ["Ribose Inc."]
9
+ spec.email = ["open.source@ribose.com"]
10
+
11
+ spec.summary = "asciidoctor-m3d lets you write M3AAWG Documents (M3D) in AsciiDoc."
12
+ spec.description = <<~DESCRIPTION
13
+ asciidoctor-m3d lets you write M3AAWG Documents (M3D) in AsciiDoc syntax.
14
+
15
+ This gem is in active development.
16
+ DESCRIPTION
17
+
18
+ spec.homepage = "https://github.com/riboseinc/asciidoctor-m3d"
19
+ spec.license = "BSD-2-Clause"
20
+ spec.post_install_message = "The asciidoctor-csd gem has been deprecated and has been replaced by metanorma-csd"
21
+
22
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
23
+ f.match(%r{^(test|spec|features)/})
24
+ end
25
+ spec.bindir = "exe"
26
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
27
+ spec.require_paths = ["lib"]
28
+
29
+ spec.add_dependency "asciidoctor", "~> 1.5.7"
30
+ spec.add_dependency "asciimath"
31
+ spec.add_dependency "htmlentities", "~> 4.3.4"
32
+ spec.add_dependency "image_size"
33
+ spec.add_dependency "mime-types"
34
+ spec.add_dependency "nokogiri"
35
+ spec.add_dependency "ruby-jing"
36
+ spec.add_dependency "ruby-xslt"
37
+ spec.add_dependency "thread_safe"
38
+ spec.add_dependency "uuidtools"
39
+
40
+ spec.add_dependency "asciidoctor-iso", "~> 0.10.2"
41
+ spec.add_dependency "isodoc", "~> 0.8.8"
42
+
43
+ spec.add_development_dependency "bundler", "~> 1.15"
44
+ spec.add_development_dependency "byebug", "~> 9.1"
45
+ spec.add_development_dependency "equivalent-xml", "~> 0.6"
46
+ spec.add_development_dependency "guard", "~> 2.14"
47
+ spec.add_development_dependency "guard-rspec", "~> 4.7"
48
+ spec.add_development_dependency "rake", "~> 12.0"
49
+ spec.add_development_dependency "rspec", "~> 3.6"
50
+ spec.add_development_dependency "rubocop", "~> 0.50"
51
+ spec.add_development_dependency "simplecov", "~> 0.15"
52
+ spec.add_development_dependency "timecop", "~> 0.9"
53
+ spec.add_development_dependency "metanorma", "~> 0.2.5"
54
+ end
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "asciidoctor/m3d"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/rspec ADDED
@@ -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
+
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,10 @@
1
+ require "asciidoctor" unless defined? Asciidoctor::Converter
2
+ require_relative "asciidoctor/m3d/converter"
3
+ require_relative "isodoc/m3d/m3dhtmlconvert"
4
+ require_relative "isodoc/m3d/m3dwordconvert"
5
+ require_relative "asciidoctor/m3d/version"
6
+
7
+ if defined? Metanorma
8
+ require_relative "metanorma/m3d"
9
+ Metanorma::Registry.instance.register(Metanorma::M3d::Processor)
10
+ end
@@ -0,0 +1,7 @@
1
+ require "asciidoctor/m3d/version"
2
+
3
+ module Asciidoctor
4
+ module M3d
5
+ # Your code goes here...
6
+ end
7
+ end
@@ -0,0 +1,836 @@
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
+ <data type="anyURI"/>
263
+ </element>
264
+ </define>
265
+ <!-- TODO may change -->
266
+ <define name="contact">
267
+ <choice>
268
+ <ref name="address"/>
269
+ <ref name="phone"/>
270
+ <ref name="email"/>
271
+ <ref name="uri"/>
272
+ </choice>
273
+ </define>
274
+ <define name="phone">
275
+ <element name="phone">
276
+ <text/>
277
+ </element>
278
+ </define>
279
+ <define name="email">
280
+ <element name="email">
281
+ <text/>
282
+ </element>
283
+ </define>
284
+ <define name="address">
285
+ <element name="address">
286
+ <oneOrMore>
287
+ <!-- iso191606 TODO -->
288
+ <ref name="street"/>
289
+ </oneOrMore>
290
+ <ref name="city"/>
291
+ <optional>
292
+ <ref name="state"/>
293
+ </optional>
294
+ <ref name="country"/>
295
+ <optional>
296
+ <ref name="postcode"/>
297
+ </optional>
298
+ </element>
299
+ </define>
300
+ <define name="street">
301
+ <element name="street">
302
+ <text/>
303
+ </element>
304
+ </define>
305
+ <define name="city">
306
+ <element name="city">
307
+ <text/>
308
+ </element>
309
+ </define>
310
+ <define name="state">
311
+ <element name="state">
312
+ <text/>
313
+ </element>
314
+ </define>
315
+ <define name="country">
316
+ <element name="country">
317
+ <text/>
318
+ </element>
319
+ </define>
320
+ <define name="postcode">
321
+ <element name="postcode">
322
+ <text/>
323
+ </element>
324
+ </define>
325
+ <define name="person-identifier">
326
+ <element name="identifier">
327
+ <attribute name="type">
328
+ <choice>
329
+ <value>isni</value>
330
+ <value>uri</value>
331
+ </choice>
332
+ </attribute>
333
+ <text/>
334
+ </element>
335
+ </define>
336
+ <define name="org-identifier">
337
+ <element name="identifier">
338
+ <attribute name="type">
339
+ <choice>
340
+ <value>orcid</value>
341
+ <value>uri</value>
342
+ </choice>
343
+ </attribute>
344
+ <text/>
345
+ </element>
346
+ </define>
347
+ <define name="citation">
348
+ <element name="citation">
349
+ <ref name="CitationType"/>
350
+ </element>
351
+ </define>
352
+ <define name="CitationType">
353
+ <attribute name="bibitemid">
354
+ <data type="IDREF"/>
355
+ </attribute>
356
+ <zeroOrMore>
357
+ <ref name="locality"/>
358
+ </zeroOrMore>
359
+ <optional>
360
+ <ref name="date"/>
361
+ </optional>
362
+ </define>
363
+ <define name="date">
364
+ <element name="date">
365
+ <choice>
366
+ <data type="gYear"/>
367
+ <data type="date"/>
368
+ </choice>
369
+ </element>
370
+ </define>
371
+ <define name="locality">
372
+ <element name="locality">
373
+ <ref name="BibItemLocality"/>
374
+ </element>
375
+ </define>
376
+ <define name="BibItemLocality">
377
+ <attribute name="type">
378
+ <ref name="LocalityType"/>
379
+ </attribute>
380
+ <ref name="referenceFrom"/>
381
+ <optional>
382
+ <ref name="referenceTo"/>
383
+ </optional>
384
+ </define>
385
+ <define name="LocalityType">
386
+ <data type="string">
387
+ <param name="pattern">section|clause|part|paragraph|chapter|page|whole|table|annex|figure|note|example|volume|issue|locality:[a-zA-Z0-9_]+</param>
388
+ </data>
389
+ </define>
390
+ <define name="referenceFrom">
391
+ <element name="referenceFrom">
392
+ <text/>
393
+ </element>
394
+ </define>
395
+ <define name="referenceTo">
396
+ <element name="referenceTo">
397
+ <text/>
398
+ </element>
399
+ </define>
400
+ <!-- unlike UML, has id attribute; that results from including bibitem in a docmodel -->
401
+ <define name="bibitem">
402
+ <element name="bibitem">
403
+ <attribute name="id">
404
+ <data type="ID"/>
405
+ </attribute>
406
+ <ref name="BibliographicItem"/>
407
+ </element>
408
+ </define>
409
+ <define name="bibitem_no_id">
410
+ <element name="bibitem">
411
+ <ref name="BibliographicItem"/>
412
+ </element>
413
+ </define>
414
+ <define name="BibItemType" combine="choice">
415
+ <choice>
416
+ <value>article</value>
417
+ <value>book</value>
418
+ <value>booklet</value>
419
+ <value>conference</value>
420
+ <value>manual</value>
421
+ <value>proceedings</value>
422
+ <value>presentation</value>
423
+ <value>thesis</value>
424
+ <value>techreport</value>
425
+ <value>standard</value>
426
+ <value>unpublished</value>
427
+ <value>map</value>
428
+ <value>electronic resource</value>
429
+ <value>audiovisual</value>
430
+ <value>film</value>
431
+ <value>video</value>
432
+ <value>broadcast</value>
433
+ <value>graphic work</value>
434
+ <value>music</value>
435
+ <value>patent</value>
436
+ <value>inbook</value>
437
+ <value>incollection</value>
438
+ <value>inproceedings</value>
439
+ </choice>
440
+ </define>
441
+ <define name="BibliographicItem">
442
+ <optional>
443
+ <attribute name="type">
444
+ <ref name="BibItemType"/>
445
+ </attribute>
446
+ </optional>
447
+ <choice>
448
+ <oneOrMore>
449
+ <ref name="btitle"/>
450
+ </oneOrMore>
451
+ <ref name="formattedref"/>
452
+ </choice>
453
+ <zeroOrMore>
454
+ <ref name="bsource"/>
455
+ </zeroOrMore>
456
+ <zeroOrMore>
457
+ <ref name="docidentifier"/>
458
+ </zeroOrMore>
459
+ <zeroOrMore>
460
+ <ref name="bdate"/>
461
+ </zeroOrMore>
462
+ <zeroOrMore>
463
+ <ref name="contributor"/>
464
+ </zeroOrMore>
465
+ <optional>
466
+ <ref name="edition"/>
467
+ </optional>
468
+ <zeroOrMore>
469
+ <ref name="biblionote"/>
470
+ </zeroOrMore>
471
+ <zeroOrMore>
472
+ <ref name="language"/>
473
+ </zeroOrMore>
474
+ <zeroOrMore>
475
+ <ref name="script"/>
476
+ </zeroOrMore>
477
+ <optional>
478
+ <ref name="abstract"/>
479
+ </optional>
480
+ <optional>
481
+ <ref name="status"/>
482
+ </optional>
483
+ <optional>
484
+ <ref name="copyright"/>
485
+ </optional>
486
+ <zeroOrMore>
487
+ <ref name="docrelation"/>
488
+ </zeroOrMore>
489
+ <zeroOrMore>
490
+ <ref name="series"/>
491
+ </zeroOrMore>
492
+ <optional>
493
+ <ref name="medium"/>
494
+ </optional>
495
+ <zeroOrMore>
496
+ <ref name="bplace"/>
497
+ </zeroOrMore>
498
+ <zeroOrMore>
499
+ <ref name="extent"/>
500
+ </zeroOrMore>
501
+ <zeroOrMore>
502
+ <ref name="accesslocation"/>
503
+ </zeroOrMore>
504
+ <optional>
505
+ <ref name="bclassification"/>
506
+ </optional>
507
+ <optional>
508
+ <ref name="validity"/>
509
+ </optional>
510
+ </define>
511
+ <define name="btitle">
512
+ <element name="title">
513
+ <ref name="TypedTitleString"/>
514
+ </element>
515
+ </define>
516
+ <define name="bsource">
517
+ <element name="uri">
518
+ <ref name="TypedUri"/>
519
+ </element>
520
+ </define>
521
+ <define name="formattedref">
522
+ <element name="formattedref">
523
+ <ref name="FormattedString"/>
524
+ </element>
525
+ </define>
526
+ <define name="validity">
527
+ <element name="validity">
528
+ <optional>
529
+ <ref name="validityBegins"/>
530
+ </optional>
531
+ <optional>
532
+ <ref name="validityEnds"/>
533
+ </optional>
534
+ <optional>
535
+ <ref name="validityRevision"/>
536
+ </optional>
537
+ </element>
538
+ </define>
539
+ <define name="validityBegins">
540
+ <element name="validityBegins">
541
+ <data type="dateTime"/>
542
+ </element>
543
+ </define>
544
+ <define name="validityEnds">
545
+ <element name="validityEnds">
546
+ <data type="dateTime"/>
547
+ </element>
548
+ </define>
549
+ <define name="validityRevision">
550
+ <element name="revision">
551
+ <data type="dateTime"/>
552
+ </element>
553
+ </define>
554
+ <define name="TypedTitleString">
555
+ <optional>
556
+ <attribute name="type">
557
+ <ref name="TitleType"/>
558
+ </attribute>
559
+ </optional>
560
+ <ref name="FormattedString"/>
561
+ </define>
562
+ <define name="TitleType">
563
+ <choice>
564
+ <value>alternative</value>
565
+ <value>original</value>
566
+ <value>unofficial</value>
567
+ <value>subtitle</value>
568
+ <value>main</value>
569
+ </choice>
570
+ </define>
571
+ <define name="TypedUri">
572
+ <optional>
573
+ <attribute name="type"/>
574
+ </optional>
575
+ <data type="anyURI"/>
576
+ </define>
577
+ <define name="DateType">
578
+ <optional>
579
+ <attribute name="text"/>
580
+ </optional>
581
+ <optional>
582
+ <choice>
583
+ <data type="gYear"/>
584
+ <data type="date"/>
585
+ </choice>
586
+ </optional>
587
+ </define>
588
+ <define name="bdate">
589
+ <element name="date">
590
+ <attribute name="type">
591
+ <choice>
592
+ <value>published</value>
593
+ <value>accessed</value>
594
+ <value>created</value>
595
+ <value>implemented</value>
596
+ <value>obsoleted</value>
597
+ <value>confirmed</value>
598
+ <value>updated</value>
599
+ <value>issued</value>
600
+ <value>transmitted</value>
601
+ <value>copied</value>
602
+ </choice>
603
+ </attribute>
604
+ <choice>
605
+ <group>
606
+ <element name="from">
607
+ <choice>
608
+ <data type="gYear"/>
609
+ <data type="date"/>
610
+ </choice>
611
+ </element>
612
+ <optional>
613
+ <element name="to">
614
+ <choice>
615
+ <data type="gYear"/>
616
+ <data type="date"/>
617
+ </choice>
618
+ </element>
619
+ </optional>
620
+ </group>
621
+ <element name="on">
622
+ <choice>
623
+ <data type="gYear"/>
624
+ <data type="date"/>
625
+ </choice>
626
+ </element>
627
+ </choice>
628
+ </element>
629
+ </define>
630
+ <define name="docidentifier">
631
+ <element name="docidentifier">
632
+ <optional>
633
+ <attribute name="type"/>
634
+ </optional>
635
+ <text/>
636
+ </element>
637
+ </define>
638
+ <define name="bclassification">
639
+ <element name="classification">
640
+ <optional>
641
+ <attribute name="type"/>
642
+ </optional>
643
+ <text/>
644
+ </element>
645
+ </define>
646
+ <define name="bplace">
647
+ <element name="place">
648
+ <text/>
649
+ </element>
650
+ </define>
651
+ <define name="medium">
652
+ <element name="medium">
653
+ <optional>
654
+ <ref name="form"/>
655
+ </optional>
656
+ <optional>
657
+ <ref name="size"/>
658
+ </optional>
659
+ <optional>
660
+ <ref name="scale"/>
661
+ </optional>
662
+ </element>
663
+ </define>
664
+ <define name="form">
665
+ <element name="form">
666
+ <text/>
667
+ </element>
668
+ </define>
669
+ <define name="size">
670
+ <element name="size">
671
+ <text/>
672
+ </element>
673
+ </define>
674
+ <define name="scale">
675
+ <element name="scale">
676
+ <text/>
677
+ </element>
678
+ </define>
679
+ <define name="accesslocation">
680
+ <element name="accesslocation">
681
+ <text/>
682
+ </element>
683
+ </define>
684
+ <define name="extent">
685
+ <element name="extent">
686
+ <ref name="BibItemLocality"/>
687
+ </element>
688
+ </define>
689
+ <define name="series">
690
+ <element name="series">
691
+ <optional>
692
+ <attribute name="type">
693
+ <choice>
694
+ <value>main</value>
695
+ <value>alt</value>
696
+ </choice>
697
+ </attribute>
698
+ </optional>
699
+ <choice>
700
+ <ref name="btitle"/>
701
+ <ref name="formattedref"/>
702
+ </choice>
703
+ <ref name="bplace"/>
704
+ <ref name="seriesorganization"/>
705
+ <optional>
706
+ <ref name="abbreviation"/>
707
+ </optional>
708
+ <optional>
709
+ <ref name="seriesfrom"/>
710
+ </optional>
711
+ <optional>
712
+ <ref name="seriesto"/>
713
+ </optional>
714
+ <optional>
715
+ <ref name="seriesnumber"/>
716
+ </optional>
717
+ <optional>
718
+ <ref name="seriespartnumber"/>
719
+ </optional>
720
+ </element>
721
+ </define>
722
+ <define name="seriesorganization">
723
+ <element name="organization">
724
+ <text/>
725
+ </element>
726
+ </define>
727
+ <define name="seriesfrom">
728
+ <element name="from">
729
+ <choice>
730
+ <data type="dateTime"/>
731
+ <data type="gYear"/>
732
+ </choice>
733
+ </element>
734
+ </define>
735
+ <define name="seriesto">
736
+ <element name="to">
737
+ <choice>
738
+ <data type="dateTime"/>
739
+ <data type="gYear"/>
740
+ </choice>
741
+ </element>
742
+ </define>
743
+ <define name="seriesnumber">
744
+ <element name="number">
745
+ <text/>
746
+ </element>
747
+ </define>
748
+ <define name="seriespartnumber">
749
+ <element name="partnumber">
750
+ <text/>
751
+ </element>
752
+ </define>
753
+ <define name="biblionote">
754
+ <element name="note">
755
+ <ref name="FormattedString"/>
756
+ </element>
757
+ </define>
758
+ <define name="abstract">
759
+ <element name="abstract">
760
+ <ref name="FormattedString"/>
761
+ </element>
762
+ </define>
763
+ <define name="copyright">
764
+ <element name="copyright">
765
+ <ref name="from"/>
766
+ <optional>
767
+ <ref name="to"/>
768
+ </optional>
769
+ <ref name="owner"/>
770
+ </element>
771
+ </define>
772
+ <define name="from">
773
+ <element name="from">
774
+ <data type="gYear"/>
775
+ </element>
776
+ </define>
777
+ <define name="to">
778
+ <element name="to">
779
+ <data type="gYear"/>
780
+ </element>
781
+ </define>
782
+ <define name="owner">
783
+ <element name="owner">
784
+ <ref name="ContributorInfo"/>
785
+ </element>
786
+ </define>
787
+ <define name="docrelation">
788
+ <element name="relation">
789
+ <attribute name="type">
790
+ <choice>
791
+ <value>obsoletes</value>
792
+ <value>updates</value>
793
+ <value>updatedBy</value>
794
+ <value>complements</value>
795
+ <value>derivedFrom</value>
796
+ <value>translatedFrom</value>
797
+ <value>adoptedFrom</value>
798
+ <value>equivalent</value>
799
+ <value>identical</value>
800
+ <value>nonequivalent</value>
801
+ <value>includedIn</value>
802
+ <value>includes</value>
803
+ <value>instance</value>
804
+ <value>partOf</value>
805
+ </choice>
806
+ </attribute>
807
+ <element name="bibitem">
808
+ <ref name="BibliographicItem"/>
809
+ </element>
810
+ <zeroOrMore>
811
+ <ref name="locality"/>
812
+ </zeroOrMore>
813
+ </element>
814
+ </define>
815
+ <!--
816
+ Anycontents = mixed {
817
+ https://github.com/relaxng/jing-trang/issues/211
818
+ https://lists.oasis-open.org/archives/office/200808/msg00024.html
819
+ https://lists.oasis-open.org/archives/office/200808/msg00099.html
820
+ For this to work, we will actually strip any attributes in the Anycontents before
821
+ passing it for validation. Horrible I know, but there are no good alternatives
822
+ that also allow us to do grammar inheritance
823
+ (attribute * { text } | Any)*
824
+ Any*
825
+ }
826
+ -->
827
+ <define name="AnyElement">
828
+ <element>
829
+ <anyName/>
830
+ <choice>
831
+ <text/>
832
+ <ref name="AnyElement"/>
833
+ </choice>
834
+ </element>
835
+ </define>
836
+ </grammar>