metanorma-iec 1.0.2 → 1.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/macos.yml +10 -10
- data/.github/workflows/ubuntu.yml +25 -11
- data/.github/workflows/windows.yml +11 -12
- data/README.adoc +3 -2
- data/lib/asciidoctor/iec/biblio.rng +131 -46
- data/lib/asciidoctor/iec/converter.rb +19 -130
- data/lib/asciidoctor/iec/front.rb +220 -0
- data/lib/asciidoctor/iec/isodoc.rng +32 -4
- data/lib/asciidoctor/iec/isostandard.rng +10 -0
- data/lib/isodoc/iec/base_convert.rb +118 -0
- data/lib/isodoc/iec/html/htmlstyle.scss +11 -8
- data/lib/isodoc/iec/html/scripts.html +23 -21
- data/lib/isodoc/iec/html_convert.rb +8 -0
- data/lib/isodoc/iec/i18n-en.yaml +2 -0
- data/lib/isodoc/iec/i18n-fr.yaml +2 -0
- data/lib/isodoc/iec/iec.international-standard.xsl +3969 -0
- data/lib/isodoc/iec/metadata.rb +3 -52
- data/lib/isodoc/iec/pdf_convert.rb +31 -0
- data/lib/metanorma-iec.rb +1 -0
- data/lib/metanorma/iec/processor.rb +12 -1
- data/lib/metanorma/iec/version.rb +1 -1
- data/spec/asciidoctor-iec/base_spec.rb +17 -27
- data/spec/asciidoctor-iec/blocks_spec.rb +15 -7
- data/spec/asciidoctor-iec/cleanup_spec.rb +13 -7
- data/spec/asciidoctor-iec/iev_spec.rb +161 -0
- data/spec/asciidoctor-iec/inline_spec.rb +2 -1
- data/spec/asciidoctor-iec/section_spec.rb +8 -8
- data/spec/assets/iso.xml +65 -2
- data/spec/examples/rice.html +5 -5
- data/spec/examples/rice_img/rice_image1.png +0 -0
- data/spec/examples/rice_img/rice_image2.png +0 -0
- data/spec/examples/rice_img/rice_image3_1.png +0 -0
- data/spec/examples/rice_img/rice_image3_2.png +0 -0
- data/spec/examples/rice_img/rice_image3_3.png +0 -0
- data/spec/isodoc/i18n_spec.rb +15 -22
- data/spec/isodoc/iev_spec.rb +356 -0
- data/spec/isodoc/inline_spec.rb +2 -2
- data/spec/isodoc/iso_spec.rb +2 -19
- data/spec/isodoc/metadata_spec.rb +12 -7
- data/spec/isodoc/postproc_spec.rb +9 -3
- data/spec/isodoc/section_spec.rb +11 -13
- data/spec/isodoc/terms_spec.rb +2 -2
- data/spec/metanorma/processor_spec.rb +3 -3
- data/spec/spec_helper.rb +3 -2
- metadata +12 -2
data/lib/isodoc/iec/metadata.rb
CHANGED
@@ -4,66 +4,17 @@ require "metanorma-iso"
|
|
4
4
|
module IsoDoc
|
5
5
|
module Iec
|
6
6
|
class Metadata < IsoDoc::Iso::Metadata
|
7
|
-
STAGE_ABBRS = {
|
8
|
-
"00" => {"00" => "PWI"},
|
9
|
-
"10" => {"00" => "PNW"},
|
10
|
-
"20" => {"00" => "ANW", "98" => "CAN", "99" => "ACD"},
|
11
|
-
"30" => {"00" => "CD", "20" => "CD", "92" => "BWG", "97" => "MERGED", "98" => "DREJ", "99" => "A2CD"},
|
12
|
-
"35" => {"00" => "CD", "20" => "CD", "91" => "CDM", "92" => "ACD", "99" => "ACDV"},
|
13
|
-
"40" => {"00" => "CCDV", "20" => "CCDV", "91" => "CDVM", "92" => "NCDV", "93" => "NADIS", "95" => "ADISSB", "99" => "ADIS"},
|
14
|
-
"50" => {"00" => "RFDIS", "20" => "CFDIS", "92" => "NFDIS", "95" => "APUBSB", "99" => "APUB"},
|
15
|
-
"60" => {"00" => "BPUB", "60" => "PPUB"},
|
16
|
-
"90" => {"00" => "RR", "92" => "RR"},
|
17
|
-
"92" => {"00" => "AMW", "20" => "AMW"},
|
18
|
-
"95" => {"00" => "WPUB", "99" => "WPUB"},
|
19
|
-
"99" => {"00" => "DELPUB", "60" => "DELPUB"},
|
20
|
-
}.freeze
|
21
|
-
|
22
|
-
def stage_abbr(stage)
|
23
|
-
ret = STAGE_ABBRS.dig(stage, "00") || "??"
|
24
|
-
ret = "PPUB" if stage == "60"
|
25
|
-
ret
|
26
|
-
end
|
27
|
-
|
28
|
-
def status_abbrev1(stage, substage, iter, doctype, draft)
|
29
|
-
return "" unless stage
|
30
|
-
abbr = STAGE_ABBRS.dig(stage, substage) || "??"
|
31
|
-
if stage == "35" && substage == "92"
|
32
|
-
iter = (iter.to_i + 1) % "02"
|
33
|
-
end
|
34
|
-
case doctype
|
35
|
-
when "technical-report"
|
36
|
-
stage = "ADTR" if stage == "40" && substage == "99"
|
37
|
-
stage = "CDTR" if stage == "50" && substage == "20"
|
38
|
-
stage = "DTRM" if stage == "50" && substage == "92"
|
39
|
-
when "technical-specification"
|
40
|
-
stage = "ADTS" if stage == "40" && substage == "99"
|
41
|
-
stage = "CDTS" if stage == "50" && substage == "20"
|
42
|
-
stage = "DTSM" if stage == "50" && substage == "92"
|
43
|
-
when "interpretation-sheet"
|
44
|
-
stage = "RDISH" if stage == "50" && substage == "00"
|
45
|
-
stage = "CDISH" if stage == "50" && substage == "20"
|
46
|
-
when "publicly-available-specification"
|
47
|
-
stage = "CDPAS" if stage == "50" && substage == "20"
|
48
|
-
end
|
49
|
-
abbr = abbr.sub(/CD$/, "#{iter}CD") if iter
|
50
|
-
abbr
|
51
|
-
end
|
52
|
-
|
53
7
|
def docstatus(isoxml, _out)
|
54
8
|
docstatus = isoxml.at(ns("//bibdata/status/stage"))
|
9
|
+
substage = isoxml.at(ns("//bibdata/status/substage"))
|
55
10
|
set(:unpublished, false)
|
56
11
|
if docstatus
|
57
12
|
set(:stage, docstatus.text)
|
58
13
|
set(:stage_int, docstatus.text.to_i)
|
59
14
|
set(:unpublished, unpublished(docstatus.text))
|
60
|
-
set(:statusabbr,
|
61
|
-
isoxml&.at(ns("//bibdata/status/substage"))&.text,
|
62
|
-
isoxml&.at(ns("//bibdata/status/iteration"))&.text,
|
63
|
-
isoxml&.at(ns("//bibdata/ext/doctype"))&.text,
|
64
|
-
isoxml&.at(ns("//version/draft"))&.text))
|
15
|
+
set(:statusabbr, substage["abbreviation"])
|
65
16
|
unpublished(docstatus.text) and
|
66
|
-
set(:stageabbr,
|
17
|
+
set(:stageabbr, docstatus["abbreviation"])
|
67
18
|
end
|
68
19
|
revdate = isoxml.at(ns("//version/revision-date"))
|
69
20
|
set(:revdate, revdate&.text)
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require_relative "base_convert"
|
2
|
+
require "isodoc"
|
3
|
+
|
4
|
+
module IsoDoc
|
5
|
+
module Iec
|
6
|
+
|
7
|
+
# A {Converter} implementation that generates HTML output, and a document
|
8
|
+
# schema encapsulation of the document for validation
|
9
|
+
#
|
10
|
+
class PdfConvert < IsoDoc::XslfoPdfConvert
|
11
|
+
def initialize(options)
|
12
|
+
@libdir = File.dirname(__FILE__)
|
13
|
+
super
|
14
|
+
end
|
15
|
+
|
16
|
+
def convert(filename, file = nil, debug = false)
|
17
|
+
file = File.read(filename, encoding: "utf-8") if file.nil?
|
18
|
+
docxml, outname_html, dir = convert_init(file, filename, debug)
|
19
|
+
/\.xml$/.match(filename) or
|
20
|
+
filename = Tempfile.open([outname_html, ".xml"], encoding: "utf-8") do |f|
|
21
|
+
f.write file
|
22
|
+
f.path
|
23
|
+
end
|
24
|
+
FileUtils.rm_rf dir
|
25
|
+
::Metanorma::Output::XslfoPdf.new.convert(
|
26
|
+
filename, outname_html + ".pdf",
|
27
|
+
File.join(@libdir, "iec.international-standard.xsl"))
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
data/lib/metanorma-iec.rb
CHANGED
@@ -2,6 +2,14 @@ require "metanorma/processor"
|
|
2
2
|
|
3
3
|
module Metanorma
|
4
4
|
module Iec
|
5
|
+
def self.fonts_used
|
6
|
+
{
|
7
|
+
html: ["Arial", "Times New Roman", "HanSans", "Courier New"],
|
8
|
+
doc: ["Arial", "Times New Roman", "HanSans", "Courier New"],
|
9
|
+
pdf: ["Arial", "Times New Roman", "HanSans", "Courier New"],
|
10
|
+
}
|
11
|
+
end
|
12
|
+
|
5
13
|
class Processor < Metanorma::Processor
|
6
14
|
|
7
15
|
def initialize
|
@@ -13,7 +21,8 @@ module Metanorma
|
|
13
21
|
def output_formats
|
14
22
|
super.merge(
|
15
23
|
html: "html",
|
16
|
-
doc: "doc"
|
24
|
+
doc: "doc",
|
25
|
+
pdf: "pdf"
|
17
26
|
)
|
18
27
|
end
|
19
28
|
|
@@ -31,6 +40,8 @@ module Metanorma
|
|
31
40
|
IsoDoc::Iec::HtmlConvert.new(options).convert(outname, isodoc_node)
|
32
41
|
when :doc
|
33
42
|
IsoDoc::Iec::WordConvert.new(options).convert(outname, isodoc_node)
|
43
|
+
when :pdf
|
44
|
+
IsoDoc::Iec::PdfConvert.new(options).convert(outname, isodoc_node)
|
34
45
|
else
|
35
46
|
super
|
36
47
|
end
|
@@ -123,8 +123,8 @@ RSpec.describe Asciidoctor::Iec do
|
|
123
123
|
<language>en</language>
|
124
124
|
<script>Latn</script>
|
125
125
|
<status>
|
126
|
-
<stage>10</stage>
|
127
|
-
<substage>20</substage>
|
126
|
+
<stage abbreviation="NWIP">10</stage>
|
127
|
+
<substage abbreviation="??">20</substage>
|
128
128
|
<iteration>3</iteration>
|
129
129
|
</status>
|
130
130
|
<copyright>
|
@@ -159,6 +159,7 @@ RSpec.describe Asciidoctor::Iec do
|
|
159
159
|
<structuredidentifier>
|
160
160
|
<project-number part="1">IEC 1000</project-number>
|
161
161
|
</structuredidentifier>
|
162
|
+
<stagename>New work item proposal</stagename>
|
162
163
|
</ext>
|
163
164
|
</bibdata>
|
164
165
|
#{UNPUBLISHED_BOILERPLATE}
|
@@ -234,8 +235,8 @@ RSpec.describe Asciidoctor::Iec do
|
|
234
235
|
<language>el</language>
|
235
236
|
<script>Grek</script>
|
236
237
|
<status>
|
237
|
-
<stage>30</stage>
|
238
|
-
<substage>99</substage>
|
238
|
+
<stage abbreviation="CD">30</stage>
|
239
|
+
<substage abbreviation="A22CD">99</substage>
|
239
240
|
<iteration>2</iteration>
|
240
241
|
</status>
|
241
242
|
<copyright>
|
@@ -274,6 +275,7 @@ RSpec.describe Asciidoctor::Iec do
|
|
274
275
|
<structuredidentifier>
|
275
276
|
<project-number part="1" subpart="1">ISO/IEC/IETF 1000</project-number>
|
276
277
|
</structuredidentifier>
|
278
|
+
<stagename>Committee draft</stagename>
|
277
279
|
</ext>
|
278
280
|
</bibdata>
|
279
281
|
#{UNPUBLISHED_BOILERPLATE.sub(/IEC #{Date.today.year}/, "ISO/IEC/IETF 2001")}
|
@@ -355,8 +357,8 @@ RSpec.describe Asciidoctor::Iec do
|
|
355
357
|
<language>en</language>
|
356
358
|
<script>Latn</script>
|
357
359
|
<status>
|
358
|
-
<stage>50</stage>
|
359
|
-
<substage>00</substage>
|
360
|
+
<stage abbreviation="FDIS">50</stage>
|
361
|
+
<substage abbreviation="RFDIS">00</substage>
|
360
362
|
</status>
|
361
363
|
<copyright>
|
362
364
|
<from>#{Date.today.year}</from>
|
@@ -377,6 +379,7 @@ RSpec.describe Asciidoctor::Iec do
|
|
377
379
|
<structuredidentifier>
|
378
380
|
<project-number>IEC 1000</project-number>
|
379
381
|
</structuredidentifier>
|
382
|
+
<stagename>Final draft international standard</stagename>
|
380
383
|
</ext>
|
381
384
|
</bibdata>
|
382
385
|
#{UNPUBLISHED_BOILERPLATE}
|
@@ -418,8 +421,8 @@ OUTPUT
|
|
418
421
|
<language>en</language>
|
419
422
|
<script>Latn</script>
|
420
423
|
<status>
|
421
|
-
<stage>60</stage>
|
422
|
-
<substage>60</substage>
|
424
|
+
<stage abbreviation="PPUB">60</stage>
|
425
|
+
<substage abbreviation="PPUB">60</substage>
|
423
426
|
</status>
|
424
427
|
<copyright>
|
425
428
|
<from>#{Date.today.year}</from>
|
@@ -440,6 +443,7 @@ OUTPUT
|
|
440
443
|
<structuredidentifier>
|
441
444
|
<project-number>IEC 1000</project-number>
|
442
445
|
</structuredidentifier>
|
446
|
+
<stagename>International standard</stagename>
|
443
447
|
</ext>
|
444
448
|
</bibdata>
|
445
449
|
#{BOILERPLATE}
|
@@ -482,8 +486,8 @@ OUTPUT
|
|
482
486
|
<language>en</language>
|
483
487
|
<script>Latn</script>
|
484
488
|
<status>
|
485
|
-
<stage>60</stage>
|
486
|
-
<substage>00</substage>
|
489
|
+
<stage abbreviation="PPUB">60</stage>
|
490
|
+
<substage abbreviation="BPUB">00</substage>
|
487
491
|
</status>
|
488
492
|
<copyright>
|
489
493
|
<from>#{Date.today.year}</from>
|
@@ -504,6 +508,7 @@ OUTPUT
|
|
504
508
|
<structuredidentifier>
|
505
509
|
<project-number>IEC 1000</project-number>
|
506
510
|
</structuredidentifier>
|
511
|
+
<stagename>International standard</stagename>
|
507
512
|
</ext>
|
508
513
|
</bibdata>
|
509
514
|
#{BOILERPLATE}
|
@@ -537,23 +542,8 @@ OUTPUT
|
|
537
542
|
INPUT
|
538
543
|
html = File.read("test.html", encoding: "utf-8")
|
539
544
|
expect(html).to match(%r[\bpre[^{]+\{[^{]+font-family: "Courier New", monospace;]m)
|
540
|
-
expect(html).to match(%r[blockquote[^{]+\{[^{]+font-family: "
|
541
|
-
expect(html).to match(%r[\.h2Annex[^{]+\{[^{]+font-family: "
|
542
|
-
end
|
543
|
-
|
544
|
-
it "uses default fonts for alt doc" do
|
545
|
-
FileUtils.rm_f "test_alt.html"
|
546
|
-
Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true)
|
547
|
-
= Document title
|
548
|
-
Author
|
549
|
-
:docfile: test.adoc
|
550
|
-
:novalid:
|
551
|
-
:no-isobib:
|
552
|
-
INPUT
|
553
|
-
html = File.read("test_alt.html", encoding: "utf-8")
|
554
|
-
expect(html).to match(%r[\bpre[^{]+\{[^{]+font-family: "Space Mono", monospace;]m)
|
555
|
-
expect(html).to match(%r[blockquote[^{]+\{[^{]+font-family: "Lato", sans-serif;]m)
|
556
|
-
expect(html).to match(%r[\.h2Annex[^{]+\{[^{]+font-family: "Lato", sans-serif;]m)
|
545
|
+
expect(html).to match(%r[blockquote[^{]+\{[^{]+font-family: "Arial", sans-serif;]m)
|
546
|
+
expect(html).to match(%r[\.h2Annex[^{]+\{[^{]+font-family: "Arial", sans-serif;]m)
|
557
547
|
end
|
558
548
|
|
559
549
|
it "uses Chinese fonts" do
|
@@ -113,7 +113,7 @@ RSpec.describe Asciidoctor::Iec do
|
|
113
113
|
<title>Terms and definitions</title>
|
114
114
|
<p id="_">For the purposes of this document, the following terms and definitions apply.</p>
|
115
115
|
#{TERMS_BOILERPLATE}
|
116
|
-
<term id="
|
116
|
+
<term id="term-term1">
|
117
117
|
<preferred>Term1</preferred>
|
118
118
|
<termnote id="_">
|
119
119
|
<p id="_">This is a note</p>
|
@@ -224,7 +224,7 @@ RSpec.describe Asciidoctor::Iec do
|
|
224
224
|
<title>Terms and definitions</title>
|
225
225
|
<p id="_">For the purposes of this document, the following terms and definitions apply.</p>
|
226
226
|
#{TERMS_BOILERPLATE}
|
227
|
-
<term id="
|
227
|
+
<term id="term-term1">
|
228
228
|
<preferred>Term1</preferred>
|
229
229
|
<termexample id="_">
|
230
230
|
<p id="_">This is an example</p>
|
@@ -352,7 +352,7 @@ RSpec.describe Asciidoctor::Iec do
|
|
352
352
|
#{BLANK_HDR}
|
353
353
|
<sections>
|
354
354
|
<quote id="_">
|
355
|
-
<source type="inline" bibitemid="ISO7301" citeas=""><locality type="section"><referenceFrom>1</referenceFrom></locality></source>
|
355
|
+
<source type="inline" bibitemid="ISO7301" citeas=""><localityStack><locality type="section"><referenceFrom>1</referenceFrom></locality></localityStack></source>
|
356
356
|
<author>ISO</author>
|
357
357
|
<p id="_">Block quotation</p>
|
358
358
|
</quote>
|
@@ -426,10 +426,14 @@ RSpec.describe Asciidoctor::Iec do
|
|
426
426
|
<title>Terms and definitions</title>
|
427
427
|
<p id="_">For the purposes of this document, the following terms and definitions apply.</p>
|
428
428
|
#{TERMS_BOILERPLATE}
|
429
|
-
<term id="
|
429
|
+
<term id="term-term1">
|
430
430
|
<preferred>Term1</preferred>
|
431
431
|
<termsource status="identical">
|
432
|
-
<origin bibitemid="ISO2191" type="inline" citeas=""
|
432
|
+
<origin bibitemid="ISO2191" type="inline" citeas="">
|
433
|
+
<localityStack>
|
434
|
+
<locality type="section"><referenceFrom>1</referenceFrom></locality>
|
435
|
+
</localityStack>
|
436
|
+
</origin>
|
433
437
|
</termsource>
|
434
438
|
</term>
|
435
439
|
</terms>
|
@@ -454,10 +458,14 @@ RSpec.describe Asciidoctor::Iec do
|
|
454
458
|
<title>Terms and definitions</title>
|
455
459
|
<p id="_">For the purposes of this document, the following terms and definitions apply.</p>
|
456
460
|
#{TERMS_BOILERPLATE}
|
457
|
-
<term id="
|
461
|
+
<term id="term-term1">
|
458
462
|
<preferred>Term1</preferred>
|
459
463
|
<termsource status="modified">
|
460
|
-
<origin bibitemid="ISO2191" type="inline" citeas=""
|
464
|
+
<origin bibitemid="ISO2191" type="inline" citeas="">
|
465
|
+
<localityStack>
|
466
|
+
<locality type="section"><referenceFrom>1</referenceFrom></locality>
|
467
|
+
</localityStack>
|
468
|
+
</origin>
|
461
469
|
<modification>
|
462
470
|
<p id="_">with adjustments</p>
|
463
471
|
</modification>
|
@@ -34,7 +34,7 @@ RSpec.describe Asciidoctor::Iec do
|
|
34
34
|
<p id="_">For the purposes of this document,
|
35
35
|
the following terms and definitions apply.</p>
|
36
36
|
#{TERMS_BOILERPLATE}
|
37
|
-
<term id="
|
37
|
+
<term id="term-t90"><preferred><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mi>t</mi><mn>90</mn></msub></math></stem></preferred><admitted><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mi>t</mi><mn>91</mn></msub></math></stem></admitted>
|
38
38
|
<definition><p id="_">Time</p></definition></term>
|
39
39
|
</terms>
|
40
40
|
</sections>
|
@@ -70,7 +70,7 @@ RSpec.describe Asciidoctor::Iec do
|
|
70
70
|
<p id="_">For the purposes of this document,
|
71
71
|
the following terms and definitions apply.</p>
|
72
72
|
#{TERMS_BOILERPLATE}
|
73
|
-
<term id="
|
73
|
+
<term id="term-t90"><preferred><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mi>t</mi><mn>90</mn></msub></math></stem></preferred><definition><formula id="_">
|
74
74
|
<stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mi>t</mi><mi>A</mi></msub></math></stem>
|
75
75
|
</formula><p id="_">This paragraph is extraneous</p></definition>
|
76
76
|
</term>
|
@@ -100,7 +100,7 @@ RSpec.describe Asciidoctor::Iec do
|
|
100
100
|
the following terms and definitions apply.</p>
|
101
101
|
#{TERMS_BOILERPLATE}
|
102
102
|
|
103
|
-
<term id="
|
103
|
+
<term id="term-time">
|
104
104
|
<preferred>Time</preferred>
|
105
105
|
<definition><p id="_">This paragraph is extraneous</p></definition>
|
106
106
|
</term></terms>
|
@@ -126,11 +126,12 @@ RSpec.describe Asciidoctor::Iec do
|
|
126
126
|
<eref type="inline" bibitemid="iso216" citeas="ISO 216"/>
|
127
127
|
</p>
|
128
128
|
</foreword></preface><sections>
|
129
|
-
</sections><bibliography><references id="_" obligation="informative">
|
129
|
+
</sections><bibliography><references id="_" obligation="informative" normative="false">
|
130
130
|
<title>Bibliography</title>
|
131
131
|
<bibitem id="iso216" type="standard">
|
132
132
|
<title format="text/plain">Reference</title>
|
133
133
|
<docidentifier>ISO 216</docidentifier>
|
134
|
+
<docnumber>216</docnumber>
|
134
135
|
<contributor>
|
135
136
|
<role type="publisher"/>
|
136
137
|
<organization>
|
@@ -160,10 +161,14 @@ RSpec.describe Asciidoctor::Iec do
|
|
160
161
|
<title>Terms and definitions</title>
|
161
162
|
<p id="_">For the purposes of this document, the following terms and definitions apply.</p>
|
162
163
|
#{TERMS_BOILERPLATE}
|
163
|
-
<term id="
|
164
|
+
<term id="term-term1">
|
164
165
|
<preferred>Term1</preferred>
|
165
166
|
<termsource status="identical">
|
166
|
-
<origin bibitemid="ISO2191" type="inline" citeas=""
|
167
|
+
<origin bibitemid="ISO2191" type="inline" citeas="">
|
168
|
+
<localityStack>
|
169
|
+
<locality type="section"><referenceFrom>1</referenceFrom></locality>
|
170
|
+
</localityStack>
|
171
|
+
</origin>
|
167
172
|
</termsource>
|
168
173
|
</term>
|
169
174
|
</terms>
|
@@ -184,11 +189,12 @@ RSpec.describe Asciidoctor::Iec do
|
|
184
189
|
INPUT
|
185
190
|
#{BLANK_HDR}
|
186
191
|
<sections></sections>
|
187
|
-
<bibliography><references id="_" obligation="informative"><title>Normative References</title>
|
192
|
+
<bibliography><references id="_" obligation="informative" normative="true"><title>Normative References</title>
|
188
193
|
<p id="_">The following documents are referred to in the text in such a way that some or all of their content constitutes requirements of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.</p>
|
189
194
|
<bibitem id="iso216" type="standard">
|
190
195
|
<title format="text/plain">Reference</title>
|
191
196
|
<docidentifier>ISO 216</docidentifier>
|
197
|
+
<docnumber>216</docnumber>
|
192
198
|
<contributor>
|
193
199
|
<role type="publisher"/>
|
194
200
|
<organization>
|
@@ -0,0 +1,161 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "fileutils"
|
3
|
+
|
4
|
+
RSpec.describe Asciidoctor::Iec do
|
5
|
+
it "generates reference boilerplate for IEV" do
|
6
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
7
|
+
= Document title
|
8
|
+
Author
|
9
|
+
:docfile: test.adoc
|
10
|
+
:nodoc:
|
11
|
+
:novalid:
|
12
|
+
:no-isobib:
|
13
|
+
:docnumber: 60050
|
14
|
+
|
15
|
+
[bibliography]
|
16
|
+
== Normative References
|
17
|
+
|
18
|
+
* [[[A,B]]], _TITLE_
|
19
|
+
INPUT
|
20
|
+
<?xml version='1.0' encoding='UTF-8'?>
|
21
|
+
<iec-standard xmlns='https://www.metanorma.org/ns/iec'>
|
22
|
+
<bibdata type='standard'>
|
23
|
+
<docidentifier type='iso'>IEC 60050 ED 1</docidentifier>
|
24
|
+
<docnumber>60050</docnumber>
|
25
|
+
<contributor>
|
26
|
+
<role type='author'/>
|
27
|
+
<organization>
|
28
|
+
<name>International Electrotechnical Commission</name>
|
29
|
+
<abbreviation>IEC</abbreviation>
|
30
|
+
</organization>
|
31
|
+
</contributor>
|
32
|
+
<contributor>
|
33
|
+
<role type='publisher'/>
|
34
|
+
<organization>
|
35
|
+
<name>International Electrotechnical Commission</name>
|
36
|
+
<abbreviation>IEC</abbreviation>
|
37
|
+
</organization>
|
38
|
+
</contributor>
|
39
|
+
<language>en</language>
|
40
|
+
<script>Latn</script>
|
41
|
+
<status>
|
42
|
+
<stage abbreviation="PPUB">60</stage>
|
43
|
+
<substage abbreviation="PPUB">60</substage>
|
44
|
+
</status>
|
45
|
+
<copyright>
|
46
|
+
<from>2020</from>
|
47
|
+
<owner>
|
48
|
+
<organization>
|
49
|
+
<name>International Electrotechnical Commission</name>
|
50
|
+
<abbreviation>IEC</abbreviation>
|
51
|
+
</organization>
|
52
|
+
</owner>
|
53
|
+
</copyright>
|
54
|
+
<ext>
|
55
|
+
<doctype>article</doctype>
|
56
|
+
<editorialgroup>
|
57
|
+
<technical-committee/>
|
58
|
+
<subcommittee/>
|
59
|
+
<workgroup/>
|
60
|
+
</editorialgroup>
|
61
|
+
<structuredidentifier>
|
62
|
+
<project-number>IEC 60050</project-number>
|
63
|
+
</structuredidentifier>
|
64
|
+
<stagename>International standard</stagename>
|
65
|
+
</ext>
|
66
|
+
</bibdata>
|
67
|
+
#{BOILERPLATE}
|
68
|
+
<sections> </sections>
|
69
|
+
<bibliography>
|
70
|
+
<references id='_' obligation='informative' normative="true">
|
71
|
+
<title>Normative References</title>
|
72
|
+
<p id='_'>There are no normative references in this document.</p>
|
73
|
+
<bibitem id='A'>
|
74
|
+
<formattedref format='application/x-isodoc+xml'>
|
75
|
+
<em>TITLE</em>
|
76
|
+
</formattedref>
|
77
|
+
<docidentifier>B</docidentifier>
|
78
|
+
</bibitem>
|
79
|
+
</references>
|
80
|
+
</bibliography>
|
81
|
+
</iec-standard>
|
82
|
+
OUTPUT
|
83
|
+
end
|
84
|
+
|
85
|
+
it "generates terms boilerplate for IEV" do
|
86
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
87
|
+
= Document title
|
88
|
+
Author
|
89
|
+
:docfile: test.adoc
|
90
|
+
:nodoc:
|
91
|
+
:novalid:
|
92
|
+
:no-isobib:
|
93
|
+
:docnumber: 60050
|
94
|
+
|
95
|
+
== Terms and definitions
|
96
|
+
=== General
|
97
|
+
==== Term 1
|
98
|
+
INPUT
|
99
|
+
<iec-standard xmlns='https://www.metanorma.org/ns/iec'>
|
100
|
+
<bibdata type='standard'>
|
101
|
+
<docidentifier type='iso'>IEC 60050 ED 1</docidentifier>
|
102
|
+
<docnumber>60050</docnumber>
|
103
|
+
<contributor>
|
104
|
+
<role type='author'/>
|
105
|
+
<organization>
|
106
|
+
<name>International Electrotechnical Commission</name>
|
107
|
+
<abbreviation>IEC</abbreviation>
|
108
|
+
</organization>
|
109
|
+
</contributor>
|
110
|
+
<contributor>
|
111
|
+
<role type='publisher'/>
|
112
|
+
<organization>
|
113
|
+
<name>International Electrotechnical Commission</name>
|
114
|
+
<abbreviation>IEC</abbreviation>
|
115
|
+
</organization>
|
116
|
+
</contributor>
|
117
|
+
<language>en</language>
|
118
|
+
<script>Latn</script>
|
119
|
+
<status>
|
120
|
+
<stage abbreviation="PPUB">60</stage>
|
121
|
+
<substage abbreviation="PPUB">60</substage>
|
122
|
+
</status>
|
123
|
+
<copyright>
|
124
|
+
<from>2020</from>
|
125
|
+
<owner>
|
126
|
+
<organization>
|
127
|
+
<name>International Electrotechnical Commission</name>
|
128
|
+
<abbreviation>IEC</abbreviation>
|
129
|
+
</organization>
|
130
|
+
</owner>
|
131
|
+
</copyright>
|
132
|
+
<ext>
|
133
|
+
<doctype>article</doctype>
|
134
|
+
<editorialgroup>
|
135
|
+
<technical-committee/>
|
136
|
+
<subcommittee/>
|
137
|
+
<workgroup/>
|
138
|
+
</editorialgroup>
|
139
|
+
<structuredidentifier>
|
140
|
+
<project-number>IEC 60050</project-number>
|
141
|
+
</structuredidentifier>
|
142
|
+
<stagename>International standard</stagename>
|
143
|
+
</ext>
|
144
|
+
</bibdata>
|
145
|
+
#{BOILERPLATE}
|
146
|
+
<sections>
|
147
|
+
<clause id='_' obligation='normative'>
|
148
|
+
<title>Terms and definitions</title>
|
149
|
+
<terms id='_' obligation='normative'>
|
150
|
+
<title>General</title>
|
151
|
+
<term id='term-term-1'>
|
152
|
+
<preferred>Term 1</preferred>
|
153
|
+
</term>
|
154
|
+
</terms>
|
155
|
+
</clause>
|
156
|
+
</sections>
|
157
|
+
</iec-standard>
|
158
|
+
|
159
|
+
OUTPUT
|
160
|
+
end
|
161
|
+
end
|