metanorma-standoc 1.1.4 → 1.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -9
- data/Gemfile.lock +10 -10
- data/README.adoc +11 -815
- data/docs/customisation.adoc +12 -12
- data/docs/guidance.adoc +5 -5
- data/docs/htmloutput.adoc +4 -4
- data/docs/quickstart.adoc +9 -9
- data/lib/asciidoctor/standoc/base.rb +5 -6
- data/lib/asciidoctor/standoc/biblio.rng +38 -34
- data/lib/asciidoctor/standoc/blocks.rb +13 -4
- data/lib/asciidoctor/standoc/cleanup.rb +1 -1
- data/lib/asciidoctor/standoc/isodoc.rng +1 -0
- data/lib/asciidoctor/standoc/ref.rb +9 -3
- data/lib/asciidoctor/standoc/reqt.rng +157 -0
- data/lib/asciidoctor/standoc/utils.rb +2 -1
- data/lib/asciidoctor/standoc/validate.rb +8 -0
- data/lib/metanorma/standoc/version.rb +1 -1
- data/metanorma-standoc.gemspec +2 -2
- data/spec/asciidoctor-standoc/blocks_spec.rb +29 -7
- data/spec/asciidoctor-standoc/isobib_cache_spec.rb +20 -5
- data/spec/asciidoctor-standoc/validate_spec.rb +9 -9
- metadata +6 -5
data/docs/customisation.adoc
CHANGED
@@ -4,16 +4,16 @@ In this guide, we give advice on how to adopt the Metanorma approach to document
|
|
4
4
|
|
5
5
|
== How can I adopt the StanDoc specification for my own publications?
|
6
6
|
|
7
|
-
TIP: Copy the RSD schema from https://github.com/
|
7
|
+
TIP: Copy the RSD schema from https://github.com/metanorma/metanorma-model-iso/blob/master/grammars/rsd.rng. You may need to adapt some of the enums in the model, or in the ISO Standards model that it inherits; but in the first instance, you can just ignore the differences—and ignore the validation feedback that the toolset gives.
|
8
8
|
|
9
9
|
The Standoc specification is expressed in http://www.relaxng.org[RelaxNG schema for XML], and is intended to be customisable for different types of publication. The customisation of Standoc relies on inheritance, with the following schemas embedded hierarchically:
|
10
10
|
|
11
|
-
* https://github.com/
|
12
|
-
* https://github.com/
|
13
|
-
* https://github.com/
|
11
|
+
* https://github.com/metanorma/relaton-models[Relaton]: bibliography
|
12
|
+
* https://github.com/metanorma/basicdoc-models[BasicDoc]: block-level and inline formatting
|
13
|
+
* https://github.com/metanorma/metanorma-model=standoc[StanDoc]: organisation of sections for a generic standards document
|
14
14
|
* Models specific to standards
|
15
15
|
|
16
|
-
Because of the richness of the ISO standards model, most Standoc standards to date (including the sample gem https://github.com/
|
16
|
+
Because of the richness of the ISO standards model, most Standoc standards to date (including the sample gem https://github.com/metanorma/metanorma-sample) inherit from the ISO Standards model, which itself inherits from Standoc.
|
17
17
|
|
18
18
|
Specialisation of a model consists of:
|
19
19
|
|
@@ -25,7 +25,7 @@ To adapt the schema for your publication set,
|
|
25
25
|
|
26
26
|
* Get familiar with the Standoc set of models, and identify any elements that you would want to represent differently for your documents (different types, different enums), or enhance for your documents (additional element attributes, additional elements)
|
27
27
|
* Create a grammar inheriting from StanDoc or from a specific standard, which expresses what is distinctive about your grammar.
|
28
|
-
** We recommend starting your modelling in UML, as an effective communication tool; compare the UML models for
|
28
|
+
** We recommend starting your modelling in UML, as an effective communication tool; compare the UML models for Metanorma standards, such as https://github.com/metanorma/metanorma-model-iso
|
29
29
|
** The tool suite expects to validate against a set of schemas expressed in RelaxNG. We have been authoring grammars in RelaxNG Compact, as a more human-readable format, then compiling those grammars to RelaxNG using https://github.com/relaxng/jing-trang[jing-trang]. You can choose to use a different schema language, but you will need to customise the tool chain to validate against that form of schema instead.
|
30
30
|
** In order to make schema inheritance easier, we have avoided using namespaces for the individual schemas; a namespace is added to the standards-specific schema at the very end of the inheritance chain.
|
31
31
|
|
@@ -33,7 +33,7 @@ To adapt the schema for your publication set,
|
|
33
33
|
|
34
34
|
[TIP]
|
35
35
|
====
|
36
|
-
* Clone the asciidoctor-metanorma_sample gem: https://github.com/
|
36
|
+
* Clone the asciidoctor-metanorma_sample gem: https://github.com/metanorma/metanorma-sample.
|
37
37
|
* Change the namespace for RSD documents (`RSD_NAMESPACE = "https://open.ribose.com/standards/rsd"`) to a namespace specific to your organisation's document standard.
|
38
38
|
* Change any references to `sample` or `Sample` in the gem to your organisation's document standard.
|
39
39
|
* Change the styling of the document outputs (`.../lib/isodoc/XXX/html`).
|
@@ -70,7 +70,7 @@ The customisations needed for Isodoc::Sample are more extensive. Three base clas
|
|
70
70
|
|
71
71
|
* `Isodoc::Metadata` processes the metadata about the document stored in `//bibdata`. This information typically ends up in the document title page, as opposed to the document body. For that reason, metadata is extracted into a hash, which is passed to document output (title page, Word header) via the https://shopify.github.io/liquid/[Liquid template language].
|
72
72
|
* `Isodoc::HtmlConvert` converts Standoc XML to HTML.
|
73
|
-
* `Isodoc::WordConvert` converts Standoc XML to Word HTML; the https://github.com/
|
73
|
+
* `Isodoc::WordConvert` converts Standoc XML to Word HTML; the https://github.com/metanorma/html2doc[html2doc] gem then converts this to a .doc document.
|
74
74
|
|
75
75
|
The `Isodoc::HtmlConvert` and `Isodoc::WordConvert` overlap substantially, as both use variants of HTML; in fact the files `samplehtmlrender.rb` and `samplewordrender.rb` are deliberately identical, apart from the class their code belongs to. However there is no reason not to make substantially different rendering choices in the HTML and Word branches of the code.
|
76
76
|
|
@@ -78,7 +78,7 @@ The `Isodoc::HtmlConvert` and `Isodoc::WordConvert` overlap substantially, as bo
|
|
78
78
|
|
79
79
|
[TIP]
|
80
80
|
====
|
81
|
-
* Clone the asciidoctor-metanorma_sample gem: https://github.com/
|
81
|
+
* Clone the asciidoctor-metanorma_sample gem: https://github.com/metanorma/metanorma-sample.
|
82
82
|
* Edit the `html_sample_titlepage.html` and `html_sample_intro.html` pages to match your organisation's branding.
|
83
83
|
** Leave the Liquid Template instructions alone (`{{`, `{%`) unless you know what you're doing with them: they are how the pages are populated with metadata.
|
84
84
|
* Edit the `default_fonts()` method in your `IsoDoc::...::HtmlConvert` class, to match your desired fonts.
|
@@ -110,16 +110,16 @@ Styling of output is intended to be configurable. HTML stylesheets are in https:
|
|
110
110
|
====
|
111
111
|
* There is no quick way of doing this.
|
112
112
|
* Everything you can do in Word, you can do in Word HTML. Save Word documents as Word HTML to see how.
|
113
|
-
* Clone the asciidoctor-metanorma_sample gem: https://github.com/
|
113
|
+
* Clone the asciidoctor-metanorma_sample gem: https://github.com/metanorma/metanorma-sample.
|
114
114
|
* Edit the `word_sample_titlepage.html` and `word_sample_intro.html` pages to match your organisation's branding. With lots of iterations of saving Word documents as HTML, for trial and error.
|
115
115
|
** Leave the Liquid Template instructions alone (`{{`, `{%`) unless you know what you're doing with them: they are how the pages are populated with metadata.
|
116
116
|
* Edit the `default_fonts()` method in your `IsoDoc::...::WordConvert` class, to match your desired fonts.
|
117
117
|
* Edit the `wordstyle.scss` and `sample.scss` stylesheets to match your organisation's branding. With lots of iterations of saving Word documents as HTML, for trial and error.
|
118
118
|
====
|
119
119
|
|
120
|
-
Word output in the document toolset is generated through Word HTML, the variant of HTML that you get when you save a Word document as HTML. (That is why documents are saved in `.doc`, not `.docx`.) This has the advantage over https://en.wikipedia.org/wiki/Office_Open_XML[OOXML], the native markup of DOCX, of using a well-known markup language, with a low barrier to entry: if you want to work out how to do something in Word HTML, do it in Word, save the document as HTML, and open up the HTML in a text editor. (For more on the choice of using Word HTML, see https://github.com/
|
120
|
+
Word output in the document toolset is generated through Word HTML, the variant of HTML that you get when you save a Word document as HTML. (That is why documents are saved in `.doc`, not `.docx`.) This has the advantage over https://en.wikipedia.org/wiki/Office_Open_XML[OOXML], the native markup of DOCX, of using a well-known markup language, with a low barrier to entry: if you want to work out how to do something in Word HTML, do it in Word, save the document as HTML, and open up the HTML in a text editor. (For more on the choice of using Word HTML, see https://github.com/metanorma/html2doc/wiki/Why-not-docx%3F.)
|
121
121
|
|
122
|
-
However Word HTML is not quite the HTML you are used to: it is a restricted, syntactically idiosyncratic variant of HTML 4, with a non-standard and weakened form of CSS. Doing any styling in Word HTML involves lots of trial and error, and paying close attention to how Word HTML does things in its CSS. We have documented a few of the clearer gotchas in https://github.com/
|
122
|
+
However Word HTML is not quite the HTML you are used to: it is a restricted, syntactically idiosyncratic variant of HTML 4, with a non-standard and weakened form of CSS. Doing any styling in Word HTML involves lots of trial and error, and paying close attention to how Word HTML does things in its CSS. We have documented a few of the clearer gotchas in https://github.com/metanorma/html2doc/blob/master/README.adoc.
|
123
123
|
|
124
124
|
It's still better than learning OOXML.
|
125
125
|
|
data/docs/guidance.adoc
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
= Guidance for Authoring
|
2
2
|
The Asciidoc approach to authoring ISO standards (and other related standards under Metanorma) is not https://en.wikipedia.org/wiki/WYSIWYG[WYSIWYG]: you are dealing with a text editor and a console rather than a Word document, and you are authoring something that looks more like HTML than the final product. On the other hand, editing documents with a markup system like Asciidoc makes it much easier to automate key validation and formatting processes, such as checking for missing document components, autonumbering, and generating output in multiple formats.
|
3
3
|
|
4
|
-
The documents you will be authoring will be in the http://asciidoctor.org[Asciidoc] formatting language, so you need to be familiar with that language's markup conventions: the http://asciidoctor.org/docs/user-manual/[Asciidoctor User Manual] will be your companion (supplemented by the https://github.com/
|
4
|
+
The documents you will be authoring will be in the http://asciidoctor.org[Asciidoc] formatting language, so you need to be familiar with that language's markup conventions: the http://asciidoctor.org/docs/user-manual/[Asciidoctor User Manual] will be your companion (supplemented by the https://github.com/metanorma/metanorma-iso#asciidoctor-model-additions[additions to markup made for ISO standards]. However we have tried to make things easier for you by preparing an https://github.com/metanorma/metanorma-iso/blob/master/spec/examples/rice.adoc[AsciiDoc version] of the ISO Standard exemplar, the https://www.iso.org/publication/PUB100407.html["Rice document"]. If you use this document as a template for your own ISO standard document, you will find most of the formatting you need illustrated there.
|
5
5
|
|
6
6
|
== Usage
|
7
7
|
|
8
|
-
See the README on https://github.com/
|
8
|
+
See the README on https://github.com/metanorma/metanorma-iso#usage[how to deploy and use the gem].
|
9
9
|
|
10
10
|
== Output in different languages
|
11
11
|
|
12
12
|
The gem allows generation of standards in different languages; the language of the document is specified in the `:language:` document attribute (and `:script:`, for languages with more than one script).
|
13
13
|
|
14
|
-
For each language, language-specific templated text is specified for the boilerplate, labels and cross-references that are included in document output. The gem has predefined templates for English, Chinese (Simplified) and French. You can specify your own language by providing your own http://www.yaml.org/spec/1.2/spec.html[YAML] template file, and linking to it with the `:i18nyaml` document attribute. The YAML template you provide needs to match https://github.com/
|
14
|
+
For each language, language-specific templated text is specified for the boilerplate, labels and cross-references that are included in document output. The gem has predefined templates for English, Chinese (Simplified) and French. You can specify your own language by providing your own http://www.yaml.org/spec/1.2/spec.html[YAML] template file, and linking to it with the `:i18nyaml` document attribute. The YAML template you provide needs to match https://github.com/metanorma/isodoc/blob/master/lib/isodoc/i18n-en.yaml, substituting translations for each of the fields given.
|
15
15
|
|
16
16
|
The Chinese (Simplified) template also localises punctuation and spacing, mapping them away from the default Latin punctuation used elsewhere in the gem.
|
17
17
|
|
@@ -50,7 +50,7 @@ The gem also validates terms cited from the IEV against the online IEV Electrope
|
|
50
50
|
|
51
51
|
== Document header
|
52
52
|
|
53
|
-
The core metadata about the standard comes from the Asciidoc document header (the list of colon-delimited attributes at the start of the document), and the https://github.com/
|
53
|
+
The core metadata about the standard comes from the Asciidoc document header (the list of colon-delimited attributes at the start of the document), and the https://github.com/metanorma/metanorma-iso#document-attributes[README documents what those fields should be]. Use the Rice document as a template, and be careful about sticking to the guidelines on populating them.
|
54
54
|
|
55
55
|
The Rice document contains some additional fields that are not essential to ISO rendering, and help Asciidoctor preview the document with its native renderer, should you so choose. (For example, `:appendix-caption: Annex` ensures that the native Asciidoctor renderer calls appendices Annexes; but the Word and HTML output of the gem will do so regardless of how this value is populated.) You will need to leave the `:stem:` field in if you have any AsciiMath or MathML to include in the document; otherwise they will not be detected.
|
56
56
|
|
@@ -390,7 +390,7 @@ Notes that are not at the end of a clause are folded into the preceding block, i
|
|
390
390
|
|
391
391
|
=== Reviewer Notes
|
392
392
|
|
393
|
-
We have introduced a mechanism in the gem to annotate arbitrary blocks of text, using Asciidoc sidebars and anchors for the beginning and end of the annotation; see https://github.com/
|
393
|
+
We have introduced a mechanism in the gem to annotate arbitrary blocks of text, using Asciidoc sidebars and anchors for the beginning and end of the annotation; see https://github.com/metanorma/metanorma-standoc#reviewer-notes[discussion in the README].
|
394
394
|
|
395
395
|
== Cross-references
|
396
396
|
|
data/docs/htmloutput.adoc
CHANGED
@@ -22,7 +22,7 @@ The `body` of the HTML document is divided into the following parts:
|
|
22
22
|
|
23
23
|
=== Body markup
|
24
24
|
|
25
|
-
Within the body of the document, different blocks and inline spans of the Metanorma document model (https://github.com/
|
25
|
+
Within the body of the document, different blocks and inline spans of the Metanorma document model (https://github.com/metanorma/metanorma-model-standoc[Standoc XML], https://github.com/metanorma/basicdoc-models[BasicDoc XML]) are represented by different CSS classes, as follows:
|
26
26
|
|
27
27
|
==== Sections
|
28
28
|
|
@@ -83,11 +83,11 @@ Page Break:: `<br>` (realised as page break in Word HTML)
|
|
83
83
|
|
84
84
|
=== Word HTML and Word HTML CSS
|
85
85
|
|
86
|
-
The Word HTML documented here is what is used by the gems to generate DOC output. For more on why Word HTML is used, instead of OOXML or HTML 5 embedded into DOCX, see https://github.com/
|
86
|
+
The Word HTML documented here is what is used by the gems to generate DOC output. For more on why Word HTML is used, instead of OOXML or HTML 5 embedded into DOCX, see https://github.com/metanorma/html2doc/wiki/Why-not-docx%3F
|
87
87
|
|
88
88
|
Word HTML, and the Word HTML version of CSS, are restricted compared to the HTML and CSS you are likely familiar with. Word HTML is a subset of HTML 4; Word HTML CSS has a weakened set of selectors, and a range of Microsoft-specific extensions (prefixed with `@` or `mso-`). The weakened set of selectors means you cannot assume that classes are inherited by their children; normal CSS would apply formatting on a `div` class to its child paragraphs, but Word HTML would expect you to repeat that class definition for `p`.
|
89
89
|
|
90
|
-
Some of the necessary caveats are listed in https://github.com/
|
90
|
+
Some of the necessary caveats are listed in https://github.com/metanorma/html2doc/blob/master/README.adoc. The styling of lists in particular is quite different to normal CSS, and requires a Word-specific selector to define list styles (the `:ulstyle ` and `:olstyle ` parameter of `WordConvert.new()`).
|
91
91
|
|
92
92
|
Word HTML and CSS is not well-documented (even though there is a 1500 page manual from Microsoft); fortunately saving Word documents to HTML will reveal the Word HTML and Word HTML CSS that can be used to generate the same formatting. The stylesheets need to follow the conventions of Word HTML, and should be formulated by saving Word documents as HTML, and extracting their CSS stylesheets. Note that the CSS is prefixed with a set of font definitions; these too should be obtained by saving Word documents as HTML.
|
93
93
|
|
@@ -97,7 +97,7 @@ The headers and footers of a Word document are defined in Word HTML in a separat
|
|
97
97
|
|
98
98
|
The `head` of the Word HTML document contains two stylesheets (the `:wordstylesheet` and `:standardsheet` parameter of `WordConvert.new()`). The `:wordstylesheet` is intended as generic Word markup, while `:standardsheet` is intended to contain styling specific to the standard. No scripts are supported in Word HTML.
|
99
99
|
|
100
|
-
The other elements of the Word HTML head are populated by the https://github.com/
|
100
|
+
The other elements of the Word HTML head are populated by the https://github.com/metanorma/html2doc[html2doc gem]: a reference to a manifest of included files (specifically images and the header file), and settings to open the document in Print View at 100% magnification.
|
101
101
|
|
102
102
|
The `body` of the Word HTML document is divided into the following parts:
|
103
103
|
|
data/docs/quickstart.adoc
CHANGED
@@ -4,7 +4,7 @@ This is a guide on how to get started using AsciiISO to create ISO standards doc
|
|
4
4
|
|
5
5
|
AsciiISO is the purposed-design syntax for creating ISO documents based on the AsciiDoc syntax.
|
6
6
|
|
7
|
-
AsciiISO is currently used as input to the Asciidoctor-ISO renderer, which produces the corresponding https://github.com/
|
7
|
+
AsciiISO is currently used as input to the Asciidoctor-ISO renderer, which produces the corresponding https://github.com/metanorma/metanorma-model-standoc[Metanorma schema] (in `.xml`), which in turn uses the https://github.com/metanorma/isodoc[isodoc] gem to convert ISOXML into the final output formats, HTML (`.html`) and Word Document (`.doc`).
|
8
8
|
|
9
9
|
|
10
10
|
== Even quicker summary
|
@@ -12,11 +12,11 @@ AsciiISO is currently used as input to the Asciidoctor-ISO renderer, which produ
|
|
12
12
|
In order to start a new ISO document, or migrate your document from Word:
|
13
13
|
|
14
14
|
. Install <<installation>>
|
15
|
-
. Clone the https://github.com/
|
15
|
+
. Clone the https://github.com/metanorma/isodoc-rice/[AsciiISO Rice]
|
16
16
|
|
17
17
|
To migrate:
|
18
18
|
|
19
|
-
. Use our https://github.com/
|
19
|
+
. Use our https://github.com/metanorma/reverse_asciidoctor[reverse_asciidoctor] gem to help you convert a Word document into AsciiISO. That said, the conversion will not be 100% clean and you will have to manually fix some syntax (especially if your Word document contains an index, stray anchors, and equations).
|
20
20
|
. Move the content back to the cloned isodoc-rice.
|
21
21
|
|
22
22
|
|
@@ -40,7 +40,7 @@ If you want the latest version of the gem (which is still heavily under developm
|
|
40
40
|
|
41
41
|
[source,console]
|
42
42
|
--
|
43
|
-
git clone https://github.com/
|
43
|
+
git clone https://github.com/metanorma/metanorma-iso.git
|
44
44
|
cd asciidoctor-iso
|
45
45
|
gem build *.gemspec
|
46
46
|
gem install *.gem
|
@@ -66,15 +66,15 @@ asciidoctor --trace -b iso -r 'asciidoctor-iso' new_standard.adoc
|
|
66
66
|
|
67
67
|
NOTE: This command syntax will be changed soon.
|
68
68
|
|
69
|
-
This will generate two files from the `new_standard.adoc` document (provided it is well-formed!): `new_standard.html` is a standalone HTML document, and `new_standard.doc` is a Word document (currently in the pre-2007 `.doc` format, but Microsoft Word will open it fine). Both these files are generated via an intermediate XML file, `new_standard.xml`, which represents the structure of the document following the rules of ISO/IEC DIR 2, as captured in the https://github.com/
|
69
|
+
This will generate two files from the `new_standard.adoc` document (provided it is well-formed!): `new_standard.html` is a standalone HTML document, and `new_standard.doc` is a Word document (currently in the pre-2007 `.doc` format, but Microsoft Word will open it fine). Both these files are generated via an intermediate XML file, `new_standard.xml`, which represents the structure of the document following the rules of ISO/IEC DIR 2, as captured in the https://github.com/metanorma/metanorma-model-standoc[Metanorma schema].
|
70
70
|
|
71
71
|
Even if there are no errors in the Asciidoctor syntax, the document may still raise warnings to the console as it is being validated. The validation comes from ISO/IEC DIR 2, and consists of two parts: warnings about document content (e.g. requiring space before a percentage sign; requiring that the scope not contain text that looks like a recommendation); and warnings about document structure. The latter are generated by running the generated XML against the ISOXML schema, and report the line numbers of the XML document where issues are observed.
|
72
72
|
|
73
73
|
=== Template
|
74
74
|
|
75
|
-
To author Asciidoctor documents, you need to be familiar with the Asciidoctor syntax, as well as the Asciidoctor-ISO extensions to the syntax and conventions. The https://asciidoctor.org/docs/user-manual/[Asciidoctor User Manual] documents Asciidoctor itself; the https://github.com/
|
75
|
+
To author Asciidoctor documents, you need to be familiar with the Asciidoctor syntax, as well as the Asciidoctor-ISO extensions to the syntax and conventions. The https://asciidoctor.org/docs/user-manual/[Asciidoctor User Manual] documents Asciidoctor itself; the https://github.com/metanorma/metanorma-iso/wiki/Guidance-for-authoring[Guidance for Authoring in Asciidoctor-ISO] and the https://github.com/metanorma/metanorma-iso/blob/master/README.adoc[Asciidoctor-ISO Readme] are the complete documentation for the ISO-specific extensions. But the simplest way to get started is to take a ready-made Asciidoctor-ISO document, and edit it, observing how it approaches various formatting tasks.
|
76
76
|
|
77
|
-
The https://www.iso.org/publication/PUB100407.html["Rice document"] is the ISO's model document of an international standard. An Asciidoctor-ISO version of the document is available at https://github.com/
|
77
|
+
The https://www.iso.org/publication/PUB100407.html["Rice document"] is the ISO's model document of an international standard. An Asciidoctor-ISO version of the document is available at https://github.com/metanorma/isodoc-rice/ . We suggest downloading the site, and editing it.
|
78
78
|
|
79
79
|
The `iso-rice-en.adoc` document consists of a document header, and it references the separate `body/body-en.adoc` document for the document proper (`include::body/body-en.adoc[]`). You can just continue on with the document text after the document header—so long as you remember to leave a blank line between the two.
|
80
80
|
|
@@ -86,7 +86,7 @@ Syntax includes the following; the links are to the Asciidoctor User Manual. All
|
|
86
86
|
|
87
87
|
=== https://asciidoctor.org/docs/user-manual/#doc-header[Document header]
|
88
88
|
|
89
|
-
Attributes of the document, which typically appear in the coverpage (if at all), rather than in the document proper. The permitted attributes for Asciidoctor-ISO, and their expected values, are documented in the https://github.com/
|
89
|
+
Attributes of the document, which typically appear in the coverpage (if at all), rather than in the document proper. The permitted attributes for Asciidoctor-ISO, and their expected values, are documented in the https://github.com/metanorma/metanorma-iso#document-attributes[Asciidoctor-ISO Readme]. Note that the author line expected in Asciidoctor is not used; the title line is likewise ignored, in favour of attributes describing the three-part bilingual title.
|
90
90
|
|
91
91
|
[source,asciidoctor]
|
92
92
|
--
|
@@ -282,7 +282,7 @@ Determine the mass fraction of moisture in accordance with the method specified
|
|
282
282
|
|
283
283
|
== Asciidoctor-ISO specific syntax
|
284
284
|
|
285
|
-
Full details of Asciidoctor-ISO–specific markup and conventions is given in the https://github.com/
|
285
|
+
Full details of Asciidoctor-ISO–specific markup and conventions is given in the https://github.com/metanorma/metanorma-iso/blob/master/README.adoc[Asciidoctor-ISO Readme] and the https://github.com/metanorma/metanorma-iso/wiki/Guidance-for-authoring[Guidance for authoring].
|
286
286
|
|
287
287
|
https://asciidoctor.org/docs/user-manual/#section-styles[Section styles] are used to indicate specific types of section: `[bibliography]` for Normative References and Bibliography, `[appendix]` for Annexes, and `[%appendix]` for Appendixes (annexes of annexes). These styles must be provided for the sections to be processed correctly: bibliographic references will not be recognised as such, for example, without the `[bibliography]` style applied:
|
288
288
|
|
@@ -115,15 +115,14 @@ module Asciidoctor
|
|
115
115
|
|
116
116
|
def init_iev_caches(node)
|
117
117
|
unless (@no_isobib_cache || @no_isobib)
|
118
|
-
|
119
|
-
|
120
|
-
node.attr("local-cache-only")
|
118
|
+
@iev_globalname = global_ievcache_name unless node.attr("local-cache-only")
|
119
|
+
@iev_localname = local_ievcache_name(node.attr("local-cache") || node.attr("local-cache-only"))
|
121
120
|
if node.attr("flush-caches")
|
122
|
-
FileUtils.rm_f
|
123
|
-
FileUtils.rm_f
|
121
|
+
FileUtils.rm_f @iev_globalname unless @iev_globalname.nil?
|
122
|
+
FileUtils.rm_f @iev_localname unless @iev_localname.nil?
|
124
123
|
end
|
125
124
|
end
|
126
|
-
|
125
|
+
#@iev = Iev::Db.new(globalname, localname) unless @no_isobib
|
127
126
|
end
|
128
127
|
|
129
128
|
def default_fonts(node)
|
@@ -156,9 +156,9 @@
|
|
156
156
|
<zeroOrMore>
|
157
157
|
<ref name="contact"/>
|
158
158
|
</zeroOrMore>
|
159
|
-
<
|
159
|
+
<zeroOrMore>
|
160
160
|
<ref name="uri"/>
|
161
|
-
</
|
161
|
+
</zeroOrMore>
|
162
162
|
</element>
|
163
163
|
</define>
|
164
164
|
<define name="fullname">
|
@@ -246,9 +246,9 @@
|
|
246
246
|
<optional>
|
247
247
|
<ref name="abbreviation"/>
|
248
248
|
</optional>
|
249
|
-
<
|
249
|
+
<zeroOrMore>
|
250
250
|
<ref name="uri"/>
|
251
|
-
</
|
251
|
+
</zeroOrMore>
|
252
252
|
<zeroOrMore>
|
253
253
|
<ref name="org-identifier"/>
|
254
254
|
</zeroOrMore>
|
@@ -469,12 +469,13 @@
|
|
469
469
|
<value>film</value>
|
470
470
|
<value>video</value>
|
471
471
|
<value>broadcast</value>
|
472
|
-
<value>
|
472
|
+
<value>graphic_work</value>
|
473
473
|
<value>music</value>
|
474
474
|
<value>patent</value>
|
475
475
|
<value>inbook</value>
|
476
476
|
<value>incollection</value>
|
477
477
|
<value>inproceedings</value>
|
478
|
+
<value>journal</value>
|
478
479
|
</choice>
|
479
480
|
</define>
|
480
481
|
<define name="BibliographicItem">
|
@@ -739,39 +740,44 @@
|
|
739
740
|
<element name="series">
|
740
741
|
<optional>
|
741
742
|
<attribute name="type">
|
742
|
-
<
|
743
|
-
<value>main</value>
|
744
|
-
<value>alt</value>
|
745
|
-
</choice>
|
743
|
+
<ref name="SeriesType"/>
|
746
744
|
</attribute>
|
747
745
|
</optional>
|
748
746
|
<choice>
|
749
|
-
<ref name="btitle"/>
|
750
747
|
<ref name="formattedref"/>
|
748
|
+
<group>
|
749
|
+
<ref name="btitle"/>
|
750
|
+
<optional>
|
751
|
+
<ref name="bplace"/>
|
752
|
+
</optional>
|
753
|
+
<optional>
|
754
|
+
<ref name="seriesorganization"/>
|
755
|
+
</optional>
|
756
|
+
<optional>
|
757
|
+
<ref name="abbreviation"/>
|
758
|
+
</optional>
|
759
|
+
<optional>
|
760
|
+
<ref name="seriesfrom"/>
|
761
|
+
</optional>
|
762
|
+
<optional>
|
763
|
+
<ref name="seriesto"/>
|
764
|
+
</optional>
|
765
|
+
<optional>
|
766
|
+
<ref name="seriesnumber"/>
|
767
|
+
</optional>
|
768
|
+
<optional>
|
769
|
+
<ref name="seriespartnumber"/>
|
770
|
+
</optional>
|
771
|
+
</group>
|
751
772
|
</choice>
|
752
|
-
<optional>
|
753
|
-
<ref name="bplace"/>
|
754
|
-
</optional>
|
755
|
-
<optional>
|
756
|
-
<ref name="seriesorganization"/>
|
757
|
-
</optional>
|
758
|
-
<optional>
|
759
|
-
<ref name="abbreviation"/>
|
760
|
-
</optional>
|
761
|
-
<optional>
|
762
|
-
<ref name="seriesfrom"/>
|
763
|
-
</optional>
|
764
|
-
<optional>
|
765
|
-
<ref name="seriesto"/>
|
766
|
-
</optional>
|
767
|
-
<optional>
|
768
|
-
<ref name="seriesnumber"/>
|
769
|
-
</optional>
|
770
|
-
<optional>
|
771
|
-
<ref name="seriespartnumber"/>
|
772
|
-
</optional>
|
773
773
|
</element>
|
774
774
|
</define>
|
775
|
+
<define name="SeriesType">
|
776
|
+
<choice>
|
777
|
+
<value>main</value>
|
778
|
+
<value>alt</value>
|
779
|
+
</choice>
|
780
|
+
</define>
|
775
781
|
<define name="seriesorganization">
|
776
782
|
<element name="organization">
|
777
783
|
<text/>
|
@@ -849,6 +855,7 @@
|
|
849
855
|
<value>includes</value>
|
850
856
|
<value>instance</value>
|
851
857
|
<value>partOf</value>
|
858
|
+
<value>hasDraft</value>
|
852
859
|
</choice>
|
853
860
|
</attribute>
|
854
861
|
<element name="bibitem">
|
@@ -861,9 +868,6 @@
|
|
861
868
|
</define>
|
862
869
|
<define name="version">
|
863
870
|
<element name="version">
|
864
|
-
<optional>
|
865
|
-
<ref name="vedition"/>
|
866
|
-
</optional>
|
867
871
|
<optional>
|
868
872
|
<ref name="revision-date"/>
|
869
873
|
</optional>
|
@@ -176,7 +176,8 @@ module Asciidoctor
|
|
176
176
|
def reqt_attributes(node)
|
177
177
|
{
|
178
178
|
id: Utils::anchor_or_uuid,
|
179
|
-
obligation: node.attr("obligation")
|
179
|
+
obligation: node.attr("obligation"),
|
180
|
+
filename: node.attr("filename")
|
180
181
|
}
|
181
182
|
end
|
182
183
|
|
@@ -197,7 +198,7 @@ module Asciidoctor
|
|
197
198
|
def preamble(node)
|
198
199
|
noko do |xml|
|
199
200
|
xml.foreword do |xml_abstract|
|
200
|
-
xml_abstract.title { |t| t << "Foreword" }
|
201
|
+
xml_abstract.title { |t| t << (node.blocks[0].title || "Foreword") }
|
201
202
|
content = node.content
|
202
203
|
xml_abstract << content
|
203
204
|
end
|
@@ -220,6 +221,7 @@ module Asciidoctor
|
|
220
221
|
imagetype: types.first.sub_type.upcase,
|
221
222
|
height: node.attr("height") || "auto",
|
222
223
|
width: node.attr("width") || "auto" ,
|
224
|
+
filename: node.attr("filename"),
|
223
225
|
alt: node.alt == node.attr("default-alt") ? nil : node.alt }
|
224
226
|
end
|
225
227
|
|
@@ -280,11 +282,18 @@ module Asciidoctor
|
|
280
282
|
end
|
281
283
|
end
|
282
284
|
|
285
|
+
def listing_attrs(node)
|
286
|
+
{
|
287
|
+
lang: node.attr("language"),
|
288
|
+
id: Utils::anchor_or_uuid(node),
|
289
|
+
filename: node.attr("filename")
|
290
|
+
}
|
291
|
+
end
|
292
|
+
|
283
293
|
# NOTE: html escaping is performed by Nokogiri
|
284
294
|
def listing(node)
|
285
|
-
attrs = { lang: node.attr("language"), id: Utils::anchor_or_uuid(node) }
|
286
295
|
fragment = ::Nokogiri::XML::Builder.new do |xml|
|
287
|
-
xml.sourcecode **attr_code(
|
296
|
+
xml.sourcecode **attr_code(listing_attrs(node)) do |s|
|
288
297
|
figure_title(node, s)
|
289
298
|
s << node.content
|
290
299
|
end
|
@@ -12,7 +12,7 @@ module Asciidoctor
|
|
12
12
|
module Standoc
|
13
13
|
module Cleanup
|
14
14
|
def textcleanup(result)
|
15
|
-
text = result.flatten.map { |l| l.sub(/\
|
15
|
+
text = result.flatten.map { |l| l.sub(/\s*$/, "") } * "\n"
|
16
16
|
if !@keepasciimath
|
17
17
|
text = text.gsub(%r{<stem type="AsciiMath">(.+?)</stem>},
|
18
18
|
'<amathstem>\1</amathstem>')
|
@@ -18,6 +18,7 @@
|
|
18
18
|
of this.
|
19
19
|
-->
|
20
20
|
<grammar ns="http://riboseinc.com/isoxml" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
|
21
|
+
<include href="reqt.rng"/>
|
21
22
|
<include href="biblio.rng">
|
22
23
|
<define name="status">
|
23
24
|
<element name="status">
|
@@ -204,9 +204,15 @@ module Asciidoctor
|
|
204
204
|
"#{cachename}/cache"
|
205
205
|
end
|
206
206
|
|
207
|
-
def
|
208
|
-
|
209
|
-
|
207
|
+
def global_ievcache_name
|
208
|
+
"#{Dir.home}/.iev/cache"
|
209
|
+
end
|
210
|
+
|
211
|
+
def local_ievcache_name(cachename)
|
212
|
+
return nil if cachename.nil?
|
213
|
+
cachename += "_iev" unless cachename.empty?
|
214
|
+
cachename = "iev" if cachename.empty?
|
215
|
+
"#{cachename}/cache"
|
210
216
|
end
|
211
217
|
end
|
212
218
|
end
|