metanorma-iso 1.0.7 → 1.0.8
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/README.adoc +7 -0
- data/docs/outputs.adoc +42 -0
- data/lib/asciidoctor/iso/biblio.rng +32 -4
- data/lib/asciidoctor/iso/front.rb +0 -13
- data/lib/isodoc/iso/html/html_iso_titlepage.html +14 -2
- data/lib/isodoc/iso/html/isodoc.scss +13 -0
- data/lib/isodoc/iso/html/style-human.scss +7 -1
- data/lib/isodoc/iso/html/style-iso.scss +7 -0
- data/lib/isodoc/iso/html/word_iso_titlepage.html +15 -1
- data/lib/isodoc/iso/html/wordstyle.scss +6 -12
- data/lib/isodoc/iso/metadata.rb +5 -1
- data/lib/isodoc/iso/word_convert.rb +2 -0
- data/lib/metanorma/iso/processor.rb +2 -2
- data/lib/metanorma/iso/version.rb +1 -1
- data/metanorma-iso.gemspec +1 -4
- data/spec/asciidoctor-iso/base_spec.rb +12 -1
- data/spec/asciidoctor-iso/blocks_spec.rb +1 -0
- data/spec/asciidoctor-iso/cleanup_spec.rb +1 -0
- data/spec/asciidoctor-iso/refs_spec.rb +19 -13
- data/spec/assets/iso.doc +25 -9
- data/spec/assets/iso.html +10 -5
- data/spec/isodoc/metadata_spec.rb +2 -2
- data/spec/isodoc/section_spec.rb +61 -0
- data/spec/isodoc/terms_spec.rb +6 -6
- data/spec/isodoc/xref_spec.rb +7 -7
- data/spec/metanorma/processor_spec.rb +1 -1
- metadata +3 -45
- data/spec/asciidoctor-iso/isobib_cache_spec.rb +0 -332
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fcfe1b51276c62b73efaf0a7ecfd97c5aae10b34823647cae97942e5e2e1cf1e
|
|
4
|
+
data.tar.gz: e5a96003b94cc1965abebb14112755a1c4134078a233279f8b070bed0c09ea58
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c6217989c8151c10b50280795f8d9b63de4dd6277e3a9ac0cf01f6648ef3721dc3d05b547d88b3b1c376a05d1fd6020f195021df2e87afb83940ace8264d8579
|
|
7
|
+
data.tar.gz: 83bc724ef641add5682d9a6f0eaa08187dad5c76aeb5109d0b59af5f5bb0896597bd37377934ee6b0ce082cc510fd490e4b7337e3ecae42fdb48652788ed9931
|
data/README.adoc
CHANGED
|
@@ -487,6 +487,13 @@ not supplied. Example values: `JWG`, `JAG`, `AG` (advisory group), `AHG`, `SWG`,
|
|
|
487
487
|
`:publisher:`:: The standards agency publishing the standard; can be multiple
|
|
488
488
|
(comma-delimited). Defaults to `ISO`.
|
|
489
489
|
|
|
490
|
+
`:uri:`:: The URI to which this standard is published.
|
|
491
|
+
`:xml-uri:`:: The URI to which the (Metanorma) XML representation of this standard is published.
|
|
492
|
+
`:html-uri:`:: The URI to which the HTML representation of this standard is published.
|
|
493
|
+
`:pdf-uri:`:: The URI to which the PDF representation of this standard is published.
|
|
494
|
+
`:doc-uri:`:: The URI to which the DOC representation of this standard is published.
|
|
495
|
+
`:relaton-uri:`:: The URI to which the Relaton XML representation of this standard is published.
|
|
496
|
+
|
|
490
497
|
`:body-font:`:: Font for body text; will be inserted into CSS. Defaults to
|
|
491
498
|
Cambria for Latin script, SimSun for Simplified Chinese.
|
|
492
499
|
|
data/docs/outputs.adoc
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
= Outputs
|
|
2
|
+
|
|
3
|
+
The metanorma toolset currently outputs documents in four formats.
|
|
4
|
+
|
|
5
|
+
== Metanorma XML
|
|
6
|
+
|
|
7
|
+
The Metanorma XML output is the intermediate format which marks up the semantic content of the standards document, and is
|
|
8
|
+
used to drive the other formats. The Metanorma XML file is also the file which is used for validation of the standards
|
|
9
|
+
document: line numbers in the validation output refer to this file.
|
|
10
|
+
|
|
11
|
+
== HTML
|
|
12
|
+
|
|
13
|
+
The HTML output is in HTML 5. It has optional Data-URI encoding of local images; if images in the output are are not Data-URI encoded,
|
|
14
|
+
they are moved to a folder called `{filename}_images`, and renamed with GUID names, to prevent collisions. Audio and video files are
|
|
15
|
+
not supported. All HTML output has a sidebar with a Javascript-generated Table of Contents, which is two section levels deep.
|
|
16
|
+
|
|
17
|
+
== PDF
|
|
18
|
+
|
|
19
|
+
PDF output, for those standards gems that support it, is generated from the HTML output via Google Puppeteer (which runs in Node.js).
|
|
20
|
+
The PDF output generation takes advantage of the print mode in the HTML CSS stylesheet, so much of the browser-like styling of the HTML
|
|
21
|
+
is rendered as a more print-like document. Because it is generated from HTML, the PDF output does not support page numbers in its
|
|
22
|
+
Table of Contents. Nor does it support advanced paragraph formatting, such as Keep With Next or Widow/Orphan control.
|
|
23
|
+
|
|
24
|
+
== Word
|
|
25
|
+
|
|
26
|
+
The Word output is output as a DOC format rather than DOCX (i.e. the pre-2007 version of Word), and it is generated using the
|
|
27
|
+
Microsoft Office flavour of HTML 4, as a Multipart HTML Word Document (MHT). (This is a MIME-encoded counterpart to the HTML obtained
|
|
28
|
+
when you save a Word document as HTML.)
|
|
29
|
+
|
|
30
|
+
Using DOC HTML makes it much easier to generate documents with
|
|
31
|
+
the advanced formatting requirements of Metanorma (including complex tables, formulas, footnotes, headers and footers,
|
|
32
|
+
nested list numbering and crossreferences) than generating either native DOCX (in OOXML), or the DOCX flavour of MHT. For more
|
|
33
|
+
on the choice to use DOC, see https://github.com/riboseinc/html2doc/wiki/Why-not-docx%3F
|
|
34
|
+
|
|
35
|
+
The constraint on using DOC, however, imposes some constraints.
|
|
36
|
+
|
|
37
|
+
* SVG images are not supported. (Word internally converts them into PNG files to render them in Word HTML.)
|
|
38
|
+
* DOC files are a legacy format of Word.
|
|
39
|
+
* DOC files cannot be processed by Pages or LibreOffice: they can only be processed by Microsoft Word. To open the Word output in LibreOffice in particular, you will need to convert the DOC file as a DOCX file, taking the following steps.
|
|
40
|
+
** Open with MS Word
|
|
41
|
+
** Save it once by changing the Extension to `.doc`. (When it asks you to overwrite, say Yes.)
|
|
42
|
+
* "Save As" as a `.docx` file.
|
|
@@ -414,6 +414,20 @@
|
|
|
414
414
|
<ref name="BibliographicItem"/>
|
|
415
415
|
</element>
|
|
416
416
|
</define>
|
|
417
|
+
<define name="relaton_collection">
|
|
418
|
+
<element name="relaton-collection">
|
|
419
|
+
<optional>
|
|
420
|
+
<attribute name="type"/>
|
|
421
|
+
</optional>
|
|
422
|
+
<ref name="btitle"/>
|
|
423
|
+
<zeroOrMore>
|
|
424
|
+
<ref name="contributor"/>
|
|
425
|
+
</zeroOrMore>
|
|
426
|
+
<zeroOrMore>
|
|
427
|
+
<ref name="docrelation"/>
|
|
428
|
+
</zeroOrMore>
|
|
429
|
+
</element>
|
|
430
|
+
</define>
|
|
417
431
|
<define name="BibItemType" combine="choice">
|
|
418
432
|
<choice>
|
|
419
433
|
<value>article</value>
|
|
@@ -531,7 +545,10 @@
|
|
|
531
545
|
</define>
|
|
532
546
|
<define name="fetched">
|
|
533
547
|
<element name="fetched">
|
|
534
|
-
<
|
|
548
|
+
<choice>
|
|
549
|
+
<data type="dateTime"/>
|
|
550
|
+
<data type="date"/>
|
|
551
|
+
</choice>
|
|
535
552
|
</element>
|
|
536
553
|
</define>
|
|
537
554
|
<define name="validity">
|
|
@@ -549,17 +566,26 @@
|
|
|
549
566
|
</define>
|
|
550
567
|
<define name="validityBegins">
|
|
551
568
|
<element name="validityBegins">
|
|
552
|
-
<
|
|
569
|
+
<choice>
|
|
570
|
+
<data type="dateTime"/>
|
|
571
|
+
<data type="date"/>
|
|
572
|
+
</choice>
|
|
553
573
|
</element>
|
|
554
574
|
</define>
|
|
555
575
|
<define name="validityEnds">
|
|
556
576
|
<element name="validityEnds">
|
|
557
|
-
<
|
|
577
|
+
<choice>
|
|
578
|
+
<data type="dateTime"/>
|
|
579
|
+
<data type="date"/>
|
|
580
|
+
</choice>
|
|
558
581
|
</element>
|
|
559
582
|
</define>
|
|
560
583
|
<define name="validityRevision">
|
|
561
584
|
<element name="revision">
|
|
562
|
-
<
|
|
585
|
+
<choice>
|
|
586
|
+
<data type="dateTime"/>
|
|
587
|
+
<data type="date"/>
|
|
588
|
+
</choice>
|
|
563
589
|
</element>
|
|
564
590
|
</define>
|
|
565
591
|
<define name="TypedTitleString">
|
|
@@ -744,6 +770,7 @@
|
|
|
744
770
|
<element name="from">
|
|
745
771
|
<choice>
|
|
746
772
|
<data type="dateTime"/>
|
|
773
|
+
<data type="date"/>
|
|
747
774
|
<data type="gYear"/>
|
|
748
775
|
</choice>
|
|
749
776
|
</element>
|
|
@@ -752,6 +779,7 @@
|
|
|
752
779
|
<element name="to">
|
|
753
780
|
<choice>
|
|
754
781
|
<data type="dateTime"/>
|
|
782
|
+
<data type="date"/>
|
|
755
783
|
<data type="gYear"/>
|
|
756
784
|
</choice>
|
|
757
785
|
</element>
|
|
@@ -83,19 +83,6 @@ module Asciidoctor
|
|
|
83
83
|
end
|
|
84
84
|
end
|
|
85
85
|
|
|
86
|
-
def metadata(node, xml)
|
|
87
|
-
title node, xml
|
|
88
|
-
metadata_id(node, xml)
|
|
89
|
-
metadata_author(node, xml)
|
|
90
|
-
metadata_publisher(node, xml)
|
|
91
|
-
xml.language (node.attr("language") || "en")
|
|
92
|
-
xml.script (node.attr("script") || "Latn")
|
|
93
|
-
metadata_status(node, xml)
|
|
94
|
-
metadata_copyright(node, xml)
|
|
95
|
-
metadata_committee(node, xml)
|
|
96
|
-
metadata_ics(node, xml)
|
|
97
|
-
end
|
|
98
|
-
|
|
99
86
|
def title_intro(node, t, lang, at)
|
|
100
87
|
return unless node.attr("title-intro-#{lang}")
|
|
101
88
|
t.title_intro(**attr_code(at)) do |t1|
|
|
@@ -1,7 +1,19 @@
|
|
|
1
1
|
<div id='toggle'> <span>•</span> </div>
|
|
2
|
-
|
|
2
|
+
{% if tc_docnumber %}
|
|
3
|
+
<p class="coverpage_docnumber">{{ tc_docnumber }}</p>
|
|
4
|
+
{% else %}
|
|
5
|
+
<p class="coverpage_docnumber">{{ docnumber }}:{{ docyear }}(E) {{ draftinfo }}</p>
|
|
6
|
+
{% endif %}
|
|
7
|
+
|
|
8
|
+
{% if revdate %}
|
|
9
|
+
<p class="coverpage_docnumber">Date: {{ revdate }}</p>
|
|
10
|
+
{% endif %}
|
|
11
|
+
|
|
12
|
+
{% if tc_docnumber %}
|
|
13
|
+
<p class="coverpage_docnumber">{{ docnumber }}:{{ docyear }}(E) {{ draftinfo }}</p>
|
|
14
|
+
{% endif %}
|
|
3
15
|
|
|
4
|
-
<p class="coverpage_techcommittee">{{ agency }}
|
|
16
|
+
<p class="coverpage_techcommittee">{{ agency }}/{{ editorialgroup | join: "/" }}</p>
|
|
5
17
|
|
|
6
18
|
<p class="coverpage_techcommittee"><a
|
|
7
19
|
name="CVP_Secretariat_Loca">Secretariat</a>: {{ secretariat }}</p>
|
|
@@ -478,6 +478,8 @@ table.MsoISOTable
|
|
|
478
478
|
mso-yfti-tbllook:480;
|
|
479
479
|
mso-border-insideh:.75pt solid windowtext;
|
|
480
480
|
mso-border-insidev:.75pt solid windowtext;
|
|
481
|
+
mso-table-anchor-vertical:paragraph;
|
|
482
|
+
mso-table-bspace:12.0pt;
|
|
481
483
|
font-size:10.0pt;
|
|
482
484
|
font-family:$bodyfont;}
|
|
483
485
|
table.MsoISOTable tr
|
|
@@ -504,6 +506,8 @@ table.MsoTableGrid
|
|
|
504
506
|
mso-para-margin:0cm;
|
|
505
507
|
mso-para-margin-bottom:.0001pt;
|
|
506
508
|
mso-pagination:widow-orphan;
|
|
509
|
+
mso-table-anchor-vertical:paragraph;
|
|
510
|
+
mso-table-bspace:12.0pt;
|
|
507
511
|
font-size:10.0pt;
|
|
508
512
|
font-family:$bodyfont;}
|
|
509
513
|
td { page-break-inside:avoid; }
|
|
@@ -664,6 +668,15 @@ p.example, li.example, div.example, td.example
|
|
|
664
668
|
mso-pagination:none;
|
|
665
669
|
font-size:10.0pt;
|
|
666
670
|
font-family:$bodyfont;}
|
|
671
|
+
|
|
672
|
+
table.example {
|
|
673
|
+
margin-bottom:12pt;
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
td.example p.MsoListParagraph {
|
|
677
|
+
font-size: 10.0pt;
|
|
678
|
+
}
|
|
679
|
+
|
|
667
680
|
span.note_label, span.example_label, td.example_label, td.note_label
|
|
668
681
|
{
|
|
669
682
|
font-size: 10.0pt;
|
|
@@ -1,9 +1,23 @@
|
|
|
1
|
+
{% if tc_docnumber %}
|
|
2
|
+
<p class="MsoNormal" align="right" style='text-align:right'><b style='mso-bidi-font-weight:
|
|
3
|
+
normal'><span lang="EN-GB" style='font-size:14.0pt;mso-no-proof:yes'>{{ tc_docnumber }}</span></b><b
|
|
4
|
+
style='mso-bidi-font-weight:normal'><span lang="EN-GB" style='font-size:14.0pt'><o:p></o:p></span></b></p>
|
|
5
|
+
{% else %}
|
|
1
6
|
<p class="MsoNormal" align="right" style='text-align:right'><b style='mso-bidi-font-weight:
|
|
2
7
|
normal'><span lang="EN-GB" style='font-size:14.0pt;mso-no-proof:yes'>{{ docnumber }}:{{ docyear }}(E) {{ draftinfo }}</span></b><b
|
|
3
8
|
style='mso-bidi-font-weight:normal'><span lang="EN-GB" style='font-size:14.0pt'><o:p></o:p></span></b></p>
|
|
9
|
+
{% endif %}
|
|
10
|
+
|
|
11
|
+
{% if revdate %}
|
|
12
|
+
<p class="MsoNormal" align="right" style='text-align:right'><span lang="EN-GB" style='mso-no-proof:yes'>Date: {{ revdate }}</span></p>
|
|
13
|
+
{% endif %}
|
|
14
|
+
|
|
15
|
+
{% if tc_docnumber %}
|
|
16
|
+
<p class="MsoNormal" align="right" style='text-align:right'><span lang="EN-GB" style='mso-no-proof:yes'>{{ docnumber }}:{{ docyear }}(E) {{ draftinfo }}</span></p>
|
|
17
|
+
{% endif %}
|
|
4
18
|
|
|
5
19
|
<p class="MsoNormal" align="right" style='text-align:right'><span lang="EN-GB"
|
|
6
|
-
style='mso-no-proof:yes'>{{ agency }}
|
|
20
|
+
style='mso-no-proof:yes'>{{ agency }}/{{ editorialgroup | join: "/" }}</span></p>
|
|
7
21
|
|
|
8
22
|
<p class="MsoNormal" align="right" style='margin-bottom:100.0pt;text-align:right'><span lang="EN-GB">Secretariat: <span style='mso-no-proof:yes'>{{ secretariat }}</span></span></p>
|
|
9
23
|
|
|
@@ -114,10 +114,8 @@ p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
|
|
|
114
114
|
mso-style-qformat:yes;
|
|
115
115
|
margin-top:0cm;
|
|
116
116
|
margin-right:0cm;
|
|
117
|
-
margin-bottom:
|
|
117
|
+
margin-bottom:12.0pt;
|
|
118
118
|
/* do not put in margin-left, it is specific to list level */
|
|
119
|
-
margin-bottom:.0001pt;
|
|
120
|
-
mso-add-space:auto;
|
|
121
119
|
mso-pagination:widow-orphan;
|
|
122
120
|
font-size:11.0pt;
|
|
123
121
|
font-family:$bodyfont;
|
|
@@ -130,10 +128,8 @@ p.MsoListParagraphCxSpFirst, li.MsoListParagraphCxSpFirst, div.MsoListParagraphC
|
|
|
130
128
|
mso-style-type:export-only;
|
|
131
129
|
margin-top:0cm;
|
|
132
130
|
margin-right:0cm;
|
|
133
|
-
margin-bottom:
|
|
131
|
+
margin-bottom:12.0pt;
|
|
134
132
|
/* do not put in margin-left, it is specific to list level */
|
|
135
|
-
margin-bottom:.0001pt;
|
|
136
|
-
mso-add-space:auto;
|
|
137
133
|
mso-pagination:widow-orphan;
|
|
138
134
|
font-size:11.0pt;
|
|
139
135
|
font-family:$bodyfont;
|
|
@@ -146,10 +142,8 @@ p.MsoListParagraphCxSpMiddle, li.MsoListParagraphCxSpMiddle, div.MsoListParagrap
|
|
|
146
142
|
mso-style-type:export-only;
|
|
147
143
|
margin-top:0cm;
|
|
148
144
|
margin-right:0cm;
|
|
149
|
-
margin-bottom:
|
|
145
|
+
margin-bottom:12.0pt;
|
|
150
146
|
/* do not put in margin-left, it is specific to list level */
|
|
151
|
-
margin-bottom:.0001pt;
|
|
152
|
-
mso-add-space:auto;
|
|
153
147
|
mso-pagination:widow-orphan;
|
|
154
148
|
font-size:11.0pt;
|
|
155
149
|
font-family:$bodyfont;
|
|
@@ -162,10 +156,8 @@ p.MsoListParagraphCxSpLast, li.MsoListParagraphCxSpLast, div.MsoListParagraphCxS
|
|
|
162
156
|
mso-style-type:export-only;
|
|
163
157
|
margin-top:0cm;
|
|
164
158
|
margin-right:0cm;
|
|
165
|
-
margin-bottom:0cm;
|
|
166
|
-
/* do not put in margin-left, it is specific to list level */
|
|
167
159
|
margin-bottom:12.0pt;
|
|
168
|
-
|
|
160
|
+
/* do not put in margin-left, it is specific to list level */
|
|
169
161
|
mso-pagination:widow-orphan;
|
|
170
162
|
font-size:11.0pt;
|
|
171
163
|
font-family:$bodyfont;
|
|
@@ -1250,6 +1242,8 @@ table.MsoNormalTable
|
|
|
1250
1242
|
mso-para-margin:0cm;
|
|
1251
1243
|
mso-para-margin-bottom:.0001pt;
|
|
1252
1244
|
mso-pagination:widow-orphan;
|
|
1245
|
+
mso-table-anchor-vertical:paragraph;
|
|
1246
|
+
mso-table-bspace:12.0pt;
|
|
1253
1247
|
font-size:10.0pt;
|
|
1254
1248
|
font-family:$bodyfont;}
|
|
1255
1249
|
br.section
|
data/lib/isodoc/iso/metadata.rb
CHANGED
|
@@ -35,6 +35,8 @@ module IsoDoc
|
|
|
35
35
|
isoxml.at(ns("//version/draft")))
|
|
36
36
|
set(:stageabbr, abbr)
|
|
37
37
|
end
|
|
38
|
+
revdate = isoxml.at(ns("//version/revision-date"))
|
|
39
|
+
set(:revdate, revdate&.text)
|
|
38
40
|
end
|
|
39
41
|
|
|
40
42
|
def docid(isoxml, _out)
|
|
@@ -43,9 +45,11 @@ module IsoDoc
|
|
|
43
45
|
if docstatus
|
|
44
46
|
abbr = get[:stageabbr]
|
|
45
47
|
docstatus = get[:stage]
|
|
46
|
-
(docstatus.to_i < 60) && dn = dn.sub(/ /, "
|
|
48
|
+
(docstatus.to_i < 60) && dn = dn.sub(/ /, "/#{abbr} ")
|
|
47
49
|
end
|
|
48
50
|
set(:docnumber, dn)
|
|
51
|
+
tcdn = isoxml.at(ns("//bibdata/docidentifier/tc-document-number"))
|
|
52
|
+
set(:tc_docnumber, tcdn&.text)
|
|
49
53
|
end
|
|
50
54
|
|
|
51
55
|
# we don't leave this to i18n.rb, because we have both English and
|
|
@@ -53,6 +53,8 @@ module IsoDoc
|
|
|
53
53
|
end
|
|
54
54
|
|
|
55
55
|
def colophon(body, docxml)
|
|
56
|
+
stage = @meta.get[:stage_int]
|
|
57
|
+
return if !stage.nil? && stage < 60
|
|
56
58
|
body.br **{ clear: "all", style: "page-break-before:left;mso-break-type:section-break" }
|
|
57
59
|
body.div **{ class: "colophon" } do |div|
|
|
58
60
|
end
|
|
@@ -22,8 +22,8 @@ module Metanorma
|
|
|
22
22
|
"Metanorma::ISO #{Metanorma::ISO::VERSION}"
|
|
23
23
|
end
|
|
24
24
|
|
|
25
|
-
def input_to_isodoc(file)
|
|
26
|
-
Metanorma::Input::Asciidoc.new.process(file, @asciidoctor_backend)
|
|
25
|
+
def input_to_isodoc(file, filename)
|
|
26
|
+
Metanorma::Input::Asciidoc.new.process(file, filename, @asciidoctor_backend)
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
def output(isodoc_node, outname, format, options={})
|
data/metanorma-iso.gemspec
CHANGED
|
@@ -33,7 +33,6 @@ Gem::Specification.new do |spec|
|
|
|
33
33
|
spec.add_dependency "ruby-jing"
|
|
34
34
|
spec.add_dependency "isodoc", "~> 0.9.0"
|
|
35
35
|
spec.add_dependency "iev", "~> 0.2.0"
|
|
36
|
-
spec.add_dependency "relaton", "~> 0.2.0"
|
|
37
36
|
spec.add_dependency "metanorma-standoc", "~> 1.0.0"
|
|
38
37
|
|
|
39
38
|
spec.add_development_dependency "bundler", "~> 1.15"
|
|
@@ -46,7 +45,5 @@ Gem::Specification.new do |spec|
|
|
|
46
45
|
spec.add_development_dependency "rubocop", "~> 0.50"
|
|
47
46
|
spec.add_development_dependency "simplecov", "~> 0.15"
|
|
48
47
|
spec.add_development_dependency "timecop", "~> 0.9"
|
|
49
|
-
spec.add_development_dependency "metanorma", "~> 0.
|
|
50
|
-
spec.add_development_dependency "isobib", "~> 0.3.0"
|
|
51
|
-
spec.add_development_dependency "ietfbib", "~> 0.4.0"
|
|
48
|
+
spec.add_development_dependency "metanorma", "~> 0.3.0"
|
|
52
49
|
end
|
|
@@ -8,7 +8,9 @@ RSpec.describe Asciidoctor::ISO do
|
|
|
8
8
|
|
|
9
9
|
it "generates output for the Rice document" do
|
|
10
10
|
FileUtils.rm_f %w(spec/examples/rice.xml spec/examples/rice.doc spec/examples/rice.html spec/examples/rice_alt.html)
|
|
11
|
-
|
|
11
|
+
FileUtils.cd "spec/examples"
|
|
12
|
+
Asciidoctor.convert_file "rice.adoc", {:attributes=>{"backend"=>"iso"}, :safe=>0, :header_footer=>true, :requires=>["metanorma-iso"], :failure_level=>4, :mkdirs=>true, :to_file=>nil}
|
|
13
|
+
FileUtils.cd "../.."
|
|
12
14
|
expect(File.exist?("spec/examples/rice.xml")).to be true
|
|
13
15
|
expect(File.exist?("spec/examples/rice.doc")).to be true
|
|
14
16
|
expect(File.exist?("spec/examples/rice.html")).to be true
|
|
@@ -32,6 +34,7 @@ RSpec.describe Asciidoctor::ISO do
|
|
|
32
34
|
Author
|
|
33
35
|
:docfile: test.adoc
|
|
34
36
|
:novalid:
|
|
37
|
+
:no-isobib:
|
|
35
38
|
INPUT
|
|
36
39
|
#{BLANK_HDR}
|
|
37
40
|
<sections/>
|
|
@@ -48,6 +51,7 @@ RSpec.describe Asciidoctor::ISO do
|
|
|
48
51
|
:docfile: test.adoc
|
|
49
52
|
:nodoc:
|
|
50
53
|
:novalid:
|
|
54
|
+
:no-isobib:
|
|
51
55
|
:docnumber: 1000
|
|
52
56
|
:partnumber: 1
|
|
53
57
|
:edition: 2
|
|
@@ -167,6 +171,7 @@ RSpec.describe Asciidoctor::ISO do
|
|
|
167
171
|
:docfile: test.adoc
|
|
168
172
|
:nodoc:
|
|
169
173
|
:novalid:
|
|
174
|
+
:no-isobib:
|
|
170
175
|
:docnumber: 1000
|
|
171
176
|
:partnumber: 1-1
|
|
172
177
|
:tc-docnumber: 2000
|
|
@@ -277,6 +282,7 @@ RSpec.describe Asciidoctor::ISO do
|
|
|
277
282
|
Author
|
|
278
283
|
:docfile: test.adoc
|
|
279
284
|
:novalid:
|
|
285
|
+
:no-isobib:
|
|
280
286
|
INPUT
|
|
281
287
|
html = File.read("test.html", encoding: "utf-8")
|
|
282
288
|
expect(html).to match(%r{<script>})
|
|
@@ -289,6 +295,7 @@ RSpec.describe Asciidoctor::ISO do
|
|
|
289
295
|
Author
|
|
290
296
|
:docfile: test.adoc
|
|
291
297
|
:novalid:
|
|
298
|
+
:no-isobib:
|
|
292
299
|
INPUT
|
|
293
300
|
html = File.read("test.html", encoding: "utf-8")
|
|
294
301
|
expect(html).to match(%r[\.Sourcecode[^{]+\{[^{]+font-family: "Courier New", monospace;]m)
|
|
@@ -303,6 +310,7 @@ RSpec.describe Asciidoctor::ISO do
|
|
|
303
310
|
Author
|
|
304
311
|
:docfile: test.adoc
|
|
305
312
|
:novalid:
|
|
313
|
+
:no-isobib:
|
|
306
314
|
INPUT
|
|
307
315
|
html = File.read("test_alt.html", encoding: "utf-8")
|
|
308
316
|
expect(html).to match(%r[\.Sourcecode[^{]+\{[^{]+font-family: "Space Mono", monospace;]m)
|
|
@@ -317,6 +325,7 @@ RSpec.describe Asciidoctor::ISO do
|
|
|
317
325
|
Author
|
|
318
326
|
:docfile: test.adoc
|
|
319
327
|
:novalid:
|
|
328
|
+
:no-isobib:
|
|
320
329
|
:script: Hans
|
|
321
330
|
INPUT
|
|
322
331
|
html = File.read("test.html", encoding: "utf-8")
|
|
@@ -332,6 +341,7 @@ RSpec.describe Asciidoctor::ISO do
|
|
|
332
341
|
Author
|
|
333
342
|
:docfile: test.adoc
|
|
334
343
|
:novalid:
|
|
344
|
+
:no-isobib:
|
|
335
345
|
:script: Hans
|
|
336
346
|
:body-font: Zapf Chancery
|
|
337
347
|
:header-font: Comic Sans
|
|
@@ -351,6 +361,7 @@ RSpec.describe Asciidoctor::ISO do
|
|
|
351
361
|
Author
|
|
352
362
|
:docfile: test.adoc
|
|
353
363
|
:novalid:
|
|
364
|
+
:no-isobib:
|
|
354
365
|
INPUT
|
|
355
366
|
word = File.read("test.doc", encoding: "utf-8")
|
|
356
367
|
html = File.read("test.html", encoding: "utf-8")
|
|
@@ -80,8 +80,9 @@ RSpec.describe Asciidoctor::ISO do
|
|
|
80
80
|
</sections><bibliography><references id="_" obligation="informative">
|
|
81
81
|
<title>Normative References</title>
|
|
82
82
|
<bibitem type="international-standard" id="iso123">
|
|
83
|
-
<
|
|
84
|
-
<title format="text/plain" language="
|
|
83
|
+
<fetched>#{Date.today}</fetched>
|
|
84
|
+
<title format="text/plain" language="en" script="Latn">Rubber latex — Sampling</title>
|
|
85
|
+
<title format="text/plain" language="fr" script="Latn">Latex de caoutchouc — ?chantillonnage</title>
|
|
85
86
|
<uri type="src">https://www.iso.org/standard/23281.html</uri>
|
|
86
87
|
<uri type="obp">https://www.iso.org/obp/ui/#!iso:std:23281:en</uri>
|
|
87
88
|
<uri type="rss">https://www.iso.org/contents/data/standard/02/32/23281.detail.rss</uri>
|
|
@@ -173,8 +174,9 @@ RSpec.describe Asciidoctor::ISO do
|
|
|
173
174
|
</sections><bibliography><references id="_" obligation="informative">
|
|
174
175
|
<title>Normative References</title>
|
|
175
176
|
<bibitem type="international-standard" id="iso123">
|
|
177
|
+
<fetched>#{Date.today}</fetched>
|
|
176
178
|
<title format="text/plain" language="en" script="Latn">Permuted index of the vocabulary of information technology</title>
|
|
177
|
-
<title format="text/plain" language="fr" script="Latn">Index permuté du vocabulaire des technologies de l
|
|
179
|
+
<title format="text/plain" language="fr" script="Latn">Index permuté du vocabulaire des technologies de l’information</title>
|
|
178
180
|
<uri type="src">https://www.iso.org/standard/21071.html</uri>
|
|
179
181
|
<uri type="obp">https://www.iso.org/obp/ui/#!iso:std:21071:en</uri>
|
|
180
182
|
<uri type="rss">https://www.iso.org/contents/data/standard/02/10/21071.detail.rss</uri>
|
|
@@ -228,8 +230,9 @@ RSpec.describe Asciidoctor::ISO do
|
|
|
228
230
|
</ics>
|
|
229
231
|
</bibitem>
|
|
230
232
|
<bibitem type="international-standard" id="iso124">
|
|
231
|
-
<
|
|
232
|
-
<title format="text/plain" language="
|
|
233
|
+
<fetched>#{Date.today}</fetched>
|
|
234
|
+
<title format="text/plain" language="en" script="Latn">Latex, rubber — Determination of total solids content</title>
|
|
235
|
+
<title format="text/plain" language="fr" script="Latn">Latex de caoutchouc — Détermination des matières solides totales</title>
|
|
233
236
|
<uri type="src">https://www.iso.org/standard/61884.html</uri>
|
|
234
237
|
<uri type="obp">https://www.iso.org/obp/ui/#!iso:std:61884:en</uri>
|
|
235
238
|
<uri type="rss">https://www.iso.org/contents/data/standard/06/18/61884.detail.rss</uri>
|
|
@@ -360,13 +363,13 @@ RSpec.describe Asciidoctor::ISO do
|
|
|
360
363
|
|
|
361
364
|
</sections><bibliography><references id="_" obligation="informative">
|
|
362
365
|
<title>Normative References</title>
|
|
363
|
-
<bibitem
|
|
364
|
-
|
|
366
|
+
<bibitem id="iso123">
|
|
367
|
+
<fetched>#{Date.today}</fetched>
|
|
368
|
+
<title format="plain" language="en" script="Latn">Network Configuration Access Control Model</title>
|
|
365
369
|
<docidentifier type="IETF">RFC 8341</docidentifier>
|
|
366
370
|
<date type="published">
|
|
367
371
|
<on>2018</on>
|
|
368
372
|
</date>
|
|
369
|
-
<status>published</status>
|
|
370
373
|
</bibitem>
|
|
371
374
|
</references>
|
|
372
375
|
</bibliography>
|
|
@@ -508,16 +511,17 @@ RSpec.describe Asciidoctor::ISO do
|
|
|
508
511
|
|
|
509
512
|
def mock_isobib_get_123
|
|
510
513
|
expect(Isobib::IsoBibliography).to receive(:get).with("ISO 123", nil, {}) do
|
|
511
|
-
IsoBibItem.from_xml(<<~"OUTPUT")
|
|
512
|
-
<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 type="ISO">ISO 123:2001</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>
|
|
514
|
+
IsoBibItem::XMLParser.from_xml(<<~"OUTPUT")
|
|
515
|
+
<bibitem type=\"international-standard\" id=\"ISO123\">\n <fetched>#{Date.today}</fetched>\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 type="ISO">ISO 123:2001</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>
|
|
513
516
|
OUTPUT
|
|
514
517
|
end
|
|
515
518
|
end
|
|
516
519
|
|
|
517
520
|
def mock_isobib_get_124
|
|
518
521
|
expect(Isobib::IsoBibliography).to receive(:get).with("ISO 124", "2014", {}) do
|
|
519
|
-
IsoBibItem.from_xml(<<~"OUTPUT")
|
|
522
|
+
IsoBibItem::XMLParser.from_xml(<<~"OUTPUT")
|
|
520
523
|
<bibitem type="international-standard" id="iso124">
|
|
524
|
+
<fetched>#{Date.today}</fetched>
|
|
521
525
|
<title format="text/plain" language="en" script="Latn">Latex, rubber -- Determination of total solids content</title>
|
|
522
526
|
<title format="text/plain" language="fr" script="Latn">Latex de caoutchouc -- Détermination des matières solides totales</title>
|
|
523
527
|
<uri type="src">https://www.iso.org/standard/61884.html</uri>
|
|
@@ -566,8 +570,9 @@ RSpec.describe Asciidoctor::ISO do
|
|
|
566
570
|
|
|
567
571
|
def mock_isobib_get_iec12382
|
|
568
572
|
expect(Isobib::IsoBibliography).to receive(:get).with("ISO/IEC TR 12382", "1992", {}) do
|
|
569
|
-
IsoBibItem.from_xml(<<~"OUTPUT")
|
|
573
|
+
IsoBibItem::XMLParser.from_xml(<<~"OUTPUT")
|
|
570
574
|
<bibitem type="international-standard" id="iso123">
|
|
575
|
+
<fetched>#{Date.today}</fetched>
|
|
571
576
|
<title format="text/plain" language="en" script="Latn">Permuted index of the vocabulary of information technology</title>
|
|
572
577
|
<title format="text/plain" language="fr" script="Latn">Index permuté du vocabulaire des technologies de l'information</title>
|
|
573
578
|
<uri type="src">https://www.iso.org/standard/21071.html</uri>
|
|
@@ -628,8 +633,9 @@ end
|
|
|
628
633
|
|
|
629
634
|
def mock_rfcbib_get_rfc8341
|
|
630
635
|
expect(IETFBib::RfcBibliography).to receive(:get).with("RFC 8341", nil, {}) do
|
|
631
|
-
|
|
636
|
+
IETFBib::XMLParser.from_xml(<<~"OUTPUT")
|
|
632
637
|
<bibitem id="RFC8341">
|
|
638
|
+
<fetched>#{Date.today}</fetched>
|
|
633
639
|
<title format="text/plain" language="en" script="Latn">Network Configuration Access Control Model</title>
|
|
634
640
|
<docidentifier type="IETF">RFC 8341</docidentifier>
|
|
635
641
|
<date type="published">
|