metanorma-standoc 1.0.11 → 1.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +14 -15
- data/README.adoc +10 -2
- data/lib/asciidoctor/standoc/base.rb +1 -1
- data/lib/asciidoctor/standoc/blocks.rb +6 -1
- data/lib/asciidoctor/standoc/cleanup.rb +11 -0
- data/lib/asciidoctor/standoc/front.rb +27 -5
- data/lib/asciidoctor/standoc/isodoc.rng +22 -0
- data/lib/asciidoctor/standoc/utils.rb +6 -3
- data/lib/metanorma/standoc/version.rb +1 -1
- data/metanorma-standoc.gemspec +1 -1
- data/spec/asciidoctor-standoc/base_spec.rb +9 -5
- data/spec/asciidoctor-standoc/blocks_spec.rb +23 -7
- data/spec/asciidoctor-standoc/cleanup_spec.rb +98 -4
- data/spec/asciidoctor-standoc/inline_spec.rb +1 -1
- data/spec/asciidoctor-standoc/refs_spec.rb +3 -2
- data/spec/spec_helper.rb +12 -0
- data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +20 -40
- metadata +6 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: df3bc5fdf41e7916256d3f763868f63c5bd8fe02365db0fe5d37d1efcaedda7e
|
|
4
|
+
data.tar.gz: 051d1a4cb3849e2b843feb62290f557d3ef07182a23699c4bbc1312345f1d143
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2f7c94c8c0a8e81a9b064e4e679fcb2b48801a991d2d75aa852870a596879b0d9c4b9090c63fb03c789a712a2a2cf5de85ea92699318f91773236533dfc48a6d
|
|
7
|
+
data.tar.gz: ffac3ee6a7820406d9a138839e65e3e57cc073298335930999040ac7ba71c2e5126b94f99e94fcde403669a2edc95818de440d5eaebf63412c09acce39c923b8
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
metanorma-standoc (1.0.
|
|
4
|
+
metanorma-standoc (1.0.12)
|
|
5
5
|
asciidoctor (~> 1.5.7)
|
|
6
6
|
concurrent-ruby
|
|
7
7
|
iev (~> 0.2.0)
|
|
@@ -15,7 +15,7 @@ GEM
|
|
|
15
15
|
specs:
|
|
16
16
|
addressable (2.5.2)
|
|
17
17
|
public_suffix (>= 2.0.2, < 4.0)
|
|
18
|
-
algoliasearch (1.
|
|
18
|
+
algoliasearch (1.24.0)
|
|
19
19
|
httpclient (~> 2.8, >= 2.8.3)
|
|
20
20
|
json (>= 1.5.1)
|
|
21
21
|
asciidoctor (1.5.8)
|
|
@@ -34,7 +34,7 @@ GEM
|
|
|
34
34
|
ffi (1.9.25)
|
|
35
35
|
formatador (0.2.5)
|
|
36
36
|
gb-agencies (0.0.5)
|
|
37
|
-
gbbib (0.4.
|
|
37
|
+
gbbib (0.4.3)
|
|
38
38
|
cnccs (~> 0.1.1)
|
|
39
39
|
gb-agencies (~> 0.0.1)
|
|
40
40
|
iso-bib-item (~> 0.4.2)
|
|
@@ -64,10 +64,10 @@ GEM
|
|
|
64
64
|
uuidtools
|
|
65
65
|
htmlentities (4.3.4)
|
|
66
66
|
httpclient (2.8.3)
|
|
67
|
-
iecbib (0.2.
|
|
67
|
+
iecbib (0.2.2)
|
|
68
68
|
addressable
|
|
69
69
|
iso-bib-item (~> 0.4.2)
|
|
70
|
-
ietfbib (0.4.
|
|
70
|
+
ietfbib (0.4.5)
|
|
71
71
|
iso-bib-item (~> 0.4.2)
|
|
72
72
|
iev (0.2.0)
|
|
73
73
|
nokogiri
|
|
@@ -76,11 +76,11 @@ GEM
|
|
|
76
76
|
isoics (~> 0.1.6)
|
|
77
77
|
nokogiri (~> 1.8.4)
|
|
78
78
|
ruby_deep_clone (~> 0.8.0)
|
|
79
|
-
isobib (0.4.
|
|
79
|
+
isobib (0.4.2)
|
|
80
80
|
algoliasearch
|
|
81
81
|
iecbib (~> 0.2.1)
|
|
82
82
|
iso-bib-item (~> 0.4.2)
|
|
83
|
-
isodoc (0.9.
|
|
83
|
+
isodoc (0.9.12)
|
|
84
84
|
asciimath
|
|
85
85
|
html2doc (~> 0.8.6)
|
|
86
86
|
htmlentities (~> 4.3.4)
|
|
@@ -94,7 +94,6 @@ GEM
|
|
|
94
94
|
thread_safe
|
|
95
95
|
uuidtools
|
|
96
96
|
isoics (0.1.7)
|
|
97
|
-
jaro_winkler (1.5.1)
|
|
98
97
|
json (2.1.0)
|
|
99
98
|
liquid (4.0.1)
|
|
100
99
|
listen (3.1.5)
|
|
@@ -102,7 +101,8 @@ GEM
|
|
|
102
101
|
rb-inotify (~> 0.9, >= 0.9.7)
|
|
103
102
|
ruby_dep (~> 1.2)
|
|
104
103
|
lumberjack (1.0.13)
|
|
105
|
-
metanorma (0.3.
|
|
104
|
+
metanorma (0.3.5)
|
|
105
|
+
asciidoctor
|
|
106
106
|
method_source (0.9.2)
|
|
107
107
|
mime-types (3.2.2)
|
|
108
108
|
mime-types-data (~> 3.2015)
|
|
@@ -124,7 +124,7 @@ GEM
|
|
|
124
124
|
method_source (~> 0.9.0)
|
|
125
125
|
public_suffix (3.0.3)
|
|
126
126
|
rainbow (3.0.0)
|
|
127
|
-
rake (12.3.
|
|
127
|
+
rake (12.3.2)
|
|
128
128
|
rb-fsevent (0.10.3)
|
|
129
129
|
rb-inotify (0.9.10)
|
|
130
130
|
ffi (>= 0.5.0, < 2)
|
|
@@ -149,14 +149,13 @@ GEM
|
|
|
149
149
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
150
150
|
rspec-support (~> 3.8.0)
|
|
151
151
|
rspec-support (3.8.0)
|
|
152
|
-
rubocop (0.
|
|
153
|
-
jaro_winkler (~> 1.5.1)
|
|
152
|
+
rubocop (0.54.0)
|
|
154
153
|
parallel (~> 1.10)
|
|
155
|
-
parser (>= 2.5
|
|
154
|
+
parser (>= 2.5)
|
|
156
155
|
powerpack (~> 0.1)
|
|
157
156
|
rainbow (>= 2.2.2, < 4.0)
|
|
158
157
|
ruby-progressbar (~> 1.7)
|
|
159
|
-
unicode-display_width (~> 1.
|
|
158
|
+
unicode-display_width (~> 1.0, >= 1.0.1)
|
|
160
159
|
ruby-jing (0.0.1)
|
|
161
160
|
optout (>= 0.0.2)
|
|
162
161
|
ruby-progressbar (1.10.0)
|
|
@@ -204,7 +203,7 @@ DEPENDENCIES
|
|
|
204
203
|
metanorma-standoc!
|
|
205
204
|
rake (~> 12.0)
|
|
206
205
|
rspec (~> 3.6)
|
|
207
|
-
rubocop (
|
|
206
|
+
rubocop (= 0.54.0)
|
|
208
207
|
simplecov (~> 0.15)
|
|
209
208
|
timecop (~> 0.9)
|
|
210
209
|
vcr
|
data/README.adoc
CHANGED
|
@@ -577,7 +577,8 @@ the document was issued
|
|
|
577
577
|
|
|
578
578
|
`: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.)
|
|
579
579
|
|
|
580
|
-
`:title:` :: The title of the document
|
|
580
|
+
`:title:` :: The title of the document. If not supplied, the built-in Asciidoctor title (first line of document header) is used instead.
|
|
581
|
+
`:title-XX:` :: The title of the document in the language `XX` (presumed to be a ISO 639-1 code).
|
|
581
582
|
|
|
582
583
|
`:doctype:`:: The document type; e.g. "standard", "guide", "report".
|
|
583
584
|
|
|
@@ -667,7 +668,14 @@ which adheres with ISO formatting requirements. Recommend against overriding thi
|
|
|
667
668
|
|
|
668
669
|
`:olstyle`:: Word CSS selector for ordered lists in supplied stylesheets. Defaults to value for built in stylesheet. Recommend against overriding this.
|
|
669
670
|
|
|
670
|
-
`:data-uri-image`:: Encode all images in HTML output as inline data-URIs.
|
|
671
|
+
`:data-uri-image`:: Encode all images in HTML output as inline data-URIs. Defaults to true.
|
|
672
|
+
|
|
673
|
+
`:smartquotes`:: Apply smartquotes and other autoformatting to the XML output (and hence the downstream outputs)
|
|
674
|
+
(default true). The rules for
|
|
675
|
+
smart formatting follow the https://github.com/pbhogan/sterile[sterile] gem, and are given in
|
|
676
|
+
https://github.com/pbhogan/sterile/blob/master/lib/sterile/data/smart_format_rules.rb. If `:smartquotes:`
|
|
677
|
+
is set to `false`, then the Asciidoctor default is used to generate smart quotes: `"` `"`, `'` `'`.
|
|
678
|
+
|
|
671
679
|
|
|
672
680
|
The attribute `:draft:`, if present, includes review notes in the XML output;
|
|
673
681
|
these are otherwise suppressed.
|
|
@@ -81,6 +81,7 @@ module Asciidoctor
|
|
|
81
81
|
@anchors = {}
|
|
82
82
|
@draft = node.attributes.has_key?("draft")
|
|
83
83
|
@novalid = node.attr("novalid")
|
|
84
|
+
@smartquotes = node.attr("smartquotes") != "false"
|
|
84
85
|
@fontheader = default_fonts(node)
|
|
85
86
|
@files_to_delete = []
|
|
86
87
|
@filename = node.attr("docfile") ?
|
|
@@ -169,7 +170,6 @@ module Asciidoctor
|
|
|
169
170
|
xml.bibdata **attr_code(type: doctype(node)) do |b|
|
|
170
171
|
metadata node, b
|
|
171
172
|
end
|
|
172
|
-
metadata_version(node, xml)
|
|
173
173
|
end
|
|
174
174
|
|
|
175
175
|
def middle(node, xml)
|
|
@@ -20,7 +20,12 @@ module Asciidoctor
|
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
def literal(node)
|
|
23
|
-
|
|
23
|
+
noko do |xml|
|
|
24
|
+
xml.figure **id_attr(node) do |f|
|
|
25
|
+
figure_title(node, f)
|
|
26
|
+
f.pre node.lines.join("\n"), **{ id: Utils::anchor_or_uuid }
|
|
27
|
+
end
|
|
28
|
+
end
|
|
24
29
|
end
|
|
25
30
|
|
|
26
31
|
# NOTE: html escaping is performed by Nokogiri
|
|
@@ -40,6 +40,17 @@ module Asciidoctor
|
|
|
40
40
|
script_cleanup(xmldoc)
|
|
41
41
|
docidentifier_cleanup(xmldoc)
|
|
42
42
|
bookmark_cleanup(xmldoc)
|
|
43
|
+
smartquotes_cleanup(xmldoc)
|
|
44
|
+
xmldoc
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def smartquotes_cleanup(xmldoc)
|
|
48
|
+
return unless @smartquotes
|
|
49
|
+
xmldoc.traverse do |n|
|
|
50
|
+
next unless n.text?
|
|
51
|
+
next unless n.ancestors("pre, tt, sourcecode, bibdata").empty?
|
|
52
|
+
n.replace(Utils::smartformat(n.text))
|
|
53
|
+
end
|
|
43
54
|
xmldoc
|
|
44
55
|
end
|
|
45
56
|
|
|
@@ -19,8 +19,8 @@ module Asciidoctor
|
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
def metadata_version(node, xml)
|
|
22
|
+
xml.edition node.attr("edition") if node.attr("edition")
|
|
22
23
|
xml.version do |v|
|
|
23
|
-
v.edition node.attr("edition") if node.attr("edition")
|
|
24
24
|
v.revision_date node.attr("revdate") if node.attr("revdate")
|
|
25
25
|
v.draft node.attr("draft") if node.attr("draft")
|
|
26
26
|
end
|
|
@@ -113,7 +113,7 @@ module Asciidoctor
|
|
|
113
113
|
end
|
|
114
114
|
|
|
115
115
|
DATETYPES = %w{ published accessed created implemented obsoleted
|
|
116
|
-
confirmed updated issued circulated unchanged
|
|
116
|
+
confirmed updated issued circulated unchanged received
|
|
117
117
|
}.freeze
|
|
118
118
|
|
|
119
119
|
def metadata_date(node, xml)
|
|
@@ -128,15 +128,24 @@ module Asciidoctor
|
|
|
128
128
|
end
|
|
129
129
|
end
|
|
130
130
|
|
|
131
|
+
def metadata_language(node, xml)
|
|
132
|
+
xml.language (node.attr("language") || "en")
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
def metadata_script(node, xml)
|
|
136
|
+
xml.script (node.attr("script") || "Latn")
|
|
137
|
+
end
|
|
138
|
+
|
|
131
139
|
def metadata(node, xml)
|
|
132
140
|
title node, xml
|
|
133
141
|
metadata_source(node, xml)
|
|
134
142
|
metadata_id(node, xml)
|
|
135
143
|
metadata_date(node, xml)
|
|
144
|
+
metadata_version(node, xml)
|
|
136
145
|
metadata_author(node, xml)
|
|
137
146
|
metadata_publisher(node, xml)
|
|
138
|
-
|
|
139
|
-
|
|
147
|
+
metadata_language(node, xml)
|
|
148
|
+
metadata_script(node, xml)
|
|
140
149
|
metadata_status(node, xml)
|
|
141
150
|
metadata_copyright(node, xml)
|
|
142
151
|
metadata_committee(node, xml)
|
|
@@ -152,13 +161,26 @@ module Asciidoctor
|
|
|
152
161
|
end
|
|
153
162
|
|
|
154
163
|
def title(node, xml)
|
|
164
|
+
title_english(node, xml)
|
|
165
|
+
title_otherlangs(node, xml)
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
def title_english(node, xml)
|
|
155
169
|
["en"].each do |lang|
|
|
156
170
|
at = { language: lang, format: "text/plain" }
|
|
157
171
|
xml.title **attr_code(at) do |t|
|
|
158
|
-
t << asciidoc_sub(node.attr("title"))
|
|
172
|
+
t << asciidoc_sub(node.attr("title") || node.attr("title-en") || node.title)
|
|
159
173
|
end
|
|
160
174
|
end
|
|
161
175
|
end
|
|
176
|
+
|
|
177
|
+
def title_otherlangs(node, xml)
|
|
178
|
+
node.attributes.each do |k, v|
|
|
179
|
+
next unless /^title-(?<titlelang>.+)$/ =~ k
|
|
180
|
+
next if titlelang == "en"
|
|
181
|
+
xml.title v, { language: titlelang, format: "text/plain" }
|
|
182
|
+
end
|
|
183
|
+
end
|
|
162
184
|
end
|
|
163
185
|
end
|
|
164
186
|
end
|
|
@@ -384,6 +384,7 @@
|
|
|
384
384
|
<ref name="sourcecode"/>
|
|
385
385
|
<ref name="example"/>
|
|
386
386
|
<ref name="review"/>
|
|
387
|
+
<ref name="pre"/>
|
|
387
388
|
</choice>
|
|
388
389
|
</define>
|
|
389
390
|
<define name="paragraph">
|
|
@@ -540,6 +541,20 @@
|
|
|
540
541
|
</zeroOrMore>
|
|
541
542
|
</element>
|
|
542
543
|
</define>
|
|
544
|
+
<define name="pre">
|
|
545
|
+
<element name="pre">
|
|
546
|
+
<attribute name="id">
|
|
547
|
+
<data type="ID"/>
|
|
548
|
+
</attribute>
|
|
549
|
+
<optional>
|
|
550
|
+
<ref name="tname"/>
|
|
551
|
+
</optional>
|
|
552
|
+
<text/>
|
|
553
|
+
<zeroOrMore>
|
|
554
|
+
<ref name="note"/>
|
|
555
|
+
</zeroOrMore>
|
|
556
|
+
</element>
|
|
557
|
+
</define>
|
|
543
558
|
<define name="table">
|
|
544
559
|
<element name="table">
|
|
545
560
|
<attribute name="id">
|
|
@@ -710,6 +725,7 @@
|
|
|
710
725
|
</optional>
|
|
711
726
|
<choice>
|
|
712
727
|
<ref name="image"/>
|
|
728
|
+
<ref name="pre"/>
|
|
713
729
|
<zeroOrMore>
|
|
714
730
|
<ref name="figure"/>
|
|
715
731
|
</zeroOrMore>
|
|
@@ -735,6 +751,7 @@
|
|
|
735
751
|
<ref name="sub"/>
|
|
736
752
|
<ref name="sup"/>
|
|
737
753
|
<ref name="tt"/>
|
|
754
|
+
<ref name="keyword"/>
|
|
738
755
|
<ref name="strike"/>
|
|
739
756
|
<ref name="smallcap"/>
|
|
740
757
|
<ref name="xref"/>
|
|
@@ -765,6 +782,11 @@
|
|
|
765
782
|
<text/>
|
|
766
783
|
</element>
|
|
767
784
|
</define>
|
|
785
|
+
<define name="keyword">
|
|
786
|
+
<element name="keyword">
|
|
787
|
+
<text/>
|
|
788
|
+
</element>
|
|
789
|
+
</define>
|
|
768
790
|
<define name="sub">
|
|
769
791
|
<element name="sub">
|
|
770
792
|
<text/>
|
|
@@ -32,14 +32,17 @@ module Asciidoctor
|
|
|
32
32
|
"??"
|
|
33
33
|
end
|
|
34
34
|
|
|
35
|
+
def smartformat(n)
|
|
36
|
+
n.gsub(/ -- /, " — ").
|
|
37
|
+
gsub(/--/, "—").smart_format
|
|
38
|
+
end
|
|
39
|
+
|
|
35
40
|
def smart_render_xml(x)
|
|
36
41
|
xstr = x.to_xml if x.respond_to? :to_xml
|
|
37
42
|
xml = Nokogiri::XML(xstr)
|
|
38
43
|
xml.traverse do |n|
|
|
39
44
|
next unless n.text?
|
|
40
|
-
n.replace(n.text
|
|
41
|
-
gsub(/--/, "—").gsub(/\.\.\./, "…").
|
|
42
|
-
smart_format)
|
|
45
|
+
n.replace(smartformat(n.text))
|
|
43
46
|
end
|
|
44
47
|
xml.to_xml.sub(/<\?[^>]+>/, "")
|
|
45
48
|
end
|
data/metanorma-standoc.gemspec
CHANGED
|
@@ -41,7 +41,7 @@ Gem::Specification.new do |spec|
|
|
|
41
41
|
spec.add_development_dependency "guard-rspec", "~> 4.7"
|
|
42
42
|
spec.add_development_dependency "rake", "~> 12.0"
|
|
43
43
|
spec.add_development_dependency "rspec", "~> 3.6"
|
|
44
|
-
spec.add_development_dependency "rubocop", "
|
|
44
|
+
spec.add_development_dependency "rubocop", "= 0.54.0"
|
|
45
45
|
spec.add_development_dependency "simplecov", "~> 0.15"
|
|
46
46
|
spec.add_development_dependency "timecop", "~> 0.9"
|
|
47
47
|
spec.add_development_dependency "metanorma", "~> 0.3.0"
|
|
@@ -125,6 +125,11 @@ RSpec.describe Asciidoctor::Standoc do
|
|
|
125
125
|
<date type="Jack">
|
|
126
126
|
<on>1010-01-01</on>
|
|
127
127
|
</date>
|
|
128
|
+
<edition>2</edition>
|
|
129
|
+
<version>
|
|
130
|
+
<revision-date>2000-01-01</revision-date>
|
|
131
|
+
<draft>3.4</draft>
|
|
132
|
+
</version>
|
|
128
133
|
<language>en</language>
|
|
129
134
|
<script>Latn</script>
|
|
130
135
|
<status format="plain">published</status>
|
|
@@ -144,11 +149,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
|
144
149
|
<ics>
|
|
145
150
|
<code>3</code>
|
|
146
151
|
</ics>
|
|
147
|
-
</bibdata
|
|
148
|
-
<edition>2</edition>
|
|
149
|
-
<revision-date>2000-01-01</revision-date>
|
|
150
|
-
<draft>3.4</draft>
|
|
151
|
-
</version>
|
|
152
|
+
</bibdata>
|
|
152
153
|
<sections/>
|
|
153
154
|
</standard-document>
|
|
154
155
|
OUTPUT
|
|
@@ -173,6 +174,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
|
173
174
|
:pdf-uri: D
|
|
174
175
|
:doc-uri: E
|
|
175
176
|
:relaton-uri: F
|
|
177
|
+
:title-eo: Dokumenttitolo
|
|
176
178
|
|
|
177
179
|
[abstract]
|
|
178
180
|
== Abstract
|
|
@@ -183,6 +185,8 @@ RSpec.describe Asciidoctor::Standoc do
|
|
|
183
185
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
184
186
|
<standard-document xmlns="http://riboseinc.com/isoxml">
|
|
185
187
|
<bibdata type="article">
|
|
188
|
+
<title language="en" format="text/plain">Document title</title>
|
|
189
|
+
<title language="eo" format="text/plain">Dokumenttitolo</title>
|
|
186
190
|
<source>A</source>
|
|
187
191
|
<source type="xml">B</source>
|
|
188
192
|
<source type="html">C</source>
|
|
@@ -91,10 +91,24 @@ RSpec.describe Asciidoctor::Standoc do
|
|
|
91
91
|
For further information on the Foreword, see *ISO/IEC Directives, Part 2, 2016, Clause 12.*
|
|
92
92
|
****
|
|
93
93
|
INPUT
|
|
94
|
-
|
|
95
|
-
<
|
|
96
|
-
<
|
|
97
|
-
|
|
94
|
+
<standard-document xmlns="http://riboseinc.com/isoxml">
|
|
95
|
+
<bibdata type="article">
|
|
96
|
+
<title language="en" format="text/plain">Document title</title>
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
<version>
|
|
100
|
+
<draft>1.2</draft>
|
|
101
|
+
</version>
|
|
102
|
+
<language>en</language>
|
|
103
|
+
<script>Latn</script>
|
|
104
|
+
<status format="plain">published</status>
|
|
105
|
+
<copyright>
|
|
106
|
+
<from>2018</from>
|
|
107
|
+
</copyright>
|
|
108
|
+
<editorialgroup>
|
|
109
|
+
<technical-committee/>
|
|
110
|
+
</editorialgroup>
|
|
111
|
+
</bibdata>
|
|
98
112
|
<sections><p id="foreword">Foreword</p>
|
|
99
113
|
<review reviewer="ISO" id="_" date="20170101T00:00:00Z" from="foreword" to="foreword"><p id="_">A Foreword shall appear in each document. The generic text is shown here. It does not contain requirements, recommendations or permissions.</p>
|
|
100
114
|
<p id="_">For further information on the Foreword, see <strong>ISO/IEC Directives, Part 2, 2016, Clause 12.</strong></p></review></sections>
|
|
@@ -157,16 +171,18 @@ RSpec.describe Asciidoctor::Standoc do
|
|
|
157
171
|
OUTPUT
|
|
158
172
|
end
|
|
159
173
|
|
|
160
|
-
it "
|
|
174
|
+
it "processes literals" do
|
|
161
175
|
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
|
162
176
|
#{ASCIIDOC_BLANK_HDR}
|
|
163
177
|
....
|
|
164
|
-
LITERAL
|
|
178
|
+
<LITERAL>
|
|
165
179
|
....
|
|
166
180
|
INPUT
|
|
167
181
|
#{BLANK_HDR}
|
|
168
182
|
<sections>
|
|
169
|
-
|
|
183
|
+
<figure id="_">
|
|
184
|
+
<pre id="_"><LITERAL></pre>
|
|
185
|
+
</figure>
|
|
170
186
|
</sections>
|
|
171
187
|
</standard-document>
|
|
172
188
|
|
|
@@ -3,6 +3,100 @@ require "iecbib"
|
|
|
3
3
|
require "fileutils"
|
|
4
4
|
|
|
5
5
|
RSpec.describe Asciidoctor::Standoc do
|
|
6
|
+
it "applies smartquotes by default" do
|
|
7
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
|
8
|
+
#{ASCIIDOC_BLANK_HDR}
|
|
9
|
+
== "Quotation"
|
|
10
|
+
INPUT
|
|
11
|
+
#{BLANK_HDR}
|
|
12
|
+
<sections>
|
|
13
|
+
<clause id="_" inline-header="false" obligation="normative">
|
|
14
|
+
<title>“Quotation”</title>
|
|
15
|
+
</clause>
|
|
16
|
+
</sections>
|
|
17
|
+
</standard-document>
|
|
18
|
+
OUTPUT
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
it "applies smartquotes when requested" do
|
|
22
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
|
23
|
+
= Document title
|
|
24
|
+
Author
|
|
25
|
+
:docfile: test.adoc
|
|
26
|
+
:nodoc:
|
|
27
|
+
:novalid:
|
|
28
|
+
:no-isobib:
|
|
29
|
+
:smartquotes: true
|
|
30
|
+
|
|
31
|
+
== "Quotation"
|
|
32
|
+
INPUT
|
|
33
|
+
#{BLANK_HDR}
|
|
34
|
+
<sections>
|
|
35
|
+
<clause id="_" inline-header="false" obligation="normative">
|
|
36
|
+
<title>“Quotation”</title>
|
|
37
|
+
</clause>
|
|
38
|
+
</sections>
|
|
39
|
+
</standard-document>
|
|
40
|
+
OUTPUT
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
it "does not apply smartquotes when requested not to" do
|
|
44
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
|
45
|
+
= Document title
|
|
46
|
+
Author
|
|
47
|
+
:docfile: test.adoc
|
|
48
|
+
:nodoc:
|
|
49
|
+
:novalid:
|
|
50
|
+
:no-isobib:
|
|
51
|
+
:smartquotes: false
|
|
52
|
+
|
|
53
|
+
== "Quotation"
|
|
54
|
+
INPUT
|
|
55
|
+
#{BLANK_HDR}
|
|
56
|
+
<sections>
|
|
57
|
+
<clause id="_" inline-header="false" obligation="normative">
|
|
58
|
+
<title>"Quotation"</title>
|
|
59
|
+
</clause>
|
|
60
|
+
</sections>
|
|
61
|
+
</standard-document>
|
|
62
|
+
OUTPUT
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
it "does not apply smartquotes to sourcecode, tt, pre" do
|
|
66
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
|
67
|
+
= Document title
|
|
68
|
+
Author
|
|
69
|
+
:docfile: test.adoc
|
|
70
|
+
:nodoc:
|
|
71
|
+
:novalid:
|
|
72
|
+
:no-isobib:
|
|
73
|
+
:smartquotes: true
|
|
74
|
+
|
|
75
|
+
== "Quotation"
|
|
76
|
+
|
|
77
|
+
"Quotation"
|
|
78
|
+
|
|
79
|
+
`"quote"`
|
|
80
|
+
|
|
81
|
+
[source]
|
|
82
|
+
----
|
|
83
|
+
"quote"
|
|
84
|
+
----
|
|
85
|
+
|
|
86
|
+
INPUT
|
|
87
|
+
#{BLANK_HDR}
|
|
88
|
+
<sections>
|
|
89
|
+
<clause id="_" inline-header="false" obligation="normative"><title>“Quotation”</title><p id="_">“Quotation”</p>
|
|
90
|
+
<p id="_">
|
|
91
|
+
<tt>"quote"</tt>
|
|
92
|
+
</p>
|
|
93
|
+
<sourcecode id="_">"quote"</sourcecode></clause>
|
|
94
|
+
</sections>
|
|
95
|
+
</standard-document>
|
|
96
|
+
OUTPUT
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
|
|
6
100
|
it "removes empty text elements" do
|
|
7
101
|
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
|
8
102
|
#{ASCIIDOC_BLANK_HDR}
|
|
@@ -654,9 +748,9 @@ r = 1 %</stem>
|
|
|
654
748
|
<title>Normative References</title>
|
|
655
749
|
<bibitem id="iso123" type="standard">
|
|
656
750
|
<title format="text/plain">Standard</title>
|
|
657
|
-
<docidentifier>ISO 123
|
|
751
|
+
<docidentifier>ISO 123:—</docidentifier>
|
|
658
752
|
<date type="published">
|
|
659
|
-
<on
|
|
753
|
+
<on>—</on>
|
|
660
754
|
</date>
|
|
661
755
|
<contributor>
|
|
662
756
|
<role type="publisher"/>
|
|
@@ -864,7 +958,7 @@ r = 1 %</stem>
|
|
|
864
958
|
<title>Normative References</title>
|
|
865
959
|
<bibitem type="international-standard" id="IEC60050-102">
|
|
866
960
|
<fetched>#{Date.today}</fetched>
|
|
867
|
-
<title format="text/plain" language="en" script="Latn">International Electrotechnical Vocabulary
|
|
961
|
+
<title format="text/plain" language="en" script="Latn">International Electrotechnical Vocabulary — Part 102: Mathematics — General concepts and linear algebra</title>
|
|
868
962
|
<uri type="src">https://webstore.iec.ch/publication/160</uri>
|
|
869
963
|
<uri type="obp">/preview/info_iec60050-102%7Bed1.0%7Db.pdf</uri>
|
|
870
964
|
<docidentifier type="IEC">IEC 60050-102:2007</docidentifier>
|
|
@@ -910,7 +1004,7 @@ r = 1 %</stem>
|
|
|
910
1004
|
</ics>
|
|
911
1005
|
</bibitem><bibitem type="international-standard" id="IEC60050-103">
|
|
912
1006
|
<fetched>#{Date.today}</fetched>
|
|
913
|
-
<title format="text/plain" language="en" script="Latn">International Electrotechnical Vocabulary
|
|
1007
|
+
<title format="text/plain" language="en" script="Latn">International Electrotechnical Vocabulary — Part 103: Mathematics — Functions </title>
|
|
914
1008
|
<uri type="src">https://webstore.iec.ch/publication/161</uri>
|
|
915
1009
|
<uri type="obp">/preview/info_iec60050-103%7Bed1.0%7Db.pdf</uri>
|
|
916
1010
|
<docidentifier type="IEC">IEC 60050-103:2009</docidentifier>
|
|
@@ -3,7 +3,7 @@ require "spec_helper"
|
|
|
3
3
|
RSpec.describe Asciidoctor::Standoc do
|
|
4
4
|
it "processes inline_quoted formatting" do
|
|
5
5
|
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
|
6
|
-
#{
|
|
6
|
+
#{DUMBQUOTE_BLANK_HDR}
|
|
7
7
|
_emphasis_
|
|
8
8
|
*strong*
|
|
9
9
|
`monospace`
|
|
@@ -318,9 +318,9 @@ RSpec.describe Asciidoctor::Standoc do
|
|
|
318
318
|
<title>Normative References</title>
|
|
319
319
|
<bibitem id="iso123" type="standard">
|
|
320
320
|
<title format="text/plain">Standard</title>
|
|
321
|
-
<docidentifier>ISO 123
|
|
321
|
+
<docidentifier>ISO 123:—</docidentifier>
|
|
322
322
|
<date type="published">
|
|
323
|
-
<on
|
|
323
|
+
<on>—</on>
|
|
324
324
|
</date>
|
|
325
325
|
<contributor>
|
|
326
326
|
<role type="publisher"/>
|
|
@@ -512,6 +512,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
|
512
512
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
513
513
|
<standard-document xmlns="http://riboseinc.com/isoxml">
|
|
514
514
|
<bibdata type="article">
|
|
515
|
+
<title language="en" format="text/plain">Document title</title>
|
|
515
516
|
<language>en</language>
|
|
516
517
|
<script>Latn</script>
|
|
517
518
|
<status format="plain">published</status>
|
data/spec/spec_helper.rb
CHANGED
|
@@ -44,6 +44,17 @@ ASCIIDOC_BLANK_HDR = <<~"HDR"
|
|
|
44
44
|
|
|
45
45
|
HDR
|
|
46
46
|
|
|
47
|
+
DUMBQUOTE_BLANK_HDR = <<~"HDR"
|
|
48
|
+
= Document title
|
|
49
|
+
Author
|
|
50
|
+
:docfile: test.adoc
|
|
51
|
+
:nodoc:
|
|
52
|
+
:novalid:
|
|
53
|
+
:no-isobib:
|
|
54
|
+
:smartquotes: false
|
|
55
|
+
|
|
56
|
+
HDR
|
|
57
|
+
|
|
47
58
|
ISOBIB_BLANK_HDR = <<~"HDR"
|
|
48
59
|
= Document title
|
|
49
60
|
Author
|
|
@@ -106,6 +117,7 @@ BLANK_HDR = <<~"HDR"
|
|
|
106
117
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
107
118
|
<standard-document xmlns="http://riboseinc.com/isoxml">
|
|
108
119
|
<bibdata type="article">
|
|
120
|
+
<title language="en" format="text/plain">Document title</title>
|
|
109
121
|
<language>en</language>
|
|
110
122
|
<script>Latn</script>
|
|
111
123
|
<status format="plain">published</status>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
http_interactions:
|
|
3
3
|
- request:
|
|
4
4
|
method: get
|
|
5
|
-
uri: https://
|
|
5
|
+
uri: https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.8341.xml
|
|
6
6
|
body:
|
|
7
7
|
encoding: US-ASCII
|
|
8
8
|
string: ''
|
|
@@ -14,38 +14,28 @@ http_interactions:
|
|
|
14
14
|
User-Agent:
|
|
15
15
|
- Ruby
|
|
16
16
|
Host:
|
|
17
|
-
-
|
|
17
|
+
- xml2rfc.tools.ietf.org
|
|
18
18
|
response:
|
|
19
19
|
status:
|
|
20
20
|
code: 200
|
|
21
21
|
message: OK
|
|
22
22
|
headers:
|
|
23
23
|
Date:
|
|
24
|
-
-
|
|
24
|
+
- Tue, 11 Dec 2018 10:44:17 GMT
|
|
25
25
|
Server:
|
|
26
|
-
- Apache
|
|
26
|
+
- Apache/2.2.22 (Debian)
|
|
27
27
|
Last-Modified:
|
|
28
|
-
-
|
|
28
|
+
- Wed, 28 Nov 2018 15:34:16 GMT
|
|
29
29
|
Etag:
|
|
30
|
-
- '"46c-
|
|
30
|
+
- '"39e4a91-46c-57bbb4c7e4e00"'
|
|
31
31
|
Accept-Ranges:
|
|
32
32
|
- bytes
|
|
33
|
-
Vary:
|
|
34
|
-
- Accept-Encoding
|
|
35
|
-
Strict-Transport-Security:
|
|
36
|
-
- max-age=31536000; includeSubDomains
|
|
37
|
-
X-Frame-Options:
|
|
38
|
-
- SAMEORIGIN
|
|
39
|
-
X-Xss-Protection:
|
|
40
|
-
- 1; mode=block
|
|
41
|
-
X-Content-Type-Options:
|
|
42
|
-
- nosniff
|
|
43
33
|
Content-Length:
|
|
44
|
-
- '
|
|
34
|
+
- '1132'
|
|
45
35
|
Content-Type:
|
|
46
|
-
-
|
|
36
|
+
- application/xml
|
|
47
37
|
body:
|
|
48
|
-
encoding:
|
|
38
|
+
encoding: UTF-8
|
|
49
39
|
string: |
|
|
50
40
|
<?xml version='1.0' encoding='UTF-8'?>
|
|
51
41
|
|
|
@@ -62,10 +52,10 @@ http_interactions:
|
|
|
62
52
|
<seriesInfo name='DOI' value='10.17487/RFC8341'/>
|
|
63
53
|
</reference>
|
|
64
54
|
http_version:
|
|
65
|
-
recorded_at:
|
|
55
|
+
recorded_at: Tue, 11 Dec 2018 10:44:17 GMT
|
|
66
56
|
- request:
|
|
67
57
|
method: get
|
|
68
|
-
uri: https://
|
|
58
|
+
uri: https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.8341.xml
|
|
69
59
|
body:
|
|
70
60
|
encoding: US-ASCII
|
|
71
61
|
string: ''
|
|
@@ -77,38 +67,28 @@ http_interactions:
|
|
|
77
67
|
User-Agent:
|
|
78
68
|
- Ruby
|
|
79
69
|
Host:
|
|
80
|
-
-
|
|
70
|
+
- xml2rfc.tools.ietf.org
|
|
81
71
|
response:
|
|
82
72
|
status:
|
|
83
73
|
code: 200
|
|
84
74
|
message: OK
|
|
85
75
|
headers:
|
|
86
76
|
Date:
|
|
87
|
-
-
|
|
77
|
+
- Tue, 11 Dec 2018 10:44:18 GMT
|
|
88
78
|
Server:
|
|
89
|
-
- Apache
|
|
79
|
+
- Apache/2.2.22 (Debian)
|
|
90
80
|
Last-Modified:
|
|
91
|
-
-
|
|
81
|
+
- Wed, 28 Nov 2018 15:34:16 GMT
|
|
92
82
|
Etag:
|
|
93
|
-
- '"46c-
|
|
83
|
+
- '"39e4a91-46c-57bbb4c7e4e00"'
|
|
94
84
|
Accept-Ranges:
|
|
95
85
|
- bytes
|
|
96
|
-
Vary:
|
|
97
|
-
- Accept-Encoding
|
|
98
|
-
Strict-Transport-Security:
|
|
99
|
-
- max-age=31536000; includeSubDomains
|
|
100
|
-
X-Frame-Options:
|
|
101
|
-
- SAMEORIGIN
|
|
102
|
-
X-Xss-Protection:
|
|
103
|
-
- 1; mode=block
|
|
104
|
-
X-Content-Type-Options:
|
|
105
|
-
- nosniff
|
|
106
86
|
Content-Length:
|
|
107
|
-
- '
|
|
87
|
+
- '1132'
|
|
108
88
|
Content-Type:
|
|
109
|
-
-
|
|
89
|
+
- application/xml
|
|
110
90
|
body:
|
|
111
|
-
encoding:
|
|
91
|
+
encoding: UTF-8
|
|
112
92
|
string: |
|
|
113
93
|
<?xml version='1.0' encoding='UTF-8'?>
|
|
114
94
|
|
|
@@ -125,5 +105,5 @@ http_interactions:
|
|
|
125
105
|
<seriesInfo name='DOI' value='10.17487/RFC8341'/>
|
|
126
106
|
</reference>
|
|
127
107
|
http_version:
|
|
128
|
-
recorded_at:
|
|
108
|
+
recorded_at: Tue, 11 Dec 2018 10:44:18 GMT
|
|
129
109
|
recorded_with: VCR 4.0.0
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: metanorma-standoc
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.12
|
|
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-11
|
|
11
|
+
date: 2018-12-11 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: asciidoctor
|
|
@@ -210,16 +210,16 @@ dependencies:
|
|
|
210
210
|
name: rubocop
|
|
211
211
|
requirement: !ruby/object:Gem::Requirement
|
|
212
212
|
requirements:
|
|
213
|
-
- -
|
|
213
|
+
- - '='
|
|
214
214
|
- !ruby/object:Gem::Version
|
|
215
|
-
version:
|
|
215
|
+
version: 0.54.0
|
|
216
216
|
type: :development
|
|
217
217
|
prerelease: false
|
|
218
218
|
version_requirements: !ruby/object:Gem::Requirement
|
|
219
219
|
requirements:
|
|
220
|
-
- -
|
|
220
|
+
- - '='
|
|
221
221
|
- !ruby/object:Gem::Version
|
|
222
|
-
version:
|
|
222
|
+
version: 0.54.0
|
|
223
223
|
- !ruby/object:Gem::Dependency
|
|
224
224
|
name: simplecov
|
|
225
225
|
requirement: !ruby/object:Gem::Requirement
|