metanorma-iso 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitattributes +4 -0
- data/.gitignore +11 -0
- data/.hound.yml +3 -0
- data/.oss-guides.rubocop.yml +1077 -0
- data/.rubocop.ribose.yml +66 -0
- data/.rubocop.tb.yml +650 -0
- data/.rubocop.yml +15 -0
- data/.travis.yml +21 -0
- data/CODE_OF_CONDUCT.md +46 -0
- data/Gemfile +7 -0
- data/LICENSE +25 -0
- data/Makefile +39 -0
- data/README.adoc +882 -0
- data/Rakefile +6 -0
- data/asciidoctor-iso.gemspec.old +50 -0
- data/bin/rspec +18 -0
- data/docs/customisation.adoc +186 -0
- data/docs/guidance.adoc +436 -0
- data/docs/htmloutput.adoc +115 -0
- data/docs/quickstart.adoc +375 -0
- data/lib/asciidoctor-iso.rb +11 -0
- data/lib/asciidoctor/iso/base.rb +48 -0
- data/lib/asciidoctor/iso/biblio.rng +836 -0
- data/lib/asciidoctor/iso/cleanup.rb +39 -0
- data/lib/asciidoctor/iso/converter.rb +19 -0
- data/lib/asciidoctor/iso/front.rb +131 -0
- data/lib/asciidoctor/iso/isodoc.rng +1059 -0
- data/lib/asciidoctor/iso/isostandard.rnc +176 -0
- data/lib/asciidoctor/iso/isostandard.rng +1001 -0
- data/lib/asciidoctor/iso/section.rb +72 -0
- data/lib/asciidoctor/iso/validate.rb +190 -0
- data/lib/asciidoctor/iso/validate_requirements.rb +105 -0
- data/lib/asciidoctor/iso/validate_section.rb +214 -0
- data/lib/asciidoctor/iso/validate_style.rb +134 -0
- data/lib/asciidoctor/iso/version.rb +5 -0
- data/lib/isodoc/iso/html/header.html +206 -0
- data/lib/isodoc/iso/html/html_iso_intro.html +34 -0
- data/lib/isodoc/iso/html/html_iso_titlepage.html +34 -0
- data/lib/isodoc/iso/html/htmlstyle.scss +46 -0
- data/lib/isodoc/iso/html/isodoc.scss +696 -0
- data/lib/isodoc/iso/html/scripts.html +174 -0
- data/lib/isodoc/iso/html/style-human.scss +1277 -0
- data/lib/isodoc/iso/html/style-iso.scss +1257 -0
- data/lib/isodoc/iso/html/word_iso_intro.html +72 -0
- data/lib/isodoc/iso/html/word_iso_titlepage.html +62 -0
- data/lib/isodoc/iso/html/wordstyle.scss +1175 -0
- data/lib/isodoc/iso/html_convert.rb +118 -0
- data/lib/isodoc/iso/metadata.rb +107 -0
- data/lib/isodoc/iso/word_convert.rb +141 -0
- data/lib/metanorma/iso.rb +7 -0
- data/lib/metanorma/iso/processor.rb +44 -0
- data/spec/asciidoctor-iso/base_spec.rb +350 -0
- data/spec/asciidoctor-iso/blocks_spec.rb +469 -0
- data/spec/asciidoctor-iso/cleanup_spec.rb +765 -0
- data/spec/asciidoctor-iso/inline_spec.rb +162 -0
- data/spec/asciidoctor-iso/isobib_cache_spec.rb +332 -0
- data/spec/asciidoctor-iso/lists_spec.rb +190 -0
- data/spec/asciidoctor-iso/macros_spec.rb +111 -0
- data/spec/asciidoctor-iso/refs_spec.rb +643 -0
- data/spec/asciidoctor-iso/section_spec.rb +334 -0
- data/spec/asciidoctor-iso/table_spec.rb +307 -0
- data/spec/asciidoctor-iso/validate_spec.rb +907 -0
- data/spec/assets/header.html +7 -0
- data/spec/assets/html.css +2 -0
- data/spec/assets/htmlcover.html +4 -0
- data/spec/assets/htmlintro.html +5 -0
- data/spec/assets/i18n.yaml +2 -0
- data/spec/assets/iso.doc +1093 -0
- data/spec/assets/iso.headless.html +33 -0
- data/spec/assets/iso.html +278 -0
- data/spec/assets/iso.xml +8 -0
- data/spec/assets/rice_image1.png +0 -0
- data/spec/assets/scripts.html +3 -0
- data/spec/assets/std.css +2 -0
- data/spec/assets/word.css +2 -0
- data/spec/assets/wordcover.html +3 -0
- data/spec/assets/wordintro.html +4 -0
- data/spec/examples/103_01_02.html +247 -0
- data/spec/examples/english.yaml +69 -0
- data/spec/examples/iso_123_.xml +45 -0
- data/spec/examples/iso_123_all_parts.xml +45 -0
- data/spec/examples/iso_123_no_year_note.xml +46 -0
- data/spec/examples/iso_124_.xml +41 -0
- data/spec/examples/iso_216_.xml +47 -0
- data/spec/examples/iso_iec_12382_.xml +48 -0
- data/spec/examples/rice.adoc +715 -0
- data/spec/examples/rice.preview.html +1877 -0
- data/spec/examples/rice.sh +4 -0
- data/spec/examples/rice_images/rice_image1.png +0 -0
- data/spec/examples/rice_images/rice_image2.png +0 -0
- data/spec/examples/rice_images/rice_image3_1.png +0 -0
- data/spec/examples/rice_images/rice_image3_2.png +0 -0
- data/spec/examples/rice_images/rice_image3_3.png +0 -0
- data/spec/isodoc/i18n_spec.rb +642 -0
- data/spec/isodoc/iso_spec.rb +168 -0
- data/spec/isodoc/metadata_spec.rb +152 -0
- data/spec/isodoc/postproc_spec.rb +405 -0
- data/spec/isodoc/section_spec.rb +522 -0
- data/spec/isodoc/xref_spec.rb +1337 -0
- data/spec/metanorma/processor_spec.rb +70 -0
- data/spec/spec_helper.rb +227 -0
- metadata +402 -0
data/.rubocop.yml
ADDED
@@ -0,0 +1,15 @@
|
|
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
|
+
# Thoughtbot's style guide from: https://github.com/thoughtbot/guides
|
7
|
+
- ".rubocop.tb.yml"
|
8
|
+
# Overrides from Ribose
|
9
|
+
- ".rubocop.ribose.yml"
|
10
|
+
AllCops:
|
11
|
+
DisplayCopNames: false
|
12
|
+
StyleGuideCopsOnly: false
|
13
|
+
TargetRubyVersion: 2.5
|
14
|
+
Rails:
|
15
|
+
Enabled: true
|
data/.travis.yml
ADDED
@@ -0,0 +1,21 @@
|
|
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
|
+
- wget "http://downloads.sourceforge.net/project/plantuml/plantuml.jar?r=&ts=1424308684&use_mirror=jaist" -O plantuml.jar
|
13
|
+
- sudo mkdir -p /opt/plantuml
|
14
|
+
- sudo cp plantuml.jar /opt/plantuml
|
15
|
+
- echo "#! /bin/sh" > plantuml.sh
|
16
|
+
- echo 'exec java -jar /opt/plantuml/plantuml.jar "$@"' >> plantuml.sh
|
17
|
+
- sudo install -m 755 -D plantuml.sh /usr/bin/plantuml
|
18
|
+
- plantuml -version
|
19
|
+
matrix:
|
20
|
+
allow_failures:
|
21
|
+
- rvm: ruby-head
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
6
|
+
|
7
|
+
## Our Standards
|
8
|
+
|
9
|
+
Examples of behavior that contributes to creating a positive environment include:
|
10
|
+
|
11
|
+
* Using welcoming and inclusive language
|
12
|
+
* Being respectful of differing viewpoints and experiences
|
13
|
+
* Gracefully accepting constructive criticism
|
14
|
+
* Focusing on what is best for the community
|
15
|
+
* Showing empathy towards other community members
|
16
|
+
|
17
|
+
Examples of unacceptable behavior by participants include:
|
18
|
+
|
19
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or advances
|
20
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
21
|
+
* Public or private harassment
|
22
|
+
* Publishing others' private information, such as a physical or electronic address, without explicit permission
|
23
|
+
* Other conduct which could reasonably be considered inappropriate in a professional setting
|
24
|
+
|
25
|
+
## Our Responsibilities
|
26
|
+
|
27
|
+
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
|
28
|
+
|
29
|
+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
|
30
|
+
|
31
|
+
## Scope
|
32
|
+
|
33
|
+
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
|
34
|
+
|
35
|
+
## Enforcement
|
36
|
+
|
37
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at ronald.tse@ribose.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
|
38
|
+
|
39
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
|
40
|
+
|
41
|
+
## Attribution
|
42
|
+
|
43
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
|
44
|
+
|
45
|
+
[homepage]: http://contributor-covenant.org
|
46
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
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/Makefile
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
SRC := $(wildcard draft-*.adoc)
|
2
|
+
TXT := $(patsubst %.adoc,%.txt,$(SRC))
|
3
|
+
XML := $(patsubst %.adoc,%.xml,$(SRC))
|
4
|
+
HTML := $(patsubst %.adoc,%.html,$(SRC))
|
5
|
+
NITS := $(patsubst %.adoc,%.nits,$(SRC))
|
6
|
+
|
7
|
+
SHELL := /bin/bash
|
8
|
+
# Ensure the xml2rfc cache directory exists locally
|
9
|
+
IGNORE := $(shell mkdir -p $(HOME)/.cache/xml2rfc)
|
10
|
+
|
11
|
+
all: $(TXT) $(HTML) $(XML) $(NITS)
|
12
|
+
|
13
|
+
clean:
|
14
|
+
rm -f $(TXT) $(HTML) $(XML)
|
15
|
+
|
16
|
+
%.xml: %.adoc
|
17
|
+
#bundle exec asciidoctor -r ./lib/glob-include-processor.rb -r asciidoctor-rfc -b rfc2 $^ --trace > $@
|
18
|
+
bundle exec asciidoctor -r ./lib/glob-include-processor.rb -r asciidoctor-rfc -b rfc2 -a flush-biblio=true $^ --trace > $@
|
19
|
+
|
20
|
+
%.xml3: %.adoc
|
21
|
+
#bundle exec asciidoctor -r ./lib/glob-include-processor.rb -r asciidoctor-rfc -b rfc2 $^ --trace > $@
|
22
|
+
bundle exec asciidoctor -r ./lib/glob-include-processor.rb -r asciidoctor-rfc -b rfc3 -a flush-biblio=true $^ --trace > $@
|
23
|
+
|
24
|
+
%.txt: %.xml
|
25
|
+
xml2rfc --text $^ $@
|
26
|
+
|
27
|
+
%.html: %.xml
|
28
|
+
xml2rfc --html $^ $@
|
29
|
+
|
30
|
+
%.nits: %.txt
|
31
|
+
VERSIONED_NAME=`grep :name: $*.adoc | cut -f 2 -d ' '`; \
|
32
|
+
cp $^ $${VERSIONED_NAME}.txt && \
|
33
|
+
idnits --verbose $${VERSIONED_NAME}.txt > $@ && \
|
34
|
+
cp $@ $${VERSIONED_NAME}.nits && \
|
35
|
+
cat $${VERSIONED_NAME}.nits
|
36
|
+
|
37
|
+
open:
|
38
|
+
open *.txt
|
39
|
+
|
data/README.adoc
ADDED
@@ -0,0 +1,882 @@
|
|
1
|
+
= AsciiISO: Asciidoctor processor for ISO standards
|
2
|
+
|
3
|
+
image:https://img.shields.io/gem/v/metanorma-iso.svg["Gem Version", link="https://rubygems.org/gems/metanorma-iso"]
|
4
|
+
image:https://img.shields.io/travis/riboseinc/metanorma-iso/master.svg["Build Status", link="https://travis-ci.org/riboseinc/metanorma-iso"]
|
5
|
+
image:https://codeclimate.com/github/riboseinc/metanorma-iso/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/riboseinc/metanorma-iso"]
|
6
|
+
|
7
|
+
WARNING: This gem is still under development.
|
8
|
+
|
9
|
+
== Functionality
|
10
|
+
|
11
|
+
This gem processes http://asciidoctor.org/[Asciidoctor] documents following
|
12
|
+
a template for generating ISO International Standards. The following
|
13
|
+
outputs are generated.
|
14
|
+
|
15
|
+
* (Optional) An HTML preview generated directly from the Asciidoctor document,
|
16
|
+
using native Asciidocot formatting.
|
17
|
+
** http://asciimath.org[AsciiMathML] is to be used for mathematical formatting.
|
18
|
+
The gem uses the https://github.com/asciidoctor/asciimath[Ruby AsciiMath parser],
|
19
|
+
which is syntactically stricter than the common MathJax processor;
|
20
|
+
if you do not get expected results, try bracketting terms your in AsciiMathML
|
21
|
+
expressions.
|
22
|
+
* an XML representation of the document, intended as a document model for ISO
|
23
|
+
International Standards.
|
24
|
+
* The XML representation is processed in turn to generate the following outputs
|
25
|
+
as end deliverable ISO standard drafts.
|
26
|
+
** Microsoft Word output (`.doc`), following the style conventions of the
|
27
|
+
https://www.iso.org/iso-templates.html[ISO Standard Microsoft Word template].
|
28
|
+
** HTML. For ISO, two HTML files are generated: the `.html` file follows ISO
|
29
|
+
conventions in rendering, which looks very similar to the Word output, while
|
30
|
+
the `-alt.html` file has richer styling.
|
31
|
+
** PDF. Not supported for the ISO gem, but available for other other specification,
|
32
|
+
generated from the HTML file.
|
33
|
+
|
34
|
+
This AsciiDoc syntax for writing ISO standards is hereby named "AsciiISO".
|
35
|
+
|
36
|
+
This README provides an overview of the functionality of the gem; see also
|
37
|
+
https://github.com/riboseinc/metanorma-iso/wiki/Guidance-for-authoring[Guidance for authoring]
|
38
|
+
ISO standards using the gem. The
|
39
|
+
https://github.com/riboseinc/metanorma-iso/wiki/Quickstart-Guide[Quickstart guide]
|
40
|
+
gives a summary overview.
|
41
|
+
|
42
|
+
== Usage
|
43
|
+
|
44
|
+
The preferred way to invoke this gem is via the `metanorma` script:
|
45
|
+
|
46
|
+
[source,console]
|
47
|
+
----
|
48
|
+
$ metanorma --type iso a.adoc # output HTML and DOC
|
49
|
+
$ metanorma --type csd --extensions html a.adoc # output just HTML
|
50
|
+
$ metanorma --type csd --extensions doc a.adoc # output just DOC
|
51
|
+
$ metanorma --type csd --extensions xml a.adoc # output CSD XML
|
52
|
+
----
|
53
|
+
|
54
|
+
The gem translates the document into ISO XML format, and then
|
55
|
+
validates its output against the ISO XML document model; errors are
|
56
|
+
reported to console against the XML, and are intended for users to
|
57
|
+
check that they have provided all necessary components of the
|
58
|
+
document.
|
59
|
+
|
60
|
+
The gem then converts the XML into HTML and DOC.
|
61
|
+
|
62
|
+
The gem can also be invoked directly within asciidoctor, though this is deprecated:
|
63
|
+
|
64
|
+
[source,console]
|
65
|
+
----
|
66
|
+
$ asciidoctor -b iso -r 'metanorma-iso' a.adoc
|
67
|
+
----
|
68
|
+
|
69
|
+
If you do not invoke the `iso` backend explicitly, the AsciiISO source will be
|
70
|
+
treated as generic Asciidoc markup, and will output an HTML preview that
|
71
|
+
ignores the ISO-specific modifications to the markup:
|
72
|
+
|
73
|
+
[source,console]
|
74
|
+
----
|
75
|
+
$ asciidoctor a.adoc
|
76
|
+
----
|
77
|
+
|
78
|
+
=== Installation
|
79
|
+
|
80
|
+
If you are using a Mac, the https://github.com/riboseinc/metanorma-macos-setup
|
81
|
+
repository has instructions on setting up your machine to run Metanorma
|
82
|
+
scripts such as this one. You need only run the following in a Terminal console:
|
83
|
+
|
84
|
+
[source,console]
|
85
|
+
----
|
86
|
+
$ bash <(curl -s https://raw.githubusercontent.com/riboseinc/metanorma-macos-setup/master/metanorma-setup)
|
87
|
+
$ gem install metanorma-iso
|
88
|
+
----
|
89
|
+
|
90
|
+
|
91
|
+
=== Content Warnings
|
92
|
+
|
93
|
+
The gem also realises several format
|
94
|
+
checks as prescribed in ISO/IEC DIR 2: 2018, and warns the user about them in the
|
95
|
+
console:
|
96
|
+
|
97
|
+
* Numbers with what looks like dots instead of commas for decimal points.
|
98
|
+
|
99
|
+
* Groups of numbers without spacing for every three digits. (The gem attempts
|
100
|
+
to ignore ISO references.)
|
101
|
+
|
102
|
+
* No space before percent sign.
|
103
|
+
|
104
|
+
* No bracketing of tolerance in percentage (e.g. `15 ± 7 % .`)
|
105
|
+
|
106
|
+
* No recommendations, permissions or requirements (detected by keyword) in:
|
107
|
+
foreword, scope, introduction, term examples and examples, notes, footnotes.
|
108
|
+
|
109
|
+
* No subclauses that are the only child of a clause. (In clauses, annexes, or
|
110
|
+
scopes.)
|
111
|
+
|
112
|
+
* 5 levels of subclause nesting. (Never actuated, AsciiDoc only permits 4
|
113
|
+
levels of subsections.)
|
114
|
+
|
115
|
+
* Non-ISO/IEC reference turning up as normative.
|
116
|
+
|
117
|
+
* Term definition starts with an article, or ends with a period.
|
118
|
+
|
119
|
+
* Title intro or title part appears in only one of French or English.
|
120
|
+
|
121
|
+
In addition, the gem checks all terms cited from the IEV Electropedia against
|
122
|
+
the online IEV Electropedia entry, and issues a warning if the term is different.
|
123
|
+
|
124
|
+
== Approach
|
125
|
+
=== Document model
|
126
|
+
|
127
|
+
The document model ("IsoDoc") used in document generation
|
128
|
+
intends to introduce rigour into the ISO
|
129
|
+
standards authoring process; the existing
|
130
|
+
https://www.iso.org/iso-templates.html[Microsoft Word template from ISO]
|
131
|
+
do not support such rigour down to the element level. It also introduces
|
132
|
+
flexibility by decoupling the document structure from its presentation.
|
133
|
+
|
134
|
+
The ISO International Standard format is prescribed in
|
135
|
+
http://www.iec.ch/members_experts/refdocs/iec/isoiecdir-2%7Bed7.0%7Den.pdf[ISO/IEC DIR 2 "Principles and rules for the structure and drafting of ISO and IEC documents"],
|
136
|
+
to a level amenable to an explicit document model. A formal document
|
137
|
+
model would allow checking for consistency in format and content, and expedite
|
138
|
+
authoring and quality control of ISO standards. Authoring standards through a
|
139
|
+
more abstract formal model also permit enhanced functionality such as
|
140
|
+
cross-reference link checking and auto-numbering of sections, figures, tables and formulas.
|
141
|
+
Outputting a document in different languages also becomes straightforward.
|
142
|
+
|
143
|
+
The document model for ISO Standards specifically is derived from a more general
|
144
|
+
https://github.com/riboseinc/isodoc-models[StandardDocument model]. Other
|
145
|
+
ISO-like standards can also be derived from this more general model;
|
146
|
+
CSD (https://github.com/riboseinc/csd, https://github.com/riboseinc/metanorma-csd)
|
147
|
+
is one such instance.
|
148
|
+
|
149
|
+
The document model for ISO Standards contains all the structures described
|
150
|
+
in ISO/IEC DIR 2. It is expressed as a
|
151
|
+
link:lib/metanorma/iso/isostandard.rnc[Relax NG Compact schema]; actual
|
152
|
+
validation occurs against its link:lib/metanorma/iso/isostandard.rng[full Relax
|
153
|
+
NG counterpart].
|
154
|
+
|
155
|
+
=== Asciidoctor
|
156
|
+
|
157
|
+
Asciidoctor has been selected as the authoring tool to generate the document
|
158
|
+
model representation of ISO standards. It is a document formatting tool like
|
159
|
+
Markdown and DocBook, which combines the relative ease of use of the former
|
160
|
+
(using relatively lightweight markup), and the rigour and expressively of the
|
161
|
+
latter (it has a well-defined syntax, and was in fact initially developed as a
|
162
|
+
DocBook document authoring tool). Asciidoctor has built-in capability to output
|
163
|
+
Text and HTML; so it can be used to preview the file as it is being
|
164
|
+
authored. However the gem natively outputs HTML and Word output, so there should
|
165
|
+
not be much need for this.
|
166
|
+
|
167
|
+
In order to generate HTML preview output close to what is intended
|
168
|
+
in the ISO standard, the Asciidoc
|
169
|
+
document includes a fair amount of formatting instructions (e.g. disabling
|
170
|
+
section numbering where appropriate, the titling of Appendixes as Annexes), as
|
171
|
+
well as ISO boilerplate text, and predefined section headers (sections are
|
172
|
+
recognised by fixed titles such as `Normative References`). Authoring ISO
|
173
|
+
standards in this fashion assumes that users will be populating an Asciidoc
|
174
|
+
template, and not removing needed formatting instructions.
|
175
|
+
|
176
|
+
Asciidoctor has some formatting constraints because of its own document model,
|
177
|
+
that users need to be aware. For example, Asciidoc has a strict division between
|
178
|
+
inline and block elements, which disallows certain kinds of nesting; so a list
|
179
|
+
cannot be embedded within a paragraph, it can only constitute its own paragraph
|
180
|
+
(though lists themselves can be nested within each other). Asciidoctor also disallows
|
181
|
+
multiple paragraphs in footnotes,
|
182
|
+
http://discuss.asciidoctor.org/footnotes-with-paragraph-breaks-td4130.html[by design].
|
183
|
+
(The document model does not impose this constraint, so you could edit the generated
|
184
|
+
XML to break up paragraphs within a footnote.)
|
185
|
+
|
186
|
+
[[model_additions]]
|
187
|
+
== Asciidoctor model additions
|
188
|
+
|
189
|
+
=== Section titles
|
190
|
+
ISO has special section types: "Scope", "Normative References", "Terms and Definitions", "Symbols and Abbreviated Terms", "Bibliography". By default, these are identified in Asciidoc by using those titles. The gem allows you to override the title by using a `heading` attribute on the node, so that the actual title in your Asciidoc can be something different; that is useful, for example, if you are translating the document into different languages. So:
|
191
|
+
|
192
|
+
[source,asciidoctor]
|
193
|
+
--
|
194
|
+
[heading=scope]
|
195
|
+
== 范围
|
196
|
+
--
|
197
|
+
|
198
|
+
Note that both the XML population, and the isodoc gem will overwrite any supplied title. If you are translating ISO documents into other languages, you will still need access to versions of the metanorma-iso and isodoc gems in those languages.
|
199
|
+
|
200
|
+
=== Obligation
|
201
|
+
The obligation of sections (whether they are normative or informative) is indicated
|
202
|
+
with the attribute "obligation". For most sections, this is fixed; for annexes and clauses, the
|
203
|
+
default value of the obligation is "normative", and users need to set the obligation
|
204
|
+
to "informative" as a section attribute.
|
205
|
+
|
206
|
+
[source,asciidoctor]
|
207
|
+
--
|
208
|
+
[[AnnexA]]
|
209
|
+
[appendix,obligation=informative]
|
210
|
+
== Determination of defects
|
211
|
+
--
|
212
|
+
|
213
|
+
=== Term markup
|
214
|
+
|
215
|
+
To ensure the structure of Terms and Definitions is captured accurately, the following
|
216
|
+
macros are defined, and must be used to mark up their respective content:
|
217
|
+
|
218
|
+
`alt:[TERM]`:: for alternative terms
|
219
|
+
`deprecated:[TERM]`:: for deprecated terms
|
220
|
+
`domain:[TERM]`:: for term domains
|
221
|
+
|
222
|
+
The macro contents can contain their own markup.
|
223
|
+
|
224
|
+
[source,asciidoctor]
|
225
|
+
--
|
226
|
+
=== paddy
|
227
|
+
alt:[_paddy_ rice]
|
228
|
+
deprecated:[#[smallcap]#cargo# rice]
|
229
|
+
domain:[rice]
|
230
|
+
|
231
|
+
_paddy_ (<<paddy>>) from which the husk only has been removed
|
232
|
+
--
|
233
|
+
|
234
|
+
=== Terms and Definitions markup
|
235
|
+
|
236
|
+
If the Terms and Definitions of a standard are partly or fully sourced from
|
237
|
+
another standard, that standard is cited in a `source` attribute to the section,
|
238
|
+
which is set to the reference anchor of the standard (given under the Normative
|
239
|
+
Referencecs)..
|
240
|
+
The boilerplate of the Terms and Definitions section is adjusted accordingly.
|
241
|
+
|
242
|
+
[source,asciidoctor]
|
243
|
+
--
|
244
|
+
[source=ISO712]
|
245
|
+
== Terms and Definitions
|
246
|
+
--
|
247
|
+
|
248
|
+
Multiple sources are allowed, and need to be quoted and comma-delimited:
|
249
|
+
|
250
|
+
[source,asciidoctor]
|
251
|
+
--
|
252
|
+
[source="ISO712,ISO24333"]
|
253
|
+
== Terms and Definitions
|
254
|
+
--
|
255
|
+
|
256
|
+
|
257
|
+
=== Paragraph alignment
|
258
|
+
|
259
|
+
Alignment is defined as an attribute for paragraphs:
|
260
|
+
|
261
|
+
[source,asciidoctor]
|
262
|
+
--
|
263
|
+
[align=left]
|
264
|
+
This paragraph is aligned left
|
265
|
+
|
266
|
+
[align=right]
|
267
|
+
This paragraph is aligned right
|
268
|
+
|
269
|
+
[align=center]
|
270
|
+
This paragraph is aligned center
|
271
|
+
|
272
|
+
[align=justified]
|
273
|
+
This paragraph is justified, which is the default
|
274
|
+
--
|
275
|
+
|
276
|
+
=== Reviewer notes
|
277
|
+
|
278
|
+
Reviewer notes are encoded as sidebars, and can be separated at a distance from the
|
279
|
+
text they are annotating; the text they are annotating is indicated through anchors.
|
280
|
+
Reviewer notes are only rendered if the document has a `:draft:` attribute.
|
281
|
+
|
282
|
+
The following attributes on reviewer notes are mandatory:
|
283
|
+
|
284
|
+
* `reviewer` attribute (naming the reviewer)
|
285
|
+
* the starting target anchor of the note (`from` attribute)
|
286
|
+
|
287
|
+
The following attributes are optional:
|
288
|
+
|
289
|
+
* `date` attribute, optionally including the time (as xs:date or xs:datetime)
|
290
|
+
* the ending target anchor of the note (`to` attribute)
|
291
|
+
|
292
|
+
The span of text covered by the reviewer note is from the start of the
|
293
|
+
text encompassed by the `from` element, to the end of the text encompassed
|
294
|
+
by the `to` element. If only the `from` element supplied, the reviewer note
|
295
|
+
covers the `from` element. The `from` and `to` elements can be bookmarks,
|
296
|
+
which cover no space.
|
297
|
+
|
298
|
+
[source,asciidoctor]
|
299
|
+
--
|
300
|
+
[[clause_address_profile_definition]]
|
301
|
+
=== Address Profile Definition (AddressProfileDescription)
|
302
|
+
|
303
|
+
[[para1]]
|
304
|
+
This is a clause address [[A]]profile[[B]] definition
|
305
|
+
|
306
|
+
[reviewer="Nick Nicholas",date=20180125T0121,from=clause_address_profile_definition,to=para1]
|
307
|
+
****
|
308
|
+
I do not agree with this statement.
|
309
|
+
****
|
310
|
+
|
311
|
+
[reviewer="Nick Nicholas",date=20180125T0121,from=A,to=B]
|
312
|
+
****
|
313
|
+
Profile?!
|
314
|
+
****
|
315
|
+
--
|
316
|
+
|
317
|
+
=== Strikethrough and Small Caps
|
318
|
+
|
319
|
+
The following formatting macros are used for strikethrough and small caps text:
|
320
|
+
|
321
|
+
[source,asciidoctor]
|
322
|
+
--
|
323
|
+
[strike]#strike through text#
|
324
|
+
[smallcap]#small caps text#
|
325
|
+
--
|
326
|
+
|
327
|
+
=== Count of table header and footer rows
|
328
|
+
|
329
|
+
In Asciidoc, a table can have at most one header row or footer row. In ISO,
|
330
|
+
a nominal single header row is routinely broken up into multiple rows in order
|
331
|
+
to accommodate units or symbols, that line up against each other, though
|
332
|
+
they are displayed as merged cells with no grid between them. To address this,
|
333
|
+
tables can be marked up with an optional `headerrows` attribute:
|
334
|
+
|
335
|
+
[source,asciidoctor]
|
336
|
+
--
|
337
|
+
[headerrows=2]
|
338
|
+
|===
|
339
|
+
.2+|Defect 4+^| Maximum permissible mass fraction of defects in husked rice +
|
340
|
+
stem:[w_max]
|
341
|
+
| in husked rice | in milled rice (non-glutinous) | in husked parboiled rice | in milled parboiled rice
|
342
|
+
|
343
|
+
| Extraneous matter: organic footnote:[Organic extraneous matter includes foreign seeds, husks, bran, parts of straw, etc.] | 1,0 | 0,5 | 1,0 | 0,5
|
344
|
+
|===
|
345
|
+
--
|
346
|
+
|
347
|
+
=== Inline clause numbers
|
348
|
+
|
349
|
+
For some clauses (notably test methods), the clause heading appears inline with the clause, instead of being separated on a different line. This is indicated in Asciidoc by the option
|
350
|
+
attribute `inline-header`:
|
351
|
+
|
352
|
+
[source,asciidoctor]
|
353
|
+
--
|
354
|
+
[%inline-header]
|
355
|
+
[[AnnexA-2-1]]
|
356
|
+
==== Sample divider,
|
357
|
+
|
358
|
+
consisting of a conical sample divider
|
359
|
+
--
|
360
|
+
|
361
|
+
=== Bibliographic details
|
362
|
+
|
363
|
+
Citations can include details of where in the document the citation is located; these
|
364
|
+
are entered by suffixing the type of locality, then an equals sign, then the reference.
|
365
|
+
The word "whole" on its own is also treated as a locality. Multiple
|
366
|
+
instances of locality and reference can be provided, delimited by comma or colon. Any trailing
|
367
|
+
text after the sequence of locality=reference (or locality, space, reference) are treated
|
368
|
+
as substitute text, as would occur normally in an Asciidoctor crossreference. For
|
369
|
+
example:
|
370
|
+
|
371
|
+
[source,asciidoctor]
|
372
|
+
--
|
373
|
+
<<ISO712,the foregoing reference>> # renders as: the foregoing reference
|
374
|
+
<<ISO712,section=5, page 8-10>> # renders as: ISO 712, Section 5, Page 8-10
|
375
|
+
<<ISO712,section=5, page=8-10: 5:8-10>> # renders as ISO 712, 5:8-10 ("5:8-10" treated as replacement text for all the foregoing)
|
376
|
+
<<ISO712,whole>> # renders as: ISO 712, Whole of text
|
377
|
+
--
|
378
|
+
|
379
|
+
The references cannot contain spaces. Any text following the sequence of localities
|
380
|
+
will be displayed instead of the localities.
|
381
|
+
|
382
|
+
A custom locality can be entered by prefixing it with `locality:`:
|
383
|
+
|
384
|
+
[source,asciidoctor]
|
385
|
+
--
|
386
|
+
<<ISO712,locality:frontispiece=5, page=8-10>> # renders as: ISO 712, Frontispiece 5, Page 8-10
|
387
|
+
--
|
388
|
+
|
389
|
+
Custom localities may not contain commas, colons, or space. Localities with the `locality:`
|
390
|
+
prefix are recognised in internationalisation configuration files.
|
391
|
+
|
392
|
+
=== Additional warning types
|
393
|
+
|
394
|
+
Asciidoctor natively supports the ISO admonitions "Caution", "Warning", and "Important"
|
395
|
+
through its admonition syntax:
|
396
|
+
|
397
|
+
[source,asciidoctor]
|
398
|
+
--
|
399
|
+
CAUTION: This is a single-block caution
|
400
|
+
|
401
|
+
[WARNING]
|
402
|
+
====
|
403
|
+
This is a
|
404
|
+
|
405
|
+
multiple-block warning
|
406
|
+
====
|
407
|
+
--
|
408
|
+
|
409
|
+
If the admonitions "Danger" and "Safety Precaution" are needed, they should be indicated
|
410
|
+
through a `type` attribute, which will override the admonition type appearing in the Asciidoc:
|
411
|
+
|
412
|
+
[source,asciidoctor]
|
413
|
+
--
|
414
|
+
[type=Danger]
|
415
|
+
CAUTION: This is a single-block caution
|
416
|
+
|
417
|
+
[WARNING,type=Safety Precaution]
|
418
|
+
====
|
419
|
+
This is a
|
420
|
+
|
421
|
+
multiple-block warning
|
422
|
+
====
|
423
|
+
--
|
424
|
+
|
425
|
+
=== Block Quotes
|
426
|
+
|
427
|
+
As in normal Asciidoctor, block quotes are preceded with an author and a citation;
|
428
|
+
but the citation is expected to be in the same format as all other citations,
|
429
|
+
a cross-reference optionally followed by text, which may include the bibliographic
|
430
|
+
sections referenced:
|
431
|
+
|
432
|
+
[source,asciidoctor]
|
433
|
+
--
|
434
|
+
[quote, ISO, "ISO7301,section 1"]
|
435
|
+
_____
|
436
|
+
This International Standard gives the minimum specifications for rice (_Oryza sativa_ L.)
|
437
|
+
which is subject to international trade. It is applicable to the following types: husked rice
|
438
|
+
and milled rice, parboiled or not, intended for direct human consumption. It is neither
|
439
|
+
applicable to other products derived from rice, nor to waxy rice (glutinous rice).
|
440
|
+
_____
|
441
|
+
--
|
442
|
+
|
443
|
+
=== Image size
|
444
|
+
|
445
|
+
The value `auto` is accepted for image width and height attributes. It is only passed on
|
446
|
+
to HTML output; if the output is to Word, both the width and height attributes are stripped
|
447
|
+
from the image.
|
448
|
+
|
449
|
+
[source,asciidoctor]
|
450
|
+
--
|
451
|
+
[height=90,width=auto]
|
452
|
+
image::logo.jpg
|
453
|
+
--
|
454
|
+
|
455
|
+
=== Sections embedded more than 5 levels
|
456
|
+
|
457
|
+
Asciidoctor permits only 5 levels of section embedding (not counting the document title).
|
458
|
+
Standards do contain more levels of embedding; ISO/IEC DIR 2 only considers it a problem
|
459
|
+
if there are more than 7 levels of embedding. To realise higher levels of embedding,
|
460
|
+
prefix a 5-level section title with the attribute `level=`:
|
461
|
+
|
462
|
+
[source,asciidoctor]
|
463
|
+
--
|
464
|
+
====== Clause 5
|
465
|
+
|
466
|
+
[level=6]
|
467
|
+
===== Clause 6
|
468
|
+
|
469
|
+
[level=7]
|
470
|
+
====== Clause 7A
|
471
|
+
|
472
|
+
[level=7]
|
473
|
+
====== Clause 7B
|
474
|
+
|
475
|
+
[level=6]
|
476
|
+
====== Clause 6B
|
477
|
+
|
478
|
+
====== Clause 5B
|
479
|
+
--
|
480
|
+
|
481
|
+
This generates the following ISO XML:
|
482
|
+
|
483
|
+
[source,xml]
|
484
|
+
--
|
485
|
+
<clause id="_" inline-header="false" obligation="normative">
|
486
|
+
<title>
|
487
|
+
Clause 5
|
488
|
+
</title>
|
489
|
+
<clause id="_" inline-header="false" obligation="normative">
|
490
|
+
<title>
|
491
|
+
Clause 6
|
492
|
+
</title>
|
493
|
+
<clause id="_" inline-header="false" obligation="normative">
|
494
|
+
<title>
|
495
|
+
Clause 7A
|
496
|
+
</title>
|
497
|
+
</clause>
|
498
|
+
<clause id="_" inline-header="false" obligation="normative">
|
499
|
+
<title>
|
500
|
+
Clause 7B
|
501
|
+
</title>
|
502
|
+
</clause>
|
503
|
+
</clause>
|
504
|
+
<clause id="_" inline-header="false" obligation="normative">
|
505
|
+
<title>
|
506
|
+
Clause 6B
|
507
|
+
</title>
|
508
|
+
</clause>
|
509
|
+
</clause>
|
510
|
+
<clause id="_" inline-header="false" obligation="normative">
|
511
|
+
<title>
|
512
|
+
Clause 5B
|
513
|
+
</title>
|
514
|
+
</clause>
|
515
|
+
--
|
516
|
+
|
517
|
+
=== PlantUML
|
518
|
+
|
519
|
+
The http://plantuml.com[PlantUML] diagramming tool is integrated with Asciidoctor
|
520
|
+
in this gem, as a literal block with the style attribute `plantuml`:
|
521
|
+
|
522
|
+
[source,asciidoctor]
|
523
|
+
--
|
524
|
+
[plantuml]
|
525
|
+
....
|
526
|
+
@startuml
|
527
|
+
Alice -> Bob: Authentication Request
|
528
|
+
Bob --> Alice: Authentication Response
|
529
|
+
|
530
|
+
Alice -> Bob: Another authentication Request
|
531
|
+
Alice <-- Bob: another authentication Response
|
532
|
+
@enduml
|
533
|
+
....
|
534
|
+
--
|
535
|
+
|
536
|
+
The integration runs PlantUML for each such block, generating a PNG image.
|
537
|
+
The images are stored in the `plantuml` directory, and linked into the output
|
538
|
+
document in place of the PlantUML.
|
539
|
+
|
540
|
+
PlantUML needs to be installed by users separately, and accesssible from the
|
541
|
+
command line:
|
542
|
+
|
543
|
+
* `brew install plantuml` on MacOS.
|
544
|
+
* For Linux, link the PlantUML jar file into a command line executable; see
|
545
|
+
`.travis.yml` for an example.
|
546
|
+
|
547
|
+
If PlantUML is not installed locally, the source PlantUML is incorporated into
|
548
|
+
the output document as sourcecode.
|
549
|
+
|
550
|
+
=== Features not visible in HTML preview
|
551
|
+
|
552
|
+
The gem uses built-in Asciidoc formatting as much as possible, so that users
|
553
|
+
can retain the ability to preview documents; for _Terms and Definitions_
|
554
|
+
clauses, which have a good deal of explicit structure, macros have been
|
555
|
+
introduced for semantic markup (admitted terms, deprecated terms, etc).
|
556
|
+
|
557
|
+
The default HTML output of an Asciidoc-formatted ISO document is quite close to the
|
558
|
+
intended final output, with the following exceptions, and with the additional
|
559
|
+
exceptions listed <<model_additions,above>> as markup introduced for ISO markup.
|
560
|
+
Note that the final
|
561
|
+
outputs of the conversion (Microsoft Word, PDF, HTML) do not have these exceptions,
|
562
|
+
and comply with the ISO Standard specifications.
|
563
|
+
|
564
|
+
* _Terms and Definitions_: each term is marked up as an unnumbered subclause,
|
565
|
+
the semantic markup of alternate and other terms is not rendered visually.
|
566
|
+
|
567
|
+
* _Formulas_: Asciidoctor has no provision for the automated numbering of
|
568
|
+
isolated block formulas ("stem"), and does not display the number assigned a
|
569
|
+
block formula in its default HTML processor—although it does provide automated
|
570
|
+
numbering of examples. Formula numbering is provided in the final outputs
|
571
|
+
of the conversion.
|
572
|
+
|
573
|
+
* _Missing elements_: The document model does not yet include Asciidoc elements
|
574
|
+
that do not appear to be relevant to ISO Standards; these will be ignored in
|
575
|
+
generating ISO XML. Those elements include:
|
576
|
+
** sidebars (`aside`) (as distinct from warnings),
|
577
|
+
** ASCII art/preformatted text (`literal`) (as distinct from sourcecode listings),
|
578
|
+
** page breaks (`thematic break`).
|
579
|
+
|
580
|
+
* _Markup_: Some connecting text which is used to convey markup structure is
|
581
|
+
left out: in particular, `DEPRECATED` and `SOURCE` (replaced by formatting
|
582
|
+
macros).
|
583
|
+
|
584
|
+
* _Tables_: Table footnotes are treated like all other footnotes: they are
|
585
|
+
rendered at the bottom of the document, rather than the bottom of the table,
|
586
|
+
and they are not numbered separately.
|
587
|
+
|
588
|
+
* _Cross-references_: Footnoted cross-references are indicated with the reference
|
589
|
+
text `fn` in isolation, or `fn:` as a prefix to the reference text. The default
|
590
|
+
HTML processor leaves these as is: if no reference text is given, only `fn`
|
591
|
+
will be displayed (though it will still hyperlink to the right reference).
|
592
|
+
|
593
|
+
* _References_: The convention for references is that ISO documents are cited
|
594
|
+
without brackets by ISO number, and optionally year, whether they are normative
|
595
|
+
or in the bibliography (e.g. `ISO 20483:2013`); while all other references are
|
596
|
+
cited by bracketed number in the bibliography (e.g. `[1]`). The default HTML
|
597
|
+
processor treats all references the same, and will bracket them (e.g. `[ISO
|
598
|
+
20483:2013]`). For the same reason, ISO references listed in the bibliography
|
599
|
+
will be listed under an ISO reference, rather than a bracketed number.
|
600
|
+
|
601
|
+
* _References_: References are rendered cited throughout, since they are
|
602
|
+
automated. For that reason, if reference is to be made to both an undated and a
|
603
|
+
dated version of an ISO reference, these need to be explicitly listed as
|
604
|
+
separate references. (This is not done in the Rice model document, which lists
|
605
|
+
ISO 6646, but under _Terms and Definitions_ cites the dated ISO 6646:2011.
|
606
|
+
|
607
|
+
* _References_: ISO references that are undated but published have their date
|
608
|
+
indicated under the ISO standards format in an explanatory footnote. Because of
|
609
|
+
constraints introduced by Asciidoctor, that explanation is instead given in
|
610
|
+
square brackets in Asciidoc format.
|
611
|
+
|
612
|
+
* _Annexes_: Subheadings cannot preserve subsection numbering, while also
|
613
|
+
appearing inline with their text (e.g. Rice document, Annex B.2): they appear
|
614
|
+
as headings in separate lines.
|
615
|
+
|
616
|
+
* _Annexes_: Cross-references to Annex subclauses are automatically prefixed
|
617
|
+
with `Clause` rather than `Annex` or nothing.
|
618
|
+
|
619
|
+
* _Metadata_: Document metadata such as document numbers, technical committees
|
620
|
+
and title wording are not rendered in the default HTML output.
|
621
|
+
|
622
|
+
* _Patent Notice_: Patent notices are treated and rendered as a subsection of
|
623
|
+
the introduction, with an explicit subheading.
|
624
|
+
|
625
|
+
* _Numbering_: The numbering of figures and tables is sequential in the default
|
626
|
+
HTML processor: it does not include the Clause or Annex number. This,
|
627
|
+
_Figure 1_, not _Figure A.1_.
|
628
|
+
|
629
|
+
* _Notes_: There is no automatic note numbering by the default HTML processor.
|
630
|
+
|
631
|
+
* _Review Notes_: The reviewer on the review note is not displayed.
|
632
|
+
|
633
|
+
* _Keys_: Keys to formulas and figures are expected to be marked up as
|
634
|
+
definition lists consistently, rather than as inline prose.
|
635
|
+
|
636
|
+
* _Figures_: Simple figures are marked up as images, figures containing
|
637
|
+
subfigures as examples. Numbering by the default HTML processor may be
|
638
|
+
inconsistent. Subfigures are automatically numbered as independent figures.
|
639
|
+
|
640
|
+
* _Markup_: The default HTML processor does not support CSS extensions such as
|
641
|
+
small caps or strike through, though these can be marked up as CSS classes
|
642
|
+
through custom macros in Asciidoctor: a custom CSS stylesheet will be needed to
|
643
|
+
render them.
|
644
|
+
|
645
|
+
== Bibliography integration
|
646
|
+
|
647
|
+
Bibliographic entries for ISO standards are expected to use the standard document
|
648
|
+
identifier as the item label; e.g.
|
649
|
+
|
650
|
+
[source,asciidoctor]
|
651
|
+
--
|
652
|
+
* [[[ref1,ISO 712]]], _Cereals and cereal products -- Determination of moisture content -- Reference method_
|
653
|
+
--
|
654
|
+
|
655
|
+
By default, the `isobib` gem is used to look up the reference details for
|
656
|
+
any item label prefixed with `ISO` on the ISO web site. The full bibliographic details
|
657
|
+
of the item are screenscraped from the ISO site and inserted into the XML file
|
658
|
+
(although only the title of the reference is used in rendering). The
|
659
|
+
http://www.electropedia.org[Electropedia] termbank is queried in validation, to confirm
|
660
|
+
that the cited entries in Terms and Definitions are the same as what is cited online;
|
661
|
+
those queries are routed through the `iev` gem
|
662
|
+
|
663
|
+
[[cache]]
|
664
|
+
The results of all `isobib` searches done to date, across all documents,
|
665
|
+
are cached in the global cache file `~/.relaton-bib.pstore`,
|
666
|
+
so they do not need to be re-fetched each time a document is processed.
|
667
|
+
(The web query takes a few seconds per reference.)
|
668
|
+
|
669
|
+
The results of all `isobib` searches done to date for the current document
|
670
|
+
(`filename.adoc`) are stored in the same directory as the current document,
|
671
|
+
in the file `{filename}.relaton.pstore`. The local cache overrides entries in
|
672
|
+
the global cache, and can be manually edited. The local cache is only used
|
673
|
+
if the `:local-cache:` document attribute is set.
|
674
|
+
|
675
|
+
If the document attribute `:no-isobib:` is set, the reference details for
|
676
|
+
items are not looked up via `isobib`, and the `isobib` caches are not used.
|
677
|
+
If the document attribute `:no-isobib-cache:` is set, the reference details for
|
678
|
+
items are still looked up via `isobib`, but the `isobib` caches are not used.
|
679
|
+
|
680
|
+
Any entry in the cache that corresponds to an undated ISO reference fetches its details
|
681
|
+
from the latest available entry on the ISO web site. If the entry is more than 60
|
682
|
+
days old, it is refetched.
|
683
|
+
|
684
|
+
The results of all `iev` searches done to date across all documents are cached
|
685
|
+
in the global cache fule `~/iev.pstore`, and the results of all `iev` searches
|
686
|
+
done to date for the current document are stored in the same directory as the
|
687
|
+
current document, in the file `(filename).iev.pstore`.
|
688
|
+
|
689
|
+
== Document Attributes
|
690
|
+
|
691
|
+
The gem relies on Asciidoctor document attributes to provide necessary
|
692
|
+
metadata about the document. These include:
|
693
|
+
|
694
|
+
`:nodoc:`:: Do not generate Word and HTML output, only generate XML output.
|
695
|
+
Can be used as a command-line option (like all other document attributes):
|
696
|
+
`asciidoctor -a nodoc -b iso -r "metanorma-iso" a.adoc`
|
697
|
+
|
698
|
+
`:novalid:`:: Suppress validation.
|
699
|
+
|
700
|
+
`:flush-caches:`:: If set, delete and reinitialise the <<cache,cache>> of `isobib` searches
|
701
|
+
for ISO references from the ISO web site.
|
702
|
+
|
703
|
+
`:no-isobib:`:: If set, do not use the `isobib` or `iev` gem functionality to look up
|
704
|
+
ISO and IEV references online, nor the <<cache,cache>> of `isobib` and `iev` searches.
|
705
|
+
|
706
|
+
`:no-isobib-cache:`:: If set, use the `isobib` and `iev` gem functionality to look up
|
707
|
+
ISO and IEV references online, but do not use the <<cache,cache>> of `isobib` and `iev` searches.
|
708
|
+
|
709
|
+
`:local-cache:`:: Use the local isobib and iev search caches to override the global isobib and iev search
|
710
|
+
caches.
|
711
|
+
|
712
|
+
`:i18nyaml:`:: Name of YAML file of internationalisation text, to use instead
|
713
|
+
of the built-in English, French or Chinese text used to label parts of the document
|
714
|
+
(e.g. "Table", "Foreword", boilerplate text for Normative References, etc.)
|
715
|
+
Use if you wish to output an ISO standard in a language other than those three.
|
716
|
+
A sample YAML file for English, with "Foreword" replaced with "Frontispiece",
|
717
|
+
is available at link:spec/examples/english.yaml[].
|
718
|
+
|
719
|
+
`:docnumber:`:: The ISO document number (mandatory)
|
720
|
+
|
721
|
+
`:tc-docnumber:`:: The document number assigned by the Technical committee
|
722
|
+
|
723
|
+
`:partnumber:`:: The ISO document part number. (This can be "part-subpart" if this is an IEC document.)
|
724
|
+
|
725
|
+
`:edition:`:: The document edition
|
726
|
+
|
727
|
+
`:revdate:`:: The date the document was last updated
|
728
|
+
|
729
|
+
`:draft:`:: The document draft (used in addition to document stage, for multiple iterations: expected format _X.Y_)
|
730
|
+
|
731
|
+
`:copyright-year:`:: The year which will be claimed as when the copyright for
|
732
|
+
the document was issued
|
733
|
+
|
734
|
+
`:library-ics:` :: The ICS (International Categorization for Standards) number for the standard. There may be more than one ICS for a document; if so, they should be comma-delimited. (The ics identifier is added to the document metadata, but is not output to the current document templates.)
|
735
|
+
|
736
|
+
`:title-intro-en:`:: The introductory component of the English title of the
|
737
|
+
document
|
738
|
+
|
739
|
+
`:title-main-en:`:: The main component of the English title of the document
|
740
|
+
(mandatory). (The first line of the AsciiDoc document, which contains the title
|
741
|
+
introduced with `=`, is ignored)
|
742
|
+
|
743
|
+
`:title-part-en:`:: The English title of the document part
|
744
|
+
|
745
|
+
`:title-intro-fr:`:: The introductory component of the French title of the
|
746
|
+
document. (This document template presupposes authoring in English; a different
|
747
|
+
template will be needed for French, including French titles of document
|
748
|
+
components such as annexes.)
|
749
|
+
|
750
|
+
`:title-main-fr:`:: The main component of the French title of the document
|
751
|
+
(mandatory).
|
752
|
+
|
753
|
+
`:title-part-fr:`:: The French title of the document part
|
754
|
+
|
755
|
+
`:doctype:`:: The document type (see
|
756
|
+
https://www.iso.org/deliverables-all.html[ISO deliverables: The different types of ISO publications]
|
757
|
+
) (mandatory). The permitted types are:
|
758
|
+
`international-standard, technical-specification, technical-report,
|
759
|
+
publicly-available-specification, international-workshop-agreement, guide`.
|
760
|
+
|
761
|
+
`:docstage:`:: The stage code for the document status (see
|
762
|
+
https://www.iso.org/stage-codes.html[International harmonized stage codes])
|
763
|
+
|
764
|
+
`:docsubstage:`:: The substage code for the document status (see
|
765
|
+
https://www.iso.org/stage-codes.html[International harmonized stage codes])
|
766
|
+
|
767
|
+
`:iteration:`:: The iteration of a stage, in case there have been multiple drafts
|
768
|
+
(e.g. `2` on a `CD`: this is the second iteration through the `CD` stage).
|
769
|
+
|
770
|
+
`:secretariat:`:: The national body acting as the secretariat for the document
|
771
|
+
in the deafting stage
|
772
|
+
|
773
|
+
`:technical-committee-number:`:: The number of the relevant ISO technical
|
774
|
+
committee
|
775
|
+
|
776
|
+
`:technical-committee-type:``:: The type of the relevant technical committee. Defaults
|
777
|
+
to `TC` if not supplied. Values: `TC1, `PC`, `JTC`, `JPC`.
|
778
|
+
|
779
|
+
`:technical-committee:`:: The name of the relevant ISO technical committee
|
780
|
+
(mandatory)
|
781
|
+
|
782
|
+
`:subcommittee-number:`:: The number of the relevant ISO subcommittee
|
783
|
+
|
784
|
+
`:subcommittee-type:`:: The type of the relevant ISO subcommittee. Defaults to
|
785
|
+
`SC` if not supplied. Values: `SC`, `JSC`.
|
786
|
+
|
787
|
+
`:subcommittee:`:: The name of the relevant ISO subcommittee
|
788
|
+
|
789
|
+
`:workgroup-number:`:: The number of the relevant ISO workgroup
|
790
|
+
|
791
|
+
`:workgroup-type:`:: The type of the relevant ISO workgroup. Defaults to `WG` if
|
792
|
+
not supplied. Example values: `JWG`, `JAG`, `AG` (advisory group), `AHG`, `SWG`,
|
793
|
+
`SG`, `MA` (maintenance agency), `CORG`, `JCG`, `CAG`
|
794
|
+
|
795
|
+
`:workgroup:`:: The name of the relevant ISO workgroup
|
796
|
+
|
797
|
+
`:language:` :: The language of the document (`en` or `fr`). Defaults to `en`.
|
798
|
+
|
799
|
+
`:script:` :: The script of the document (defaults to `Latn`). Must be supplied as
|
800
|
+
`Hans` for Simplified Chinese.
|
801
|
+
|
802
|
+
`:publisher:`:: The standards agency publishing the standard; can be multiple
|
803
|
+
(comma-delimited). Defaults to `ISO`.
|
804
|
+
|
805
|
+
`:body-font:`:: Font for body text; will be inserted into CSS. Defaults to
|
806
|
+
Cambria for Latin script, SimSun for Simplified Chinese.
|
807
|
+
|
808
|
+
`:header-font:`:: Font for headers; will be inserted into CSS. Defaults to
|
809
|
+
Cambria for Latin script, SimHei for Simplified Chinese.
|
810
|
+
|
811
|
+
`:monospace-font`:: Font for monospace; will be inserted into CSS. Defaults to
|
812
|
+
Courier New.
|
813
|
+
|
814
|
+
`:htmlstylesheet`:: SCSS stylesheet to use for HTML output. Defaults to built in stylesheet,
|
815
|
+
which adheres with ISO formatting requirements. Recommend against overriding this.
|
816
|
+
|
817
|
+
`:htmlcoverpage`:: HTML template for cover page. Defaults to built in template. Recommend against overriding this.
|
818
|
+
|
819
|
+
`:htmlintropage`:: HTML template for introductory section. Defaults to built in template. Recommend against overriding this.
|
820
|
+
|
821
|
+
`:scripts`:: Javascript scripts for HTML output. Defaults to built in scripts. Recommend against overriding this.
|
822
|
+
|
823
|
+
`:wordstylesheet`:: Primary SCSS stylesheet to use for Word output. Defaults to built in stylesheet,
|
824
|
+
which adheres with ISO formatting requirements. Recommend against overriding this.
|
825
|
+
|
826
|
+
`:standardstylesheet`:: Secondary SCSS stylesheet use for Word output. Defaults to built in stylesheet,
|
827
|
+
which adheres with ISO formatting requirements. Recommend against overriding this.
|
828
|
+
|
829
|
+
`:header`:: Header and footer file for Word output. Defaults to built in template. Recommend against overriding this.
|
830
|
+
|
831
|
+
`:wordcoverpage`:: Word template for cover page. Defaults to built in template. Recommend against overriding this.
|
832
|
+
|
833
|
+
`:wordintropage`:: Word template for introductory section. Defaults to built in template. Recommend against overriding this.
|
834
|
+
|
835
|
+
`:ulstyle`:: Word CSS selector for unordered lists in supplied stylesheets. Defaults to value for built in stylesheet. Recommend against overriding this.
|
836
|
+
|
837
|
+
`:olstyle`:: Word CSS selector for ordered lists in supplied stylesheets. Defaults to value for built in stylesheet. Recommend against overriding this.
|
838
|
+
|
839
|
+
|
840
|
+
The attribute `:draft:`, if present, includes review notes in the XML output;
|
841
|
+
these are otherwise suppressed.
|
842
|
+
|
843
|
+
The document proper can reference the values of document attributes, which is convenient
|
844
|
+
for reusability. For example,
|
845
|
+
the Rice Model document references the editorial groups that have contributed to the
|
846
|
+
document as
|
847
|
+
|
848
|
+
[source,asciidoc]
|
849
|
+
--
|
850
|
+
This document was prepared by Technical Committee ISO/TC {technical-committee-number}, _{technical-committee}_, Subcommittee SC {subcommittee-number}, _{subcommittee}_.
|
851
|
+
--
|
852
|
+
|
853
|
+
If the corresponding document attributes are not populated in the header, then the references
|
854
|
+
themselves will not be populated.
|
855
|
+
|
856
|
+
|
857
|
+
== Data Models
|
858
|
+
|
859
|
+
The IsoDoc data model (IsoStandardDocument) is instantiated from the
|
860
|
+
https://github.com/riboseinc/isodoc-models[StandardDocument model]. For details
|
861
|
+
please visit that page.
|
862
|
+
|
863
|
+
== Code Structure
|
864
|
+
|
865
|
+
The gem invokes the following other gems as a division of labour.
|
866
|
+
|
867
|
+
* This gem generates the IsoDoc XML proper
|
868
|
+
* https://github.com/riboseinc/isodoc renders IsoDoc XML into HTML
|
869
|
+
* https://github.com/riboseinc/html2doc converts HTML into Microsoft Word
|
870
|
+
* https://github.com/riboseinc/isodoc-models derives the ISO Standard grammar
|
871
|
+
used for validation from the generic IsoDoc grammar
|
872
|
+
|
873
|
+
|
874
|
+
== Examples
|
875
|
+
|
876
|
+
The gem has been tested to date against the
|
877
|
+
https://www.iso.org/publication/PUB100407.html["Rice document"], the ISO's
|
878
|
+
model document of an international standard. Sample representation of the Rice document
|
879
|
+
in Asciidoctor, and output formats, are included in the https://github.com/riboseinc/isodoc-rice
|
880
|
+
repository.
|
881
|
+
|
882
|
+
See also `link:spec/metanorma-iso[]` for individual features.
|