asciidoctor-iso 0.9.6 → 0.9.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +14 -12
- data/README.adoc +1 -1
- data/asciidoctor-iso.gemspec +2 -1
- data/docs/htmloutput.adoc +115 -0
- data/lib/asciidoctor/iso/base.rb +0 -1
- data/lib/asciidoctor/iso/cleanup_ref.rb +1 -1
- data/lib/asciidoctor/iso/ref.rb +1 -1
- data/lib/asciidoctor/iso/validate.rb +10 -0
- data/lib/asciidoctor/iso/validate_requirements.rb +1 -2
- data/lib/asciidoctor/iso/validate_section.rb +1 -0
- data/lib/asciidoctor/iso/validate_style.rb +6 -0
- data/lib/asciidoctor/iso/version.rb +1 -1
- data/spec/asciidoctor-iso/blocks_spec.rb +1 -1
- data/spec/asciidoctor-iso/cleanup_spec.rb +6 -6
- data/spec/asciidoctor-iso/isobib_cache_spec.rb +82 -83
- data/spec/asciidoctor-iso/refs_spec.rb +20 -25
- data/spec/asciidoctor-iso/validate_spec.rb +26 -0
- metadata +19 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 225229b725b0ffc73cc5acc93152e63dc14393642e70760091d26f018a7ca329
|
4
|
+
data.tar.gz: 8268c280a53388ca060ddc42756bd0ca548a90caceb5c75ea9d376a52ead3516
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c3b97e89a0663e6df5127339c71f3cd437bf6ddc0eeb19a38679474d59bc7072fe5de846493d99c2e02807e12d39734c3e4b08a97a8fde29215537d887701be
|
7
|
+
data.tar.gz: eddf671a4b9e67b78ca10a7cd708e089455512bd7f4427c4452903aee178bf601ff80a815393d28e3a45360021d9cfa9d6a2bd57b9420ee1fbc1a119ba670e70
|
data/Gemfile.lock
CHANGED
@@ -1,21 +1,22 @@
|
|
1
1
|
GIT
|
2
2
|
remote: git://github.com/riboseinc/relaton.git
|
3
|
-
revision:
|
3
|
+
revision: 3daaf6fa4cd85eb4e1ea8141e520b4350a944975
|
4
4
|
specs:
|
5
|
-
relaton (0.0
|
5
|
+
relaton (0.1.0)
|
6
|
+
algoliasearch
|
6
7
|
gbbib (~> 0.1.0)
|
7
8
|
iev (~> 0.1.0)
|
8
|
-
isobib (~> 0.
|
9
|
+
isobib (~> 0.2.0)
|
9
10
|
rfcbib (~> 0.1.0)
|
10
11
|
|
11
12
|
PATH
|
12
13
|
remote: .
|
13
14
|
specs:
|
14
|
-
asciidoctor-iso (0.9.
|
15
|
+
asciidoctor-iso (0.9.6)
|
15
16
|
asciidoctor (~> 1.5.7)
|
16
17
|
iev (~> 0.1.0)
|
17
18
|
isodoc (>= 0.8)
|
18
|
-
relaton (~> 0.0
|
19
|
+
relaton (~> 0.1.0)
|
19
20
|
ruby-jing
|
20
21
|
|
21
22
|
GEM
|
@@ -36,9 +37,9 @@ GEM
|
|
36
37
|
nokogiri (>= 1.4.3)
|
37
38
|
ffi (1.9.25)
|
38
39
|
formatador (0.2.5)
|
39
|
-
gbbib (0.1.
|
40
|
-
cnccs
|
41
|
-
iso-bib-item
|
40
|
+
gbbib (0.1.4)
|
41
|
+
cnccs
|
42
|
+
iso-bib-item
|
42
43
|
guard (2.14.2)
|
43
44
|
formatador (>= 0.2.4)
|
44
45
|
listen (>= 2.7, < 4.0)
|
@@ -67,13 +68,13 @@ GEM
|
|
67
68
|
iev (0.1.0)
|
68
69
|
nokogiri
|
69
70
|
image_size (2.0.0)
|
70
|
-
iso-bib-item (0.
|
71
|
+
iso-bib-item (0.2.0)
|
71
72
|
isoics (~> 0.1.6)
|
72
73
|
nokogiri (~> 1.8.4)
|
73
74
|
ruby_deep_clone (~> 0.8.0)
|
74
|
-
isobib (0.
|
75
|
+
isobib (0.2.0)
|
75
76
|
algoliasearch
|
76
|
-
iso-bib-item (~> 0.
|
77
|
+
iso-bib-item (~> 0.2.0)
|
77
78
|
isodoc (0.8.4)
|
78
79
|
asciimath
|
79
80
|
html2doc (~> 0.8.1)
|
@@ -120,7 +121,7 @@ GEM
|
|
120
121
|
rb-inotify (0.9.10)
|
121
122
|
ffi (>= 0.5.0, < 2)
|
122
123
|
rfcbib (0.1.1)
|
123
|
-
iso-bib-item (~> 0.
|
124
|
+
iso-bib-item (~> 0.2.0)
|
124
125
|
roman-numerals (0.3.0)
|
125
126
|
rspec (3.7.0)
|
126
127
|
rspec-core (~> 3.7.0)
|
@@ -176,6 +177,7 @@ DEPENDENCIES
|
|
176
177
|
equivalent-xml (~> 0.6)
|
177
178
|
guard (~> 2.14)
|
178
179
|
guard-rspec (~> 4.7)
|
180
|
+
isobib (~> 0.2.0)
|
179
181
|
metanorma (~> 0.2.6)
|
180
182
|
rake (~> 12.0)
|
181
183
|
relaton!
|
data/README.adoc
CHANGED
@@ -91,7 +91,7 @@ $ gem install asciidoctor-iso
|
|
91
91
|
=== Content Warnings
|
92
92
|
|
93
93
|
The gem also realises several format
|
94
|
-
checks as prescribed in ISO/IEC DIR 2, and warns the user about them in the
|
94
|
+
checks as prescribed in ISO/IEC DIR 2: 2018, and warns the user about them in the
|
95
95
|
console:
|
96
96
|
|
97
97
|
* Numbers with what looks like dots instead of commas for decimal points.
|
data/asciidoctor-iso.gemspec
CHANGED
@@ -31,7 +31,7 @@ Gem::Specification.new do |spec|
|
|
31
31
|
spec.add_dependency "ruby-jing"
|
32
32
|
spec.add_dependency "isodoc", ">= 0.8"
|
33
33
|
spec.add_dependency "iev", "~> 0.1.0"
|
34
|
-
spec.add_dependency "relaton", "~> 0.
|
34
|
+
spec.add_dependency "relaton", "~> 0.1.1"
|
35
35
|
|
36
36
|
spec.add_development_dependency "bundler", "~> 1.15"
|
37
37
|
spec.add_development_dependency "byebug", "~> 9.1"
|
@@ -44,4 +44,5 @@ Gem::Specification.new do |spec|
|
|
44
44
|
spec.add_development_dependency "simplecov", "~> 0.15"
|
45
45
|
spec.add_development_dependency "timecop", "~> 0.9"
|
46
46
|
spec.add_development_dependency "metanorma", "~> 0.2.6"
|
47
|
+
spec.add_development_dependency "isobib", "~> 0.2.0"
|
47
48
|
end
|
@@ -0,0 +1,115 @@
|
|
1
|
+
= HTML and Word HTML Output
|
2
|
+
|
3
|
+
In order to create CSS stylesheets for the HTML and Word HTML output of the Metanorma tool, it is necessary to understand the structure of the HTML it generates.
|
4
|
+
|
5
|
+
== HTML
|
6
|
+
|
7
|
+
=== Top-Level Structure
|
8
|
+
|
9
|
+
The `head` of the HTML document contains a single stylesheet (the `:htmlstylesheet` parameter of `HtmlConvert.new()`), and some brief script calls that are embedded in the Ruby code (initialising jQuery, including webfonts).
|
10
|
+
|
11
|
+
The `body` of the HTML document is divided into the following parts:
|
12
|
+
|
13
|
+
* A title section (`<div class="title-section">`), comprising identifying information about the document, such as appears in a title page in print.
|
14
|
+
** The section is populated with an HTML template (the `:htmlcoverpage` parameter of `HtmlConvert.new()`). The information in this section is sourced from document metadata, rather than document content proper; the gem uses http://liquidmarkup.org[Liquid Template] to populate the HTML template. Different fields usually have distinct class names for CSS styling; these can vary by gem.
|
15
|
+
** For example, ISO documents have `coverpage_docnumber` (for the document ID), `coverpage_techcommittee` (for the technical committee responsible for the document), `doctitle-en` (for the English-language title of the document), `doctitle-fr` (for the French title), `title, subtitle, part` (for the three components of the document title), and `coverpage_docstage` (for the stage of publication of the document).
|
16
|
+
* A prefatory section (`<div class="prefatory-section">`), comprising boilerplate information which also does not come from document content proper. This is typically restricted to a copyright statement (`<div class="copyright">`), contact details, and a table of contents `<div id="toc">`.
|
17
|
+
** The section is also populated with a Liquid HTML template (the `:htmlintropage` parameter of `HtmlConvert.new()`).
|
18
|
+
** The table of contents in the HTML template is a placeholder; it is populated by a table of contents script included among the scripts loaded into the HTML body.
|
19
|
+
* The main section of the document (`<main class="main-section">`), which is populated with the document content.
|
20
|
+
* Optionally, a colophon (`<div class="colophon">`), which is populated with boilerplate information and/or document metadata. (Currently colophons in Metanorma gems appear only in Word output.)
|
21
|
+
* Scripts. These are populated from a static file (the `:scripts` parameter of `HtmlConvert.new()`). These are expected to include https://www.mathjax.org[MathJax], a Table of Contents generator, and a script for handling footnotes.
|
22
|
+
|
23
|
+
=== Body markup
|
24
|
+
|
25
|
+
Within the body of the document, different blocks and inline spans of the Metanorma document model (https://github.com/riboseinc/metanorma-model-standoc[Standoc XML], https://github.com/riboseinc/basicdoc-models[BasicDoc XML]) are represented by different CSS classes, as follows:
|
26
|
+
|
27
|
+
==== Sections
|
28
|
+
|
29
|
+
Symbols and abbreviated terms:: `<div class="Symbols">` (contents are a definition list)
|
30
|
+
Appendix title:: `<h1 class="Annex">`
|
31
|
+
Appendix, Bibliography, Introduction:: `<div class="Section3">`
|
32
|
+
Introduction title:: `<h1 class="IntroTitle">`
|
33
|
+
Foreword title:: `<h1 class="ForewordTitle">`
|
34
|
+
Deprecated term:: `<p class="DeprecatedTerms">`
|
35
|
+
Alternative term:: `<p class="AltTerms">`
|
36
|
+
Primary term:: `<p class="Terms">`
|
37
|
+
Term header:: `<p class="TermNum">`
|
38
|
+
Document title (in body):: `<p class="zzSTDTitle1">`
|
39
|
+
|
40
|
+
==== Blocks
|
41
|
+
|
42
|
+
Note:: `<div class="Note">`
|
43
|
+
Note label:: `<span class="note_label">`
|
44
|
+
Figure:: `<div class="figure">`
|
45
|
+
Figure title:: `<span class="FigureTitle">`
|
46
|
+
Example:: `<table class="example">` or `<div class="example">`
|
47
|
+
Example label:: `<span class="example_label">`
|
48
|
+
Sourcecode:: `<p class="Sourcecode">`
|
49
|
+
Admonition:: `<div class="Admonition">`
|
50
|
+
Formula:: `<div class="formula">`
|
51
|
+
Blockquote:: `<div class="Quote">`
|
52
|
+
Blockquote attribution:: `<p class="QuoteAttribution">`
|
53
|
+
Footnote:: `<aside class="footnote">`
|
54
|
+
Ordered list:: `<ol>`
|
55
|
+
Unordered list:: `<ul>`
|
56
|
+
Definition list:: `<dl>`
|
57
|
+
Normative reference:: `<p class="NormRef">`
|
58
|
+
Informative reference:: `<p class="Biblio">`
|
59
|
+
Table:: `<table>`
|
60
|
+
Table title:: `<p class="TableTitle">`
|
61
|
+
Table head:: `<thead>`
|
62
|
+
Table body:: `<tbody>`
|
63
|
+
Table foot:: `<tfoot>`
|
64
|
+
|
65
|
+
==== Inline
|
66
|
+
|
67
|
+
Hyperlink:: `<a>`
|
68
|
+
Cross-Reference:: `<a>`
|
69
|
+
Stem expression:: `<span class="stem">`
|
70
|
+
Small caps:: `<span style="font-variant:small-caps;">`
|
71
|
+
Emphasis:: `<i>`
|
72
|
+
Strong:: `<b>`
|
73
|
+
Superscript:: `<sup>`
|
74
|
+
Subscript:: `<sub>`
|
75
|
+
Monospace:: `<tt>`
|
76
|
+
Strikethrough:: `<s>`
|
77
|
+
Line Break:: `<br>`
|
78
|
+
Horizontal Rule:: `<hr>`
|
79
|
+
Page Break:: `<br>` (realised as page break in Word HTML)
|
80
|
+
|
81
|
+
|
82
|
+
== Word HTML
|
83
|
+
|
84
|
+
=== Word HTML and Word HTML CSS
|
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/riboseinc/html2doc/wiki/Why-not-docx%3F
|
87
|
+
|
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
|
+
|
90
|
+
Some of the necessary caveats are listed in https://github.com/riboseinc/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
|
+
|
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
|
+
|
94
|
+
=== Top-Level Structure
|
95
|
+
|
96
|
+
The headers and footers of a Word document are defined in Word HTML in a separate file, `header.html` (the `:header` parameter of `WordConvert.new()`), which is included in the file manifest for the document. The header.html file is cross-referenced to the Word HTML CSS file, and contains a separate `div` for each header and footer type; refer to the instances in the gems for illustration.
|
97
|
+
|
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
|
+
|
100
|
+
The other elements of the Word HTML head are populated by the https://github.com/riboseinc/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
|
+
|
102
|
+
The `body` of the Word HTML document is divided into the following parts:
|
103
|
+
|
104
|
+
* A title section (`<div class="WordSection1">`), comprising identifying information about the document, such as appears in a title page in print.
|
105
|
+
** The section is populated with an HTML template (the `:wordcoverpage` parameter of `WordConvert.new()`). As with HTML, the information in this section is sourced from document metadata, rather than document content proper; and the gem uses http://liquidmarkup.org[Liquid Template] to populate the HTML template.
|
106
|
+
* A prefatory section (`<div class="WordSection2">`), comprising boilerplate information which does not come from document content proper (such as a Table of Contents shell), as well as prefatory material from the document content. The prefatory section is set in the CSS stylesheet to have Roman numerals for its pagination.
|
107
|
+
** Because of the requirement for Roman numerals, prefatory material from the document is sent to this section, whereas all document content in the HTML document is sent to the main section.
|
108
|
+
* The main section of the document (`<div class="WordSection3">`), which is populated with the remaining document content. The main section is set in the CSS stylesheet to have Arabic numerals for its pagination.
|
109
|
+
* Optionally, a colophon (`<div class="colophon">`), which is populated with boilerplate information and/or document metadata.
|
110
|
+
|
111
|
+
=== Body markup
|
112
|
+
|
113
|
+
With the exception of the top-level document sections, discussed above, the Word HTML generated by the gem use the same CSS classes as the HTML proper. As already noted, the quirks of Word HTML CSS mean that classes need to be repeated on descendant elements that are not required in normal CSS.
|
114
|
+
|
115
|
+
The handling of footnotes and comments in Word HTML uses idiosyncratic Word HTML markup, including custom CSS, and is generated separately their the HTML counterparts in the gems.
|
data/lib/asciidoctor/iso/base.rb
CHANGED
@@ -116,7 +116,7 @@ module Asciidoctor
|
|
116
116
|
docid = ref.at("./docidentifier")
|
117
117
|
date = ref.at("./date[@type = 'published']")
|
118
118
|
reference = format_ref(docid.text, isopub)
|
119
|
-
reference += "
|
119
|
+
reference += ":#{date_range(date)}" if date && isopub
|
120
120
|
@anchors[ref["id"]] = { xref: reference }
|
121
121
|
end
|
122
122
|
end
|
data/lib/asciidoctor/iso/ref.rb
CHANGED
@@ -82,7 +82,7 @@ module Asciidoctor
|
|
82
82
|
def fetch_ref(xml, code, year, **opts)
|
83
83
|
hit = @bibdb&.fetch(code, year, opts)
|
84
84
|
return nil if hit.nil?
|
85
|
-
xml.parent.add_child(hit)
|
85
|
+
xml.parent.add_child(hit.to_xml)
|
86
86
|
xml
|
87
87
|
rescue Algolia::AlgoliaProtocolError
|
88
88
|
nil # Render reference without an Internet connection.
|
@@ -144,6 +144,15 @@ module Asciidoctor
|
|
144
144
|
end
|
145
145
|
end
|
146
146
|
|
147
|
+
def locality_erefs_validate(root)
|
148
|
+
root.xpath("//eref[locality]").each do |t|
|
149
|
+
unless /:[ ]?\d+{4}$/.match? t["citeas"]
|
150
|
+
warn "ISO: undated reference #{t['citeas']} should not contain "\
|
151
|
+
"specific elements"
|
152
|
+
end
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
147
156
|
def termdef_warn(text, re, term, msg)
|
148
157
|
re.match?(text) && warn("ISO style: #{term}: #{msg}")
|
149
158
|
end
|
@@ -181,6 +190,7 @@ module Asciidoctor
|
|
181
190
|
iev_validate(doc.root)
|
182
191
|
see_xrefs_validate(doc.root)
|
183
192
|
see_erefs_validate(doc.root)
|
193
|
+
locality_erefs_validate(doc.root)
|
184
194
|
end
|
185
195
|
|
186
196
|
def schema_validate(doc, filename)
|
@@ -9,14 +9,13 @@ module Asciidoctor
|
|
9
9
|
\\b
|
10
10
|
( shall | (is|are)_to |
|
11
11
|
(is|are)_required_(not_)?to |
|
12
|
+
(is|are)_required_that |
|
12
13
|
has_to |
|
13
14
|
only\\b[^.,]+\\b(is|are)_permitted |
|
14
15
|
it_is_necessary |
|
15
|
-
(needs|need)_to |
|
16
16
|
(is|are)_not_(allowed | permitted |
|
17
17
|
acceptable | permissible) |
|
18
18
|
(is|are)_not_to_be |
|
19
|
-
(need|needs)_not |
|
20
19
|
do_not )
|
21
20
|
\\b
|
22
21
|
REGEXP
|
@@ -189,6 +189,7 @@ module Asciidoctor
|
|
189
189
|
|
190
190
|
def asset_style(root)
|
191
191
|
root.xpath("//example | //termexample").each { |e| example_style(e) }
|
192
|
+
root.xpath("//definition").each { |e| definition_style(e) }
|
192
193
|
root.xpath("//note").each { |e| note_style(e) }
|
193
194
|
root.xpath("//fn").each { |e| footnote_style(e) }
|
194
195
|
root.xpath(ASSETS_TO_STYLE).each { |e| style(e, extract_text(e)) }
|
@@ -30,6 +30,12 @@ module Asciidoctor
|
|
30
30
|
style_warning(node, "Introduction may contain requirement", r) if r
|
31
31
|
end
|
32
32
|
|
33
|
+
def definition_style(node)
|
34
|
+
return if @novalid
|
35
|
+
r = requirement(extract_text(node))
|
36
|
+
style_warning(node, "Definition may contain requirement", r) if r
|
37
|
+
end
|
38
|
+
|
33
39
|
def example_style(node)
|
34
40
|
return if @novalid
|
35
41
|
style_no_guidance(node, extract_text(node), "Term Example")
|
@@ -286,7 +286,7 @@ RSpec.describe Asciidoctor::ISO do
|
|
286
286
|
<sections>
|
287
287
|
<figure id="_">
|
288
288
|
<name>Split-it-right sample divider</name>
|
289
|
-
<image src="spec/examples/rice_images/rice_image1.png" id="_" imagetype="PNG"/>
|
289
|
+
<image src="spec/examples/rice_images/rice_image1.png" id="_" imagetype="PNG" height="auto" width="auto"/>
|
290
290
|
</figure>
|
291
291
|
</sections>
|
292
292
|
</iso-standard>
|
@@ -182,7 +182,7 @@ r = 1 %</stem>
|
|
182
182
|
<preface><foreword obligation="informative">
|
183
183
|
<title>Foreword</title>
|
184
184
|
<p id="_">
|
185
|
-
<eref type="inline" bibitemid="iso216" citeas="ISO 216:
|
185
|
+
<eref type="inline" bibitemid="iso216" citeas="ISO 216:2001"/>
|
186
186
|
</p>
|
187
187
|
</foreword></preface><sections>
|
188
188
|
</sections><bibliography><references id="_" obligation="informative">
|
@@ -551,7 +551,7 @@ r = 1 %</stem>
|
|
551
551
|
INPUT
|
552
552
|
#{BLANK_HDR}
|
553
553
|
<sections><figure id="_">
|
554
|
-
<image src="spec/examples/rice_images/rice_image1.png" id="_" imagetype="PNG"/>
|
554
|
+
<image src="spec/examples/rice_images/rice_image1.png" id="_" imagetype="PNG" height="auto" width="auto"/>
|
555
555
|
<fn reference="a">
|
556
556
|
<p id="_">This is a footnote to a figure</p>
|
557
557
|
</fn><fn reference="b">
|
@@ -575,7 +575,7 @@ r = 1 %</stem>
|
|
575
575
|
INPUT
|
576
576
|
#{BLANK_HDR}
|
577
577
|
<sections><figure id="_">
|
578
|
-
<image src="spec/examples/rice_images/rice_image1.png" id="_" imagetype="PNG"/>
|
578
|
+
<image src="spec/examples/rice_images/rice_image1.png" id="_" imagetype="PNG" height="auto" width="auto"/>
|
579
579
|
<dl id="_">
|
580
580
|
<dt>a</dt>
|
581
581
|
<dd>
|
@@ -609,15 +609,15 @@ r = 1 %</stem>
|
|
609
609
|
<sections>
|
610
610
|
<figure id="figureC-2"><figure id="_">
|
611
611
|
<name>Initial stages: No grains are fully gelatinized (ungelatinized starch granules are visible inside the kernels)</name>
|
612
|
-
<image src="spec/examples/rice_images/rice_image3_1.png" id="_" imagetype="PNG"/>
|
612
|
+
<image src="spec/examples/rice_images/rice_image3_1.png" id="_" imagetype="PNG" height="auto" width="auto"/>
|
613
613
|
</figure>
|
614
614
|
<figure id="_">
|
615
615
|
<name>Intermediate stages: Some fully gelatinized kernels are visible</name>
|
616
|
-
<image src="spec/examples/rice_images/rice_image3_2.png" id="_" imagetype="PNG"/>
|
616
|
+
<image src="spec/examples/rice_images/rice_image3_2.png" id="_" imagetype="PNG" height="auto" width="auto"/>
|
617
617
|
</figure>
|
618
618
|
<figure id="_">
|
619
619
|
<name>Final stages: All kernels are fully gelatinized</name>
|
620
|
-
<image src="spec/examples/rice_images/rice_image3_3.png" id="_" imagetype="PNG"/>
|
620
|
+
<image src="spec/examples/rice_images/rice_image3_3.png" id="_" imagetype="PNG" height="auto" width="auto"/>
|
621
621
|
</figure></figure>
|
622
622
|
</sections>
|
623
623
|
</iso-standard>
|
@@ -1,11 +1,14 @@
|
|
1
1
|
require "spec_helper"
|
2
|
+
require "isobib"
|
2
3
|
|
3
4
|
RSpec.describe Asciidoctor::ISO do
|
4
5
|
|
5
6
|
ISO_123_SHORT = <<~EOS
|
6
|
-
<bibitem type="international-standard" id="
|
7
|
+
<bibitem type="international-standard" id="ISO123">
|
7
8
|
<title format="text/plain" language="en" script="Latn">Rubber latex -- Sampling</title>
|
8
9
|
<docidentifier>ISO 123</docidentifier>
|
10
|
+
<contributor> <role type="publisher"/> <organization> <name>International Organization for Standardization</name> <abbreviation>ISO</abbreviation> <uri>www.iso.org</uri> </organization> </contributor>
|
11
|
+
<status>Published</status>
|
9
12
|
</bibitem>
|
10
13
|
EOS
|
11
14
|
|
@@ -13,27 +16,31 @@ EOS
|
|
13
16
|
<bibitem type="international-standard" id="ISO124">
|
14
17
|
<title format="text/plain" language="en" script="Latn">Latex, rubber -- Determination of total solids content</title>
|
15
18
|
<docidentifier>ISO 124</docidentifier>
|
19
|
+
<contributor> <role type="publisher"/> <organization> <name>International Organization for Standardization</name> <abbreviation>ISO</abbreviation> <uri>www.iso.org</uri> </organization> </contributor>
|
20
|
+
<status>Published</status>
|
16
21
|
</bibitem>
|
17
22
|
EOS
|
18
23
|
|
19
24
|
ISO_124_SHORT_ALT = <<~EOS
|
20
|
-
<bibitem type="international-standard" id="
|
25
|
+
<bibitem type="international-standard" id="ISO124">
|
21
26
|
<title format="text/plain" language="en" script="Latn">Latex, rubber -- Replacement</title>
|
22
27
|
<docidentifier>ISO 124</docidentifier>
|
28
|
+
<contributor> <role type="publisher"/> <organization> <name>International Organization for Standardization</name> <abbreviation>ISO</abbreviation> <uri>www.iso.org</uri> </organization> </contributor>
|
29
|
+
<status>Published</status>
|
23
30
|
</bibitem>
|
24
31
|
EOS
|
25
32
|
|
26
33
|
ISOBIB_123_DATED = <<~EOS
|
27
|
-
<bibitem type="international-standard" id="ISO123"> <title format="text/plain" language="en" script="Latn">Rubber latex -- Sampling</title> <title format="text/plain" language="fr" script="Latn">Latex de caoutchouc -- ?chantillonnage</title> <uri type="src">https://www.iso.org/standard/23281.html</uri> <uri type="obp">https://www.iso.org/obp/ui/#!iso:std:23281:en</uri> <uri type="rss">https://www.iso.org/contents/data/standard/02/32/23281.detail.rss</uri> <docidentifier>ISO 123</docidentifier> <date type="published"> <on>2001</on> </date> <contributor> <role type="publisher"/> <organization> <name>International Organization for Standardization</name> <abbreviation>ISO</abbreviation> <uri>www.iso.org</uri> </organization> </contributor> <edition>3</edition> <language>en</language> <language>fr</language> <script>Latn</script> <status>Published</status> <copyright> <from>2001</from> <owner> <organization> <name>ISO</name>
|
34
|
+
<bibitem type="international-standard" id="ISO123"> <title format="text/plain" language="en" script="Latn">Rubber latex -- Sampling</title> <title format="text/plain" language="fr" script="Latn">Latex de caoutchouc -- ?chantillonnage</title> <uri type="src">https://www.iso.org/standard/23281.html</uri> <uri type="obp">https://www.iso.org/obp/ui/#!iso:std:23281:en</uri> <uri type="rss">https://www.iso.org/contents/data/standard/02/32/23281.detail.rss</uri> <docidentifier>ISO 123</docidentifier> <date type="published"> <on>2001</on> </date> <contributor> <role type="publisher"/> <organization> <name>International Organization for Standardization</name> <abbreviation>ISO</abbreviation> <uri>www.iso.org</uri> </organization> </contributor> <edition>3</edition> <language>en</language> <language>fr</language> <script>Latn</script> <status>Published</status> <copyright> <from>2001</from> <owner> <organization> <name>ISO</name> </organization> </owner> </copyright> <relation type="obsoletes"> <bibitem> <formattedref>ISO 123:1985</formattedref> </bibitem> </relation> <relation type="updates"> <bibitem> <formattedref>ISO 123:2001</formattedref> </bibitem> </relation></bibitem>
|
28
35
|
EOS
|
29
36
|
|
30
37
|
ISOBIB_123_UNDATED = <<~EOS
|
31
|
-
<bibitem type="international-standard" id="ISO123"> <title format="text/plain" language="en" script="Latn">Rubber latex -- Sampling</title> <title format="text/plain" language="fr" script="Latn">Latex de caoutchouc -- ?chantillonnage</title> <uri type="src">https://www.iso.org/standard/23281.html</uri> <uri type="obp">https://www.iso.org/obp/ui/#!iso:std:23281:en</uri> <uri type="rss">https://www.iso.org/contents/data/standard/02/32/23281.detail.rss</uri> <docidentifier>ISO 123</docidentifier> <date type="published"> <on>2001</on> </date> <contributor> <role type="publisher"/> <organization> <name>International Organization for Standardization</name> <abbreviation>ISO</abbreviation> <uri>www.iso.org</uri> </organization> </contributor> <edition>3</edition> <language>en</language> <language>fr</language> <script>Latn</script> <status>Published</status> <copyright> <from>2001</from> <owner> <organization> <name>ISO</name>
|
38
|
+
<bibitem type="international-standard" id="ISO123"> <title format="text/plain" language="en" script="Latn">Rubber latex -- Sampling</title> <title format="text/plain" language="fr" script="Latn">Latex de caoutchouc -- ?chantillonnage</title> <uri type="src">https://www.iso.org/standard/23281.html</uri> <uri type="obp">https://www.iso.org/obp/ui/#!iso:std:23281:en</uri> <uri type="rss">https://www.iso.org/contents/data/standard/02/32/23281.detail.rss</uri> <docidentifier>ISO 123</docidentifier> <date type="published"> <on>2001</on> </date> <contributor> <role type="publisher"/> <organization> <name>International Organization for Standardization</name> <abbreviation>ISO</abbreviation> <uri>www.iso.org</uri> </organization> </contributor> <edition>3</edition> <language>en</language> <language>fr</language> <script>Latn</script> <status>Published</status> <copyright> <from>2001</from> <owner> <organization> <name>ISO</name> </organization> </owner> </copyright> <relation type="obsoletes"> <bibitem> <formattedref>ISO 123:1985</formattedref> </bibitem> </relation> <relation type="updates"> <bibitem> <formattedref>ISO 123:2001</formattedref> </bibitem> </relation></bibitem>
|
32
39
|
EOS
|
33
40
|
|
34
41
|
|
35
42
|
ISOBIB_124_DATED = <<~EOS
|
36
|
-
<bibitem type="international-standard" id="ISO124"> <title format="text/plain" language="en" script="Latn">Latex, rubber -- Determination of total solids content</title> <title format="text/plain" language="fr" script="Latn">Latex de caoutchouc -- Détermination des matières solides totales</title> <uri type="src">https://www.iso.org/standard/61884.html</uri> <uri type="obp">https://www.iso.org/obp/ui/#!iso:std:61884:en</uri> <uri type="rss">https://www.iso.org/contents/data/standard/06/18/61884.detail.rss</uri> <docidentifier>ISO 124</docidentifier> <date type="published"> <on>2014</on> </date> <contributor> <role type="publisher"/> <organization> <name>International Organization for Standardization</name> <abbreviation>ISO</abbreviation> <uri>www.iso.org</uri> </organization> </contributor> <edition>7</edition> <language>en</language> <language>fr</language> <script>Latn</script> <abstract format="plain" language="en" script="Latn">ISO 124:2014 specifies methods for the determination of the total solids content of natural rubber field and concentrated latices and synthetic rubber latex. These methods are not necessarily suitable for latex from natural sources other than the Hevea brasiliensis, for vulcanized latex, for compounded latex, or for artificial dispersions of rubber.</abstract> <abstract format="plain" language="fr" script="Latn">L'ISO 124:2014 spécifie des méthodes pour la détermination des matières solides totales dans le latex de plantation, le latex de concentré de caoutchouc naturel et le latex de caoutchouc synthétique. Ces méthodes ne conviennent pas nécessairement au latex d'origine naturelle autre que celui de l'Hevea brasiliensis, au latex vulcanisé, aux mélanges de latex, ou aux dispersions artificielles de caoutchouc.</abstract> <status>Published</status> <copyright> <from>2014</from> <owner> <organization> <name>ISO</name>
|
43
|
+
<bibitem type="international-standard" id="ISO124"> <title format="text/plain" language="en" script="Latn">Latex, rubber -- Determination of total solids content</title> <title format="text/plain" language="fr" script="Latn">Latex de caoutchouc -- Détermination des matières solides totales</title> <uri type="src">https://www.iso.org/standard/61884.html</uri> <uri type="obp">https://www.iso.org/obp/ui/#!iso:std:61884:en</uri> <uri type="rss">https://www.iso.org/contents/data/standard/06/18/61884.detail.rss</uri> <docidentifier>ISO 124</docidentifier> <date type="published"> <on>2014</on> </date> <contributor> <role type="publisher"/> <organization> <name>International Organization for Standardization</name> <abbreviation>ISO</abbreviation> <uri>www.iso.org</uri> </organization> </contributor> <edition>7</edition> <language>en</language> <language>fr</language> <script>Latn</script> <abstract format="plain" language="en" script="Latn">ISO 124:2014 specifies methods for the determination of the total solids content of natural rubber field and concentrated latices and synthetic rubber latex. These methods are not necessarily suitable for latex from natural sources other than the Hevea brasiliensis, for vulcanized latex, for compounded latex, or for artificial dispersions of rubber.</abstract> <abstract format="plain" language="fr" script="Latn">L'ISO 124:2014 spécifie des méthodes pour la détermination des matières solides totales dans le latex de plantation, le latex de concentré de caoutchouc naturel et le latex de caoutchouc synthétique. Ces méthodes ne conviennent pas nécessairement au latex d'origine naturelle autre que celui de l'Hevea brasiliensis, au latex vulcanisé, aux mélanges de latex, ou aux dispersions artificielles de caoutchouc.</abstract> <status>Published</status> <copyright> <from>2014</from> <owner> <organization> <name>ISO</name> </organization> </owner> </copyright> <relation type="obsoletes"> <bibitem> <formattedref>ISO 124:2011</formattedref> </bibitem> </relation></bibitem>
|
37
44
|
EOS
|
38
45
|
|
39
46
|
it "does not activate biblio caches if isobib disabled" do
|
@@ -88,9 +95,10 @@ EOS
|
|
88
95
|
INPUT
|
89
96
|
expect(File.exist?("#{Dir.home}/.relaton-bib.json")).to be true
|
90
97
|
|
91
|
-
|
92
|
-
|
93
|
-
expect(
|
98
|
+
db = Relaton::Db.new "#{Dir.home}/.relaton-bib.json", nil
|
99
|
+
entry = db.load_entry("ISO 123:2001")
|
100
|
+
expect(entry["fetched"].to_s).to eq(Date.today.to_s)
|
101
|
+
expect(entry["bib"].to_xml).to be_equivalent_to(ISOBIB_123_DATED)
|
94
102
|
|
95
103
|
system "rm ~/.relaton-bib.json"
|
96
104
|
system "mv ~/.relaton-bib.json1 ~/.relaton-bib.json"
|
@@ -111,8 +119,9 @@ EOS
|
|
111
119
|
expect(File.exist?("#{Dir.home}/.relaton-bib.json")).to be true
|
112
120
|
expect(File.exist?("test.relaton.json")).to be false
|
113
121
|
|
114
|
-
|
115
|
-
|
122
|
+
db = Relaton::Db.new "#{Dir.home}/.relaton-bib.json", nil
|
123
|
+
entry = db.load_entry("ISO 123:2001")
|
124
|
+
expect(entry).to_not be nil
|
116
125
|
|
117
126
|
system "rm ~/.relaton-bib.json"
|
118
127
|
system "mv ~/.relaton-bib.json1 ~/.relaton-bib.json"
|
@@ -132,11 +141,13 @@ EOS
|
|
132
141
|
expect(File.exist?("#{Dir.home}/.relaton-bib.json")).to be true
|
133
142
|
expect(File.exist?("test.relaton.json")).to be true
|
134
143
|
|
135
|
-
|
136
|
-
|
144
|
+
db = Relaton::Db.new "#{Dir.home}/.relaton-bib.json", nil
|
145
|
+
entry = db.load_entry("ISO 123:2001")
|
146
|
+
expect(entry).to_not be nil
|
137
147
|
|
138
|
-
|
139
|
-
|
148
|
+
db = Relaton::Db.new "test.relaton.json", nil
|
149
|
+
entry = db.load_entry("ISO 123:2001")
|
150
|
+
expect(entry).to_not be nil
|
140
151
|
|
141
152
|
system "rm ~/.relaton-bib.json"
|
142
153
|
system "mv ~/.relaton-bib.json1 ~/.relaton-bib.json"
|
@@ -145,15 +156,13 @@ EOS
|
|
145
156
|
|
146
157
|
it "fetches uncached references" do
|
147
158
|
system "mv ~/.relaton-bib.json ~/.relaton-bib.json1"
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
"
|
153
|
-
"bib": ISO_123_SHORT
|
159
|
+
db = Relaton::Db.new "#{Dir.home}/.relaton-bib.json", nil
|
160
|
+
db.save_entry("ISO 123:2001",
|
161
|
+
{
|
162
|
+
"fetched" => Date.today.to_s,
|
163
|
+
"bib" => IsoBibItem.from_xml(ISO_123_SHORT)
|
154
164
|
}
|
155
|
-
|
156
|
-
end
|
165
|
+
)
|
157
166
|
|
158
167
|
mock_isobib_get_124
|
159
168
|
|
@@ -166,11 +175,12 @@ EOS
|
|
166
175
|
* [[[iso124,ISO 124:2014]]] _Standard_
|
167
176
|
INPUT
|
168
177
|
|
169
|
-
|
170
|
-
expect(
|
171
|
-
expect(
|
172
|
-
|
173
|
-
expect(
|
178
|
+
entry = db.load_entry("ISO 123:2001")
|
179
|
+
expect(entry["fetched"].to_s).to eq(Date.today.to_s)
|
180
|
+
expect(entry["bib"].to_xml).to be_equivalent_to(ISO_123_SHORT)
|
181
|
+
entry = db.load_entry("ISO 124:2014")
|
182
|
+
expect(entry["fetched"].to_s).to eq(Date.today.to_s)
|
183
|
+
expect(entry["bib"].to_xml).to be_equivalent_to(ISOBIB_124_DATED)
|
174
184
|
|
175
185
|
system "rm ~/.relaton-bib.json"
|
176
186
|
system "mv ~/.relaton-bib.json1 ~/.relaton-bib.json"
|
@@ -179,14 +189,13 @@ EOS
|
|
179
189
|
it "expires stale undated references" do
|
180
190
|
system "mv ~/.relaton-bib.json ~/.relaton-bib.json1"
|
181
191
|
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
"fetched"
|
186
|
-
"bib"
|
192
|
+
db = Relaton::Db.new "#{Dir.home}/.relaton-bib.json", nil
|
193
|
+
db.save_entry("ISO 123",
|
194
|
+
{
|
195
|
+
"fetched" => (Date.today - 90).to_s,
|
196
|
+
"bib" => IsoBibItem.from_xml(ISO_123_SHORT)
|
187
197
|
}
|
188
|
-
|
189
|
-
end
|
198
|
+
)
|
190
199
|
|
191
200
|
mock_isobib_get_123_undated
|
192
201
|
|
@@ -198,9 +207,9 @@ EOS
|
|
198
207
|
* [[[iso123,ISO 123]]] _Standard_
|
199
208
|
INPUT
|
200
209
|
|
201
|
-
|
202
|
-
|
203
|
-
expect(
|
210
|
+
entry = db.load_entry("ISO 123")
|
211
|
+
expect(entry["fetched"].to_s).to eq(Date.today.to_s)
|
212
|
+
expect(entry["bib"].to_xml).to be_equivalent_to(ISOBIB_123_UNDATED)
|
204
213
|
|
205
214
|
system "rm ~/.relaton-bib.json"
|
206
215
|
system "mv ~/.relaton-bib.json1 ~/.relaton-bib.json"
|
@@ -209,14 +218,13 @@ EOS
|
|
209
218
|
it "does not expire stale dated references" do
|
210
219
|
system "mv ~/.relaton-bib.json ~/.relaton-bib.json1"
|
211
220
|
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
"fetched"
|
216
|
-
"bib"
|
221
|
+
db = Relaton::Db.new "#{Dir.home}/.relaton-bib.json", nil
|
222
|
+
db.save_entry("ISO 123:2001",
|
223
|
+
{
|
224
|
+
"fetched" => (Date.today - 90).to_s,
|
225
|
+
"bib" => IsoBibItem.from_xml(ISO_123_SHORT)
|
217
226
|
}
|
218
|
-
|
219
|
-
end
|
227
|
+
)
|
220
228
|
|
221
229
|
Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
|
222
230
|
#{CACHED_ISOBIB_BLANK_HDR}
|
@@ -226,9 +234,9 @@ EOS
|
|
226
234
|
* [[[iso123,ISO 123:2001]]] _Standard_
|
227
235
|
INPUT
|
228
236
|
|
229
|
-
|
230
|
-
|
231
|
-
expect(
|
237
|
+
entry = db.load_entry("ISO 123:2001")
|
238
|
+
expect(entry["fetched"].to_s).to eq((Date.today - 90).to_s)
|
239
|
+
expect(entry["bib"].to_xml).to be_equivalent_to(ISO_123_SHORT)
|
232
240
|
|
233
241
|
system "rm ~/.relaton-bib.json"
|
234
242
|
system "mv ~/.relaton-bib.json1 ~/.relaton-bib.json"
|
@@ -238,35 +246,35 @@ EOS
|
|
238
246
|
system "mv ~/.relaton-bib.json ~/.relaton-bib.json1"
|
239
247
|
system "rm test.relaton.json"
|
240
248
|
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
"fetched"
|
245
|
-
"bib"
|
246
|
-
},
|
247
|
-
"ISO 124": {
|
248
|
-
"fetched": Date.today.to_s,
|
249
|
-
"bib": ISO_124_SHORT
|
249
|
+
db = Relaton::Db.new "#{Dir.home}/.relaton-bib.json", nil
|
250
|
+
db.save_entry("ISO 123:2001",
|
251
|
+
{
|
252
|
+
"fetched" => Date.today.to_s,
|
253
|
+
"bib" => IsoBibItem.from_xml(ISO_123_SHORT)
|
250
254
|
}
|
251
|
-
|
252
|
-
|
255
|
+
)
|
256
|
+
db.save_entry("ISO 124",
|
257
|
+
{
|
258
|
+
"fetched" => Date.today.to_s,
|
259
|
+
"bib" => IsoBibItem.from_xml(ISO_124_SHORT)
|
260
|
+
}
|
261
|
+
)
|
253
262
|
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
"fetched"
|
258
|
-
"bib"
|
263
|
+
localdb = Relaton::Db.new "test.relaton.json", nil
|
264
|
+
localdb.save_entry("ISO 124",
|
265
|
+
{
|
266
|
+
"fetched" => Date.today.to_s,
|
267
|
+
"bib" => IsoBibItem.from_xml(ISO_124_SHORT_ALT)
|
259
268
|
}
|
260
|
-
|
261
|
-
end
|
269
|
+
)
|
262
270
|
|
263
271
|
input = <<~EOS
|
264
272
|
#{LOCAL_CACHED_ISOBIB_BLANK_HDR}
|
265
273
|
[bibliography]
|
266
274
|
== Normative References
|
267
275
|
|
268
|
-
* [[[
|
269
|
-
* [[[
|
276
|
+
* [[[ISO123,ISO 123:2001]]] _Standard_
|
277
|
+
* [[[ISO124,ISO 124]]] _Standard_
|
270
278
|
EOS
|
271
279
|
|
272
280
|
output = <<~EOS
|
@@ -284,19 +292,10 @@ EOS
|
|
284
292
|
|
285
293
|
expect(strip_guid(Asciidoctor.convert(input, backend: :iso, header_footer: true))).to be_equivalent_to(output)
|
286
294
|
|
287
|
-
|
288
|
-
|
289
|
-
expect(
|
290
|
-
expect(
|
291
|
-
expect(json["ISO 123:2001"]["bib"]).to be_equivalent_to(ISO_123_SHORT)
|
292
|
-
expect(json["ISO 124"]["bib"]).to be_equivalent_to(ISO_124_SHORT)
|
293
|
-
|
294
|
-
json_local = JSON.parse(File.read("test.relaton.json", encoding: "utf-8"))
|
295
|
-
|
296
|
-
expect(json_local["ISO 123:2001"]["fetched"]).to eq(Date.today.to_s)
|
297
|
-
expect(json_local["ISO 124"]["fetched"]).to eq(Date.today.to_s)
|
298
|
-
expect(json_local["ISO 123:2001"]["bib"]).to be_equivalent_to(ISO_123_SHORT)
|
299
|
-
expect(json_local["ISO 124"]["bib"]).to be_equivalent_to(ISO_124_SHORT_ALT)
|
295
|
+
expect(db.load_entry("ISO 123:2001")["bib"].to_xml).to be_equivalent_to(ISO_123_SHORT)
|
296
|
+
expect(db.load_entry("ISO 124")["bib"].to_xml).to be_equivalent_to(ISO_124_SHORT)
|
297
|
+
expect(localdb.load_entry("ISO 123:2001")["bib"].to_xml).to be_equivalent_to(ISO_123_SHORT)
|
298
|
+
expect(localdb.load_entry("ISO 124")["bib"].to_xml).to be_equivalent_to(ISO_124_SHORT_ALT)
|
300
299
|
|
301
300
|
system "rm ~/.relaton-bib.json"
|
302
301
|
system "mv ~/.relaton-bib.json1 ~/.relaton-bib.json"
|
@@ -305,15 +304,15 @@ EOS
|
|
305
304
|
private
|
306
305
|
|
307
306
|
def mock_isobib_get_123
|
308
|
-
expect(Isobib::IsoBibliography).to receive(:get).with("ISO 123", "2001", {}).and_return(ISOBIB_123_DATED)
|
307
|
+
expect(Isobib::IsoBibliography).to receive(:get).with("ISO 123", "2001", {}).and_return(IsoBibItem.from_xml(ISOBIB_123_DATED))
|
309
308
|
end
|
310
309
|
|
311
310
|
def mock_isobib_get_123_undated
|
312
|
-
expect(Isobib::IsoBibliography).to receive(:get).with("ISO 123", nil, {}).and_return(ISOBIB_123_UNDATED)
|
311
|
+
expect(Isobib::IsoBibliography).to receive(:get).with("ISO 123", nil, {}).and_return(IsoBibItem.from_xml(ISOBIB_123_UNDATED))
|
313
312
|
end
|
314
313
|
|
315
314
|
def mock_isobib_get_124
|
316
|
-
expect(Isobib::IsoBibliography).to receive(:get).with("ISO 124", "2014", {}).and_return(ISOBIB_124_DATED)
|
315
|
+
expect(Isobib::IsoBibliography).to receive(:get).with("ISO 124", "2014", {}).and_return(IsoBibItem.from_xml(ISOBIB_124_DATED))
|
317
316
|
end
|
318
317
|
|
319
318
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require "spec_helper"
|
2
|
+
require "isobib"
|
2
3
|
|
3
4
|
RSpec.describe Asciidoctor::ISO do
|
4
5
|
it "processes simple ISO reference" do
|
@@ -80,9 +81,9 @@ RSpec.describe Asciidoctor::ISO do
|
|
80
81
|
<bibitem type="international-standard" id="iso123">
|
81
82
|
<title format="text/plain" language="en" script="Latn">Rubber latex -- Sampling</title>
|
82
83
|
<title format="text/plain" language="fr" script="Latn">Latex de caoutchouc -- ?chantillonnage</title>
|
83
|
-
<
|
84
|
-
<
|
85
|
-
<
|
84
|
+
<uri type="src">https://www.iso.org/standard/23281.html</uri>
|
85
|
+
<uri type="obp">https://www.iso.org/obp/ui/#!iso:std:23281:en</uri>
|
86
|
+
<uri type="rss">https://www.iso.org/contents/data/standard/02/32/23281.detail.rss</uri>
|
86
87
|
<docidentifier>ISO 123</docidentifier>
|
87
88
|
<date type="published">
|
88
89
|
<on>2001</on>
|
@@ -112,13 +113,11 @@ RSpec.describe Asciidoctor::ISO do
|
|
112
113
|
<relation type="obsoletes">
|
113
114
|
<bibitem>
|
114
115
|
<formattedref>ISO 123:1985</formattedref>
|
115
|
-
<docidentifier>ISO 123:1985</docidentifier>
|
116
116
|
</bibitem>
|
117
117
|
</relation>
|
118
118
|
<relation type="updates">
|
119
119
|
<bibitem>
|
120
120
|
<formattedref>ISO 123:2001</formattedref>
|
121
|
-
<docidentifier>ISO 123:2001</docidentifier>
|
122
121
|
</bibitem>
|
123
122
|
</relation>
|
124
123
|
</bibitem>
|
@@ -175,9 +174,9 @@ RSpec.describe Asciidoctor::ISO do
|
|
175
174
|
<bibitem type="international-standard" id="iso123">
|
176
175
|
<title format="text/plain" language="en" script="Latn">Permuted index of the vocabulary of information technology</title>
|
177
176
|
<title format="text/plain" language="fr" script="Latn">Index permuté du vocabulaire des technologies de l'information</title>
|
178
|
-
<
|
179
|
-
<
|
180
|
-
<
|
177
|
+
<uri type="src">https://www.iso.org/standard/21071.html</uri>
|
178
|
+
<uri type="obp">https://www.iso.org/obp/ui/#!iso:std:21071:en</uri>
|
179
|
+
<uri type="rss">https://www.iso.org/contents/data/standard/02/10/21071.detail.rss</uri>
|
181
180
|
<docidentifier>ISO/IEC 12382</docidentifier>
|
182
181
|
<date type="published">
|
183
182
|
<on>1992</on>
|
@@ -216,7 +215,6 @@ RSpec.describe Asciidoctor::ISO do
|
|
216
215
|
<relation type="updates">
|
217
216
|
<bibitem>
|
218
217
|
<formattedref>ISO/IEC TR 12382:1992</formattedref>
|
219
|
-
<docidentifier>ISO/IEC TR 12382:1992</docidentifier>
|
220
218
|
</bibitem>
|
221
219
|
</relation>
|
222
220
|
<ics>
|
@@ -231,9 +229,9 @@ RSpec.describe Asciidoctor::ISO do
|
|
231
229
|
<bibitem type="international-standard" id="iso124">
|
232
230
|
<title format="text/plain" language="en" script="Latn">Latex, rubber -- Determination of total solids content</title>
|
233
231
|
<title format="text/plain" language="fr" script="Latn">Latex de caoutchouc -- Détermination des matières solides totales</title>
|
234
|
-
<
|
235
|
-
<
|
236
|
-
<
|
232
|
+
<uri type="src">https://www.iso.org/standard/61884.html</uri>
|
233
|
+
<uri type="obp">https://www.iso.org/obp/ui/#!iso:std:61884:en</uri>
|
234
|
+
<uri type="rss">https://www.iso.org/contents/data/standard/06/18/61884.detail.rss</uri>
|
237
235
|
<docidentifier>ISO 124</docidentifier>
|
238
236
|
<date type="published">
|
239
237
|
<on>2014</on>
|
@@ -264,7 +262,6 @@ RSpec.describe Asciidoctor::ISO do
|
|
264
262
|
<relation type="obsoletes">
|
265
263
|
<bibitem>
|
266
264
|
<formattedref>ISO 124:2011</formattedref>
|
267
|
-
<docidentifier>ISO 124:2011</docidentifier>
|
268
265
|
</bibitem>
|
269
266
|
</relation>
|
270
267
|
<ics>
|
@@ -482,21 +479,21 @@ RSpec.describe Asciidoctor::ISO do
|
|
482
479
|
|
483
480
|
def mock_isobib_get_123
|
484
481
|
expect(Isobib::IsoBibliography).to receive(:get).with("ISO 123", nil, {}) do
|
485
|
-
<<~"OUTPUT"
|
486
|
-
<bibitem type=\"international-standard\" id=\"ISO123\">\n <title format=\"text/plain\" language=\"en\" script=\"Latn\">Rubber latex -- Sampling</title>\n <title format=\"text/plain\" language=\"fr\" script=\"Latn\">Latex de caoutchouc -- ?chantillonnage</title>\n <
|
482
|
+
IsoBibItem.from_xml(<<~"OUTPUT")
|
483
|
+
<bibitem type=\"international-standard\" id=\"ISO123\">\n <title format=\"text/plain\" language=\"en\" script=\"Latn\">Rubber latex -- Sampling</title>\n <title format=\"text/plain\" language=\"fr\" script=\"Latn\">Latex de caoutchouc -- ?chantillonnage</title>\n <uri type=\"src\">https://www.iso.org/standard/23281.html</uri>\n <uri type=\"obp\">https://www.iso.org/obp/ui/#!iso:std:23281:en</uri>\n <uri type=\"rss\">https://www.iso.org/contents/data/standard/02/32/23281.detail.rss</uri>\n <docidentifier>ISO 123</docidentifier>\n <date type=\"published\">\n <on>2001</on>\n </date>\n <contributor>\n <role type=\"publisher\"/>\n <organization>\n <name>International Organization for Standardization</name>\n <abbreviation>ISO</abbreviation>\n <uri>www.iso.org</uri>\n </organization>\n </contributor>\n <edition>3</edition>\n <language>en</language>\n <language>fr</language>\n <script>Latn</script>\n <status>Published</status>\n <copyright>\n <from>2001</from>\n <owner>\n <organization>\n <name>ISO</name>\n <abbreviation></abbreviation>\n </organization>\n </owner>\n </copyright>\n <relation type=\"obsoletes\">\n <bibitem>\n <formattedref>ISO 123:1985</formattedref>\n </bibitem>\n </relation>\n <relation type=\"updates\">\n <bibitem>\n <formattedref>ISO 123:2001</formattedref>\n </bibitem>\n </relation>\n</bibitem>
|
487
484
|
OUTPUT
|
488
485
|
end
|
489
486
|
end
|
490
487
|
|
491
488
|
def mock_isobib_get_124
|
492
489
|
expect(Isobib::IsoBibliography).to receive(:get).with("ISO 124", "2014", {}) do
|
493
|
-
<<~"OUTPUT"
|
490
|
+
IsoBibItem.from_xml(<<~"OUTPUT")
|
494
491
|
<bibitem type="international-standard" id="iso124">
|
495
492
|
<title format="text/plain" language="en" script="Latn">Latex, rubber -- Determination of total solids content</title>
|
496
493
|
<title format="text/plain" language="fr" script="Latn">Latex de caoutchouc -- Détermination des matières solides totales</title>
|
497
|
-
<
|
498
|
-
<
|
499
|
-
<
|
494
|
+
<uri type="src">https://www.iso.org/standard/61884.html</uri>
|
495
|
+
<uri type="obp">https://www.iso.org/obp/ui/#!iso:std:61884:en</uri>
|
496
|
+
<uri type="rss">https://www.iso.org/contents/data/standard/06/18/61884.detail.rss</uri>
|
500
497
|
<docidentifier>ISO 124</docidentifier>
|
501
498
|
<date type="published">
|
502
499
|
<on>2014</on>
|
@@ -527,7 +524,6 @@ RSpec.describe Asciidoctor::ISO do
|
|
527
524
|
<relation type="obsoletes">
|
528
525
|
<bibitem>
|
529
526
|
<formattedref>ISO 124:2011</formattedref>
|
530
|
-
<docidentifier>ISO 124:2011</docidentifier>
|
531
527
|
</bibitem>
|
532
528
|
</relation>
|
533
529
|
<ics>
|
@@ -541,13 +537,13 @@ RSpec.describe Asciidoctor::ISO do
|
|
541
537
|
|
542
538
|
def mock_isobib_get_iec12382
|
543
539
|
expect(Isobib::IsoBibliography).to receive(:get).with("ISO/IEC TR 12382", "1992", {}) do
|
544
|
-
<<~"OUTPUT"
|
540
|
+
IsoBibItem.from_xml(<<~"OUTPUT")
|
545
541
|
<bibitem type="international-standard" id="iso123">
|
546
542
|
<title format="text/plain" language="en" script="Latn">Permuted index of the vocabulary of information technology</title>
|
547
543
|
<title format="text/plain" language="fr" script="Latn">Index permuté du vocabulaire des technologies de l'information</title>
|
548
|
-
<
|
549
|
-
<
|
550
|
-
<
|
544
|
+
<uri type="src">https://www.iso.org/standard/21071.html</uri>
|
545
|
+
<uri type="obp">https://www.iso.org/obp/ui/#!iso:std:21071:en</uri>
|
546
|
+
<uri type="rss">https://www.iso.org/contents/data/standard/02/10/21071.detail.rss</uri>
|
551
547
|
<docidentifier>ISO/IEC 12382</docidentifier>
|
552
548
|
<date type="published">
|
553
549
|
<on>1992</on>
|
@@ -586,7 +582,6 @@ RSpec.describe Asciidoctor::ISO do
|
|
586
582
|
<relation type="updates">
|
587
583
|
<bibitem>
|
588
584
|
<formattedref>ISO/IEC TR 12382:1992</formattedref>
|
589
|
-
<docidentifier>ISO/IEC TR 12382:1992</docidentifier>
|
590
585
|
</bibitem>
|
591
586
|
</relation>
|
592
587
|
<ics>
|
@@ -50,6 +50,19 @@ RSpec.describe "warn that scope may contain recommendation" do
|
|
50
50
|
INPUT
|
51
51
|
end
|
52
52
|
|
53
|
+
RSpec.describe "warn that definition may contain requirement" do
|
54
|
+
specify { expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(/Definition may contain requirement/).to_stderr }
|
55
|
+
#{VALIDATING_BLANK_HDR}
|
56
|
+
|
57
|
+
== Terms and Definitions
|
58
|
+
|
59
|
+
=== Term1
|
60
|
+
|
61
|
+
It is required that there is a definition.
|
62
|
+
|
63
|
+
INPUT
|
64
|
+
end
|
65
|
+
|
53
66
|
RSpec.describe "warn that term example may contain recommendation" do
|
54
67
|
specify { expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(/Term Example may contain recommendation/).to_stderr }
|
55
68
|
#{VALIDATING_BLANK_HDR}
|
@@ -120,6 +133,19 @@ RSpec.describe "term source is not a real reference" do
|
|
120
133
|
INPUT
|
121
134
|
end
|
122
135
|
|
136
|
+
RSpec.describe "undated reference has locality" do
|
137
|
+
specify { expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(/undated reference ISO 123 should not contain specific elements/).to_stderr }
|
138
|
+
#{VALIDATING_BLANK_HDR}
|
139
|
+
|
140
|
+
== Scope
|
141
|
+
<<iso123,clause=1>>
|
142
|
+
|
143
|
+
[bibliography]
|
144
|
+
== Normative References
|
145
|
+
* [[[iso123,ISO 123]]] _Standard_
|
146
|
+
INPUT
|
147
|
+
end
|
148
|
+
|
123
149
|
RSpec.describe "Non-reference in bibliography" do
|
124
150
|
specify { expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(/no anchor on reference/).to_stderr }
|
125
151
|
#{VALIDATING_BLANK_HDR}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: asciidoctor-iso
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-07-
|
11
|
+
date: 2018-07-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: asciidoctor
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 0.
|
75
|
+
version: 0.1.1
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 0.
|
82
|
+
version: 0.1.1
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: bundler
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -234,6 +234,20 @@ dependencies:
|
|
234
234
|
- - "~>"
|
235
235
|
- !ruby/object:Gem::Version
|
236
236
|
version: 0.2.6
|
237
|
+
- !ruby/object:Gem::Dependency
|
238
|
+
name: isobib
|
239
|
+
requirement: !ruby/object:Gem::Requirement
|
240
|
+
requirements:
|
241
|
+
- - "~>"
|
242
|
+
- !ruby/object:Gem::Version
|
243
|
+
version: 0.2.0
|
244
|
+
type: :development
|
245
|
+
prerelease: false
|
246
|
+
version_requirements: !ruby/object:Gem::Requirement
|
247
|
+
requirements:
|
248
|
+
- - "~>"
|
249
|
+
- !ruby/object:Gem::Version
|
250
|
+
version: 0.2.0
|
237
251
|
description: |
|
238
252
|
asciidoctor-iso lets you write ISO standards in AsciiDoc syntax.
|
239
253
|
|
@@ -263,6 +277,7 @@ files:
|
|
263
277
|
- bin/rspec
|
264
278
|
- docs/customisation.adoc
|
265
279
|
- docs/guidance.adoc
|
280
|
+
- docs/htmloutput.adoc
|
266
281
|
- docs/quickstart.adoc
|
267
282
|
- lib/asciidoctor-iso.rb
|
268
283
|
- lib/asciidoctor/iso/base.rb
|