metanorma-iso 1.8.1 → 1.8.2
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/.rubocop.yml +0 -2
- data/lib/asciidoctor/iso/base.rb +1 -0
- data/lib/asciidoctor/iso/cleanup.rb +17 -5
- data/lib/asciidoctor/iso/front.rb +3 -1
- data/lib/asciidoctor/iso/front_id.rb +66 -50
- data/lib/asciidoctor/iso/isodoc.rng +174 -0
- data/lib/asciidoctor/iso/isostandard.rng +1 -0
- data/lib/asciidoctor/iso/section.rb +2 -1
- data/lib/isodoc/iso/iso.amendment.xsl +65 -0
- data/lib/isodoc/iso/iso.international-standard.xsl +65 -0
- data/lib/isodoc/iso/metadata.rb +1 -0
- data/lib/isodoc/iso/sts_convert.rb +10 -13
- data/lib/isodoc/iso/xref.rb +31 -18
- data/lib/metanorma/iso/version.rb +1 -1
- data/metanorma-iso.gemspec +1 -1
- data/spec/asciidoctor/base_spec.rb +426 -334
- data/spec/asciidoctor/cleanup_spec.rb +383 -25
- data/spec/asciidoctor/section_spec.rb +0 -14
- data/spec/asciidoctor/validate_spec.rb +72 -39
- data/spec/isodoc/postproc_spec.rb +475 -434
- metadata +4 -4
@@ -10,7 +10,7 @@ module Asciidoctor
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def scope_parse(attrs, xml, node)
|
13
|
-
attrs = attrs.merge(type: "scope") unless @amd
|
13
|
+
attrs = attrs.merge(type: "scope") unless @amd
|
14
14
|
clause_parse(attrs, xml, node)
|
15
15
|
end
|
16
16
|
|
@@ -32,6 +32,7 @@ module Asciidoctor
|
|
32
32
|
|
33
33
|
def sectiontype(node, level = true)
|
34
34
|
return nil if @amd
|
35
|
+
|
35
36
|
super
|
36
37
|
end
|
37
38
|
end
|
@@ -3896,6 +3896,7 @@
|
|
3896
3896
|
|
3897
3897
|
|
3898
3898
|
|
3899
|
+
|
3899
3900
|
<xsl:if test="ancestor::*[local-name() = 'tfoot']">
|
3900
3901
|
<xsl:attribute name="border">solid black 0</xsl:attribute>
|
3901
3902
|
</xsl:if>
|
@@ -6515,6 +6516,70 @@
|
|
6515
6516
|
<xsl:value-of select="substring(.,1,1)"/>
|
6516
6517
|
</xsl:template><xsl:template match="*[local-name() = 'title']" mode="title">
|
6517
6518
|
<fo:inline><xsl:apply-templates/></fo:inline>
|
6519
|
+
</xsl:template><xsl:template match="*[local-name() = 'form']">
|
6520
|
+
<fo:block>
|
6521
|
+
<xsl:apply-templates/>
|
6522
|
+
</fo:block>
|
6523
|
+
</xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'label']">
|
6524
|
+
<fo:inline><xsl:apply-templates/></fo:inline>
|
6525
|
+
</xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'text' or @type = 'date' or @type = 'file' or @type = 'password']">
|
6526
|
+
<fo:inline>
|
6527
|
+
<xsl:call-template name="text_input"/>
|
6528
|
+
</fo:inline>
|
6529
|
+
</xsl:template><xsl:template name="text_input">
|
6530
|
+
<xsl:variable name="count">
|
6531
|
+
<xsl:choose>
|
6532
|
+
<xsl:when test="normalize-space(@maxlength) != ''"><xsl:value-of select="@maxlength"/></xsl:when>
|
6533
|
+
<xsl:when test="normalize-space(@size) != ''"><xsl:value-of select="@size"/></xsl:when>
|
6534
|
+
<xsl:otherwise>10</xsl:otherwise>
|
6535
|
+
</xsl:choose>
|
6536
|
+
</xsl:variable>
|
6537
|
+
<xsl:call-template name="repeat">
|
6538
|
+
<xsl:with-param name="char" select="'_'"/>
|
6539
|
+
<xsl:with-param name="count" select="$count"/>
|
6540
|
+
</xsl:call-template>
|
6541
|
+
<xsl:text> </xsl:text>
|
6542
|
+
</xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'button']">
|
6543
|
+
<xsl:variable name="caption">
|
6544
|
+
<xsl:choose>
|
6545
|
+
<xsl:when test="normalize-space(@value) != ''"><xsl:value-of select="@value"/></xsl:when>
|
6546
|
+
<xsl:otherwise>BUTTON</xsl:otherwise>
|
6547
|
+
</xsl:choose>
|
6548
|
+
</xsl:variable>
|
6549
|
+
<fo:inline>[<xsl:value-of select="$caption"/>]</fo:inline>
|
6550
|
+
</xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'checkbox']">
|
6551
|
+
<fo:inline padding-right="1mm">
|
6552
|
+
<fo:instream-foreign-object fox:alt-text="Box" baseline-shift="-10%">
|
6553
|
+
<xsl:attribute name="height">3.5mm</xsl:attribute>
|
6554
|
+
<xsl:attribute name="content-width">100%</xsl:attribute>
|
6555
|
+
<xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
|
6556
|
+
<xsl:attribute name="scaling">uniform</xsl:attribute>
|
6557
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="80" height="80">
|
6558
|
+
<polyline points="0,0 80,0 80,80 0,80 0,0" stroke="black" stroke-width="5" fill="white"/>
|
6559
|
+
</svg>
|
6560
|
+
</fo:instream-foreign-object>
|
6561
|
+
</fo:inline>
|
6562
|
+
</xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'radio']">
|
6563
|
+
<fo:inline padding-right="1mm">
|
6564
|
+
<fo:instream-foreign-object fox:alt-text="Box" baseline-shift="-10%">
|
6565
|
+
<xsl:attribute name="height">3.5mm</xsl:attribute>
|
6566
|
+
<xsl:attribute name="content-width">100%</xsl:attribute>
|
6567
|
+
<xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
|
6568
|
+
<xsl:attribute name="scaling">uniform</xsl:attribute>
|
6569
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="80" height="80">
|
6570
|
+
<circle cx="40" cy="40" r="30" stroke="black" stroke-width="5" fill="white"/>
|
6571
|
+
<circle cx="40" cy="40" r="15" stroke="black" stroke-width="5" fill="white"/>
|
6572
|
+
</svg>
|
6573
|
+
</fo:instream-foreign-object>
|
6574
|
+
</fo:inline>
|
6575
|
+
</xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'select']">
|
6576
|
+
<fo:inline>
|
6577
|
+
<xsl:call-template name="text_input"/>
|
6578
|
+
</fo:inline>
|
6579
|
+
</xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'textarea']">
|
6580
|
+
<fo:block-container border="1pt solid black" width="50%">
|
6581
|
+
<fo:block> </fo:block>
|
6582
|
+
</fo:block-container>
|
6518
6583
|
</xsl:template><xsl:template name="convertDate">
|
6519
6584
|
<xsl:param name="date"/>
|
6520
6585
|
<xsl:param name="format" select="'short'"/>
|
@@ -3896,6 +3896,7 @@
|
|
3896
3896
|
|
3897
3897
|
|
3898
3898
|
|
3899
|
+
|
3899
3900
|
<xsl:if test="ancestor::*[local-name() = 'tfoot']">
|
3900
3901
|
<xsl:attribute name="border">solid black 0</xsl:attribute>
|
3901
3902
|
</xsl:if>
|
@@ -6515,6 +6516,70 @@
|
|
6515
6516
|
<xsl:value-of select="substring(.,1,1)"/>
|
6516
6517
|
</xsl:template><xsl:template match="*[local-name() = 'title']" mode="title">
|
6517
6518
|
<fo:inline><xsl:apply-templates/></fo:inline>
|
6519
|
+
</xsl:template><xsl:template match="*[local-name() = 'form']">
|
6520
|
+
<fo:block>
|
6521
|
+
<xsl:apply-templates/>
|
6522
|
+
</fo:block>
|
6523
|
+
</xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'label']">
|
6524
|
+
<fo:inline><xsl:apply-templates/></fo:inline>
|
6525
|
+
</xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'text' or @type = 'date' or @type = 'file' or @type = 'password']">
|
6526
|
+
<fo:inline>
|
6527
|
+
<xsl:call-template name="text_input"/>
|
6528
|
+
</fo:inline>
|
6529
|
+
</xsl:template><xsl:template name="text_input">
|
6530
|
+
<xsl:variable name="count">
|
6531
|
+
<xsl:choose>
|
6532
|
+
<xsl:when test="normalize-space(@maxlength) != ''"><xsl:value-of select="@maxlength"/></xsl:when>
|
6533
|
+
<xsl:when test="normalize-space(@size) != ''"><xsl:value-of select="@size"/></xsl:when>
|
6534
|
+
<xsl:otherwise>10</xsl:otherwise>
|
6535
|
+
</xsl:choose>
|
6536
|
+
</xsl:variable>
|
6537
|
+
<xsl:call-template name="repeat">
|
6538
|
+
<xsl:with-param name="char" select="'_'"/>
|
6539
|
+
<xsl:with-param name="count" select="$count"/>
|
6540
|
+
</xsl:call-template>
|
6541
|
+
<xsl:text> </xsl:text>
|
6542
|
+
</xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'button']">
|
6543
|
+
<xsl:variable name="caption">
|
6544
|
+
<xsl:choose>
|
6545
|
+
<xsl:when test="normalize-space(@value) != ''"><xsl:value-of select="@value"/></xsl:when>
|
6546
|
+
<xsl:otherwise>BUTTON</xsl:otherwise>
|
6547
|
+
</xsl:choose>
|
6548
|
+
</xsl:variable>
|
6549
|
+
<fo:inline>[<xsl:value-of select="$caption"/>]</fo:inline>
|
6550
|
+
</xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'checkbox']">
|
6551
|
+
<fo:inline padding-right="1mm">
|
6552
|
+
<fo:instream-foreign-object fox:alt-text="Box" baseline-shift="-10%">
|
6553
|
+
<xsl:attribute name="height">3.5mm</xsl:attribute>
|
6554
|
+
<xsl:attribute name="content-width">100%</xsl:attribute>
|
6555
|
+
<xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
|
6556
|
+
<xsl:attribute name="scaling">uniform</xsl:attribute>
|
6557
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="80" height="80">
|
6558
|
+
<polyline points="0,0 80,0 80,80 0,80 0,0" stroke="black" stroke-width="5" fill="white"/>
|
6559
|
+
</svg>
|
6560
|
+
</fo:instream-foreign-object>
|
6561
|
+
</fo:inline>
|
6562
|
+
</xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'radio']">
|
6563
|
+
<fo:inline padding-right="1mm">
|
6564
|
+
<fo:instream-foreign-object fox:alt-text="Box" baseline-shift="-10%">
|
6565
|
+
<xsl:attribute name="height">3.5mm</xsl:attribute>
|
6566
|
+
<xsl:attribute name="content-width">100%</xsl:attribute>
|
6567
|
+
<xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
|
6568
|
+
<xsl:attribute name="scaling">uniform</xsl:attribute>
|
6569
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="80" height="80">
|
6570
|
+
<circle cx="40" cy="40" r="30" stroke="black" stroke-width="5" fill="white"/>
|
6571
|
+
<circle cx="40" cy="40" r="15" stroke="black" stroke-width="5" fill="white"/>
|
6572
|
+
</svg>
|
6573
|
+
</fo:instream-foreign-object>
|
6574
|
+
</fo:inline>
|
6575
|
+
</xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'select']">
|
6576
|
+
<fo:inline>
|
6577
|
+
<xsl:call-template name="text_input"/>
|
6578
|
+
</fo:inline>
|
6579
|
+
</xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'textarea']">
|
6580
|
+
<fo:block-container border="1pt solid black" width="50%">
|
6581
|
+
<fo:block> </fo:block>
|
6582
|
+
</fo:block-container>
|
6518
6583
|
</xsl:template><xsl:template name="convertDate">
|
6519
6584
|
<xsl:param name="date"/>
|
6520
6585
|
<xsl:param name="format" select="'short'"/>
|
data/lib/isodoc/iso/metadata.rb
CHANGED
@@ -4,28 +4,25 @@ require "mn2sts"
|
|
4
4
|
module IsoDoc
|
5
5
|
module Iso
|
6
6
|
|
7
|
-
# A {Converter} implementation that generates HTML output, and a document
|
8
|
-
# schema encapsulation of the document for validation
|
9
|
-
#
|
10
7
|
class StsConvert < IsoDoc::XslfoPdfConvert
|
11
|
-
def initialize(
|
8
|
+
def initialize(_options) # rubocop:disable Lint/MissingSuper
|
12
9
|
@libdir = File.dirname(__FILE__)
|
13
10
|
@format = :sts
|
14
11
|
@suffix = "sts.xml"
|
15
12
|
end
|
16
13
|
|
17
|
-
def convert(
|
18
|
-
file = File.read(
|
19
|
-
|
20
|
-
/\.xml$/.match(
|
21
|
-
|
22
|
-
|
23
|
-
|
14
|
+
def convert(in_fname, file = nil, debug = false, out_fname = nil)
|
15
|
+
file = File.read(in_fname, encoding: "utf-8") if file.nil?
|
16
|
+
_docxml, filename, dir = convert_init(file, in_fname, debug)
|
17
|
+
unless /\.xml$/.match?(in_fname)
|
18
|
+
in_fname = Tempfile.open([filename, ".xml"], encoding: "utf-8") do |f|
|
19
|
+
f.write file
|
20
|
+
f.path
|
21
|
+
end
|
24
22
|
end
|
25
23
|
FileUtils.rm_rf dir
|
26
|
-
Mn2sts.convert(
|
24
|
+
Mn2sts.convert(in_fname, out_fname || "#{filename}.#{@suffix}")
|
27
25
|
end
|
28
26
|
end
|
29
27
|
end
|
30
28
|
end
|
31
|
-
|
data/lib/isodoc/iso/xref.rb
CHANGED
@@ -4,24 +4,33 @@ module IsoDoc
|
|
4
4
|
end
|
5
5
|
|
6
6
|
class Xref < IsoDoc::Xref
|
7
|
-
def initial_anchor_names(
|
8
|
-
if @klass.amd(
|
9
|
-
|
10
|
-
sequential_asset_names(d.xpath(ns("//preface/*")))
|
11
|
-
d.xpath(ns("//sections/clause")).each { |c| c.element? and preface_names(c) }
|
12
|
-
middle_section_asset_names(d)
|
13
|
-
termnote_anchor_names(d)
|
14
|
-
termexample_anchor_names(d)
|
7
|
+
def initial_anchor_names(doc)
|
8
|
+
if @klass.amd(doc)
|
9
|
+
initial_anchor_names_amd(doc)
|
15
10
|
else
|
16
11
|
super
|
17
12
|
end
|
18
|
-
introduction_names(
|
13
|
+
introduction_names(doc.at(ns("//introduction")))
|
14
|
+
end
|
15
|
+
|
16
|
+
def initial_anchor_names_amd(doc)
|
17
|
+
doc.xpath(ns("//preface/*")).each do |c|
|
18
|
+
c.element? and preface_names(c)
|
19
|
+
end
|
20
|
+
sequential_asset_names(doc.xpath(ns("//preface/*")))
|
21
|
+
doc.xpath(ns("//sections/clause")).each do |c|
|
22
|
+
c.element? and preface_names(c)
|
23
|
+
end
|
24
|
+
middle_section_asset_names(doc)
|
25
|
+
termnote_anchor_names(doc)
|
26
|
+
termexample_anchor_names(doc)
|
19
27
|
end
|
20
28
|
|
21
29
|
# we can reference 0-number clauses in introduction
|
22
30
|
def introduction_names(clause)
|
23
31
|
return if clause.nil?
|
24
|
-
|
32
|
+
|
33
|
+
clause.at(ns("./clause")) and @anchors[clause["id"]] =
|
25
34
|
{ label: "0", level: 1, xref: clause.at(ns("./title"))&.text, type: "clause" }
|
26
35
|
i = Counter.new
|
27
36
|
clause.xpath(ns("./clause")).each do |c|
|
@@ -35,17 +44,19 @@ module IsoDoc
|
|
35
44
|
super
|
36
45
|
end
|
37
46
|
|
38
|
-
def appendix_names(clause,
|
47
|
+
def appendix_names(clause, _num)
|
39
48
|
i = Counter.new
|
40
49
|
clause.xpath(ns("./appendix")).each do |c|
|
41
50
|
i.increment(c)
|
42
|
-
@anchors[c["id"]] = anchor_struct(i.print, nil, @labels["appendix"],
|
51
|
+
@anchors[c["id"]] = anchor_struct(i.print, nil, @labels["appendix"],
|
52
|
+
"clause")
|
43
53
|
@anchors[c["id"]][:level] = 2
|
44
54
|
@anchors[c["id"]][:container] = clause["id"]
|
45
55
|
j = Counter.new
|
46
56
|
c.xpath(ns("./clause | ./references")).each do |c1|
|
47
57
|
j.increment(c1)
|
48
|
-
|
58
|
+
lbl = "#{@labels['appendix']} #{i.print}.#{j.print}"
|
59
|
+
appendix_names1(c1, l10n(lbl), 3, clause["id"])
|
49
60
|
end
|
50
61
|
end
|
51
62
|
end
|
@@ -73,7 +84,8 @@ module IsoDoc
|
|
73
84
|
end
|
74
85
|
|
75
86
|
def appendix_names1(clause, num, level, container)
|
76
|
-
@anchors[clause["id"]] = { label: num, xref: num, level: level,
|
87
|
+
@anchors[clause["id"]] = { label: num, xref: num, level: level,
|
88
|
+
container: container }
|
77
89
|
i = Counter.new
|
78
90
|
clause.xpath(ns("./clause | ./references")).each do |c|
|
79
91
|
i.increment(c)
|
@@ -96,7 +108,8 @@ module IsoDoc
|
|
96
108
|
def figure_anchor(t, sublabel, label)
|
97
109
|
@anchors[t["id"]] = anchor_struct(
|
98
110
|
(sublabel ? "#{label} #{sublabel}" : label),
|
99
|
-
nil, @labels["figure"], "figure", t["unnumbered"]
|
111
|
+
nil, @labels["figure"], "figure", t["unnumbered"]
|
112
|
+
)
|
100
113
|
sublabel && t["unnumbered"] != "true" and
|
101
114
|
@anchors[t["id"]][:label] = sublabel
|
102
115
|
end
|
@@ -104,10 +117,10 @@ module IsoDoc
|
|
104
117
|
def sequential_figure_names(clause)
|
105
118
|
c = IsoDoc::XrefGen::Counter.new
|
106
119
|
j = 0
|
107
|
-
clause.xpath(ns(".//figure | .//sourcecode[not(ancestor::example)]"))
|
108
|
-
each do |t|
|
120
|
+
clause.xpath(ns(".//figure | .//sourcecode[not(ancestor::example)]"))
|
121
|
+
.each do |t|
|
109
122
|
j = subfigure_increment(j, c, t)
|
110
|
-
sublabel = j.zero? ? nil : "#{(j+96).chr})"
|
123
|
+
sublabel = j.zero? ? nil : "#{(j + 96).chr})"
|
111
124
|
next if t["id"].nil? || t["id"].empty?
|
112
125
|
|
113
126
|
figure_anchor(t, sublabel, c.print)
|
data/metanorma-iso.gemspec
CHANGED
@@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
|
|
29
29
|
spec.test_files = `git ls-files -- {spec}/*`.split("\n")
|
30
30
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
|
31
31
|
|
32
|
-
spec.add_dependency "isodoc", "~> 1.6.
|
32
|
+
spec.add_dependency "isodoc", "~> 1.6.2"
|
33
33
|
spec.add_dependency "metanorma-standoc", "~> 1.9.0"
|
34
34
|
spec.add_dependency "mn2sts", "~> 1.5.0"
|
35
35
|
spec.add_dependency "ruby-jing"
|
@@ -6,27 +6,33 @@ RSpec.describe Asciidoctor::ISO do
|
|
6
6
|
end
|
7
7
|
|
8
8
|
it "processes a blank document" do
|
9
|
-
|
9
|
+
input = <<~INPUT
|
10
10
|
#{ASCIIDOC_BLANK_HDR}
|
11
11
|
INPUT
|
12
|
+
output = <<~OUTPUT
|
12
13
|
#{BLANK_HDR}
|
13
14
|
<sections/>
|
14
15
|
</iso-standard>
|
15
16
|
OUTPUT
|
17
|
+
expect(xmlpp(Asciidoctor.convert(input, *OPTIONS)))
|
18
|
+
.to be_equivalent_to xmlpp(output)
|
16
19
|
end
|
17
20
|
|
18
21
|
it "converts a blank document" do
|
19
|
-
|
22
|
+
input = <<~INPUT
|
20
23
|
= Document title
|
21
24
|
Author
|
22
25
|
:docfile: test.adoc
|
23
26
|
:novalid:
|
24
27
|
:no-isobib:
|
25
28
|
INPUT
|
29
|
+
output = <<~OUTPUT
|
26
30
|
#{BLANK_HDR}
|
27
31
|
<sections/>
|
28
32
|
</iso-standard>
|
29
33
|
OUTPUT
|
34
|
+
expect(xmlpp(Asciidoctor.convert(input, *OPTIONS)))
|
35
|
+
.to be_equivalent_to xmlpp(output)
|
30
36
|
expect(File.exist?("test_alt.html")).to be true
|
31
37
|
expect(File.exist?("test.html")).to be true
|
32
38
|
expect(File.exist?("test.doc")).to be true
|
@@ -35,7 +41,7 @@ RSpec.describe Asciidoctor::ISO do
|
|
35
41
|
end
|
36
42
|
|
37
43
|
it "converts a blank document in French" do
|
38
|
-
|
44
|
+
input = <<~INPUT
|
39
45
|
= Document title
|
40
46
|
Author
|
41
47
|
:docfile: test.adoc
|
@@ -44,10 +50,13 @@ RSpec.describe Asciidoctor::ISO do
|
|
44
50
|
:no-pdf:
|
45
51
|
:language: fr
|
46
52
|
INPUT
|
53
|
+
output = <<~OUTPUT
|
47
54
|
#{BLANK_HDR_FR}
|
48
55
|
<sections/>
|
49
56
|
</iso-standard>
|
50
57
|
OUTPUT
|
58
|
+
expect(xmlpp(Asciidoctor.convert(input, *OPTIONS)))
|
59
|
+
.to be_equivalent_to xmlpp(output)
|
51
60
|
end
|
52
61
|
|
53
62
|
it "processes default metadata" do
|
@@ -96,87 +105,88 @@ RSpec.describe Asciidoctor::ISO do
|
|
96
105
|
:copyright-year: 2000
|
97
106
|
:horizontal: true
|
98
107
|
INPUT
|
99
|
-
expect(xmlpp(output.sub(%r{<boilerplate>.*</boilerplate>}m, "")))
|
100
|
-
|
101
|
-
|
102
|
-
<
|
103
|
-
<
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
<
|
117
|
-
|
118
|
-
<name>International Organization for Standardization</name>
|
119
|
-
<abbreviation>ISO</abbreviation>
|
120
|
-
</organization>
|
121
|
-
</contributor>
|
122
|
-
<contributor>
|
123
|
-
<role type="publisher"/>
|
124
|
-
<organization>
|
125
|
-
<name>International Organization for Standardization</name>
|
126
|
-
<abbreviation>ISO</abbreviation>
|
127
|
-
</organization>
|
128
|
-
</contributor>
|
129
|
-
<edition>2</edition>
|
130
|
-
<version>
|
131
|
-
<revision-date>2000-01-01</revision-date>
|
132
|
-
<draft>0.3.4</draft>
|
133
|
-
</version>
|
134
|
-
<language>en</language>
|
135
|
-
<script>Latn</script>
|
136
|
-
<status>
|
137
|
-
<stage abbreviation="WD">20</stage>
|
138
|
-
<substage>20</substage>
|
139
|
-
<iteration>3</iteration>
|
140
|
-
</status>
|
141
|
-
<copyright>
|
142
|
-
<from>2000</from>
|
143
|
-
<owner>
|
108
|
+
expect(xmlpp(output.sub(%r{<boilerplate>.*</boilerplate>}m, "")))
|
109
|
+
.to be_equivalent_to xmlpp(<<~"OUTPUT")
|
110
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
111
|
+
<iso-standard type="semantic" version="#{Metanorma::ISO::VERSION}" xmlns="https://www.metanorma.org/ns/iso">
|
112
|
+
<bibdata type="standard">
|
113
|
+
<title format="text/plain" language="en" type="main">Introduction — Main Title — Title — Title Part</title>
|
114
|
+
<title format="text/plain" language="en" type="title-intro">Introduction</title>
|
115
|
+
<title format="text/plain" language="en" type="title-main">Main Title — Title</title>
|
116
|
+
<title format="text/plain" language="en" type="title-part">Title Part</title>
|
117
|
+
<title format="text/plain" language="fr" type="main">Introduction Française — Titre Principal — Part du Titre</title>
|
118
|
+
<title format="text/plain" language="fr" type="title-intro">Introduction Française</title>
|
119
|
+
<title format="text/plain" language="fr" type="title-main">Titre Principal</title>
|
120
|
+
<title format="text/plain" language="fr" type="title-part">Part du Titre</title>
|
121
|
+
<docidentifier type="ISO">ISO/PreWD3 1000-1</docidentifier>
|
122
|
+
<docidentifier type="iso-with-lang">ISO/PreWD3 1000-1(E)</docidentifier>
|
123
|
+
<docidentifier type="iso-reference">ISO/PreWD3 1000-1:2000(E)</docidentifier>
|
124
|
+
<docnumber>1000</docnumber>
|
125
|
+
<contributor>
|
126
|
+
<role type="author"/>
|
144
127
|
<organization>
|
145
128
|
<name>International Organization for Standardization</name>
|
146
129
|
<abbreviation>ISO</abbreviation>
|
147
130
|
</organization>
|
148
|
-
</
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
<
|
159
|
-
<
|
160
|
-
|
161
|
-
</
|
162
|
-
<
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
<
|
167
|
-
</
|
168
|
-
<
|
169
|
-
<
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
131
|
+
</contributor>
|
132
|
+
<contributor>
|
133
|
+
<role type="publisher"/>
|
134
|
+
<organization>
|
135
|
+
<name>International Organization for Standardization</name>
|
136
|
+
<abbreviation>ISO</abbreviation>
|
137
|
+
</organization>
|
138
|
+
</contributor>
|
139
|
+
<edition>2</edition>
|
140
|
+
<version>
|
141
|
+
<revision-date>2000-01-01</revision-date>
|
142
|
+
<draft>0.3.4</draft>
|
143
|
+
</version>
|
144
|
+
<language>en</language>
|
145
|
+
<script>Latn</script>
|
146
|
+
<status>
|
147
|
+
<stage abbreviation="WD">20</stage>
|
148
|
+
<substage>20</substage>
|
149
|
+
<iteration>3</iteration>
|
150
|
+
</status>
|
151
|
+
<copyright>
|
152
|
+
<from>2000</from>
|
153
|
+
<owner>
|
154
|
+
<organization>
|
155
|
+
<name>International Organization for Standardization</name>
|
156
|
+
<abbreviation>ISO</abbreviation>
|
157
|
+
</organization>
|
158
|
+
</owner>
|
159
|
+
</copyright>
|
160
|
+
<ext>
|
161
|
+
<doctype>article</doctype>
|
162
|
+
<horizontal>true</horizontal>
|
163
|
+
<editorialgroup>
|
164
|
+
<technical-committee number="1" type="A">TC</technical-committee>
|
165
|
+
<technical-committee number="11" type="A1">TC1</technical-committee>
|
166
|
+
<subcommittee number="2" type="B">SC</subcommittee>
|
167
|
+
<subcommittee number="21" type="B1">SC1</subcommittee>
|
168
|
+
<workgroup number="3" type="C">WG</workgroup>
|
169
|
+
<workgroup number="31" type="C1">WG1</workgroup>
|
170
|
+
<secretariat>SECRETARIAT</secretariat>
|
171
|
+
</editorialgroup>
|
172
|
+
<ics>
|
173
|
+
<code>1</code>
|
174
|
+
</ics>
|
175
|
+
<ics>
|
176
|
+
<code>2</code>
|
177
|
+
</ics>
|
178
|
+
<ics>
|
179
|
+
<code>3</code>
|
180
|
+
</ics>
|
181
|
+
<structuredidentifier>
|
182
|
+
<project-number part="1">ISO 1000</project-number>
|
183
|
+
</structuredidentifier>
|
184
|
+
<stagename>Third working draft</stagename>
|
185
|
+
</ext>
|
186
|
+
</bibdata>
|
187
|
+
<sections/>
|
188
|
+
</iso-standard>
|
189
|
+
OUTPUT
|
180
190
|
end
|
181
191
|
|
182
192
|
it "processes complex metadata" do
|
@@ -203,131 +213,132 @@ RSpec.describe Asciidoctor::ISO do
|
|
203
213
|
:pub-email: x@example.com
|
204
214
|
:pub-uri: http://www.example.com
|
205
215
|
INPUT
|
206
|
-
expect(xmlpp(output.sub(%r{<boilerplate>.*</boilerplate>}m, "")))
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
</
|
244
|
-
|
245
|
-
<phone
|
246
|
-
<
|
247
|
-
<
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
</
|
257
|
-
|
258
|
-
<phone
|
259
|
-
<
|
260
|
-
<
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
</
|
271
|
-
|
272
|
-
<phone
|
273
|
-
<
|
274
|
-
<
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
</
|
292
|
-
|
293
|
-
<phone
|
294
|
-
<
|
295
|
-
<
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
</
|
308
|
-
|
309
|
-
<phone
|
310
|
-
<
|
311
|
-
<
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
216
|
+
expect(xmlpp(output.sub(%r{<boilerplate>.*</boilerplate>}m, "")))
|
217
|
+
.to be_equivalent_to xmlpp(<<~"OUTPUT")
|
218
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
219
|
+
<iso-standard type="semantic" version="#{Metanorma::ISO::VERSION}" xmlns="https://www.metanorma.org/ns/iso">
|
220
|
+
<bibdata type="standard">
|
221
|
+
<docidentifier type="ISO">ISO/IEC/IETF/TR 1000-1-1:2001</docidentifier>
|
222
|
+
<docidentifier type="iso-with-lang">ISO/IEC/IETF/TR 1000-1-1:2001(X)</docidentifier>
|
223
|
+
<docidentifier type="iso-reference">ISO/IEC/IETF/TR 1000-1-1:2001(X)</docidentifier>
|
224
|
+
<docidentifier type="iso-tc">2000</docidentifier>
|
225
|
+
<docidentifier type="iso-tc">2003</docidentifier>
|
226
|
+
<docnumber>1000</docnumber>
|
227
|
+
<contributor>
|
228
|
+
<role type="author"/>
|
229
|
+
<organization>
|
230
|
+
<name>International Electrotechnical Commission</name>
|
231
|
+
<abbreviation>IEC</abbreviation>
|
232
|
+
</organization>
|
233
|
+
</contributor>
|
234
|
+
<contributor>
|
235
|
+
<role type="author"/>
|
236
|
+
<organization>
|
237
|
+
<name>IETF</name>
|
238
|
+
</organization>
|
239
|
+
</contributor>
|
240
|
+
<contributor>
|
241
|
+
<role type="author"/>
|
242
|
+
<organization>
|
243
|
+
<name>International Organization for Standardization</name>
|
244
|
+
<abbreviation>ISO</abbreviation>
|
245
|
+
</organization>
|
246
|
+
</contributor>
|
247
|
+
<contributor>
|
248
|
+
<role type="publisher"/>
|
249
|
+
<organization>
|
250
|
+
<name>International Electrotechnical Commission</name>
|
251
|
+
<abbreviation>IEC</abbreviation>
|
252
|
+
<address>
|
253
|
+
<formattedAddress>1 Infinity Loop + California</formattedAddress>
|
254
|
+
</address>
|
255
|
+
<phone>3333333</phone>
|
256
|
+
<phone type='fax'>4444444</phone>
|
257
|
+
<email>x@example.com</email>
|
258
|
+
<uri>http://www.example.com</uri>
|
259
|
+
</organization>
|
260
|
+
</contributor>
|
261
|
+
<contributor>
|
262
|
+
<role type="publisher"/>
|
263
|
+
<organization>
|
264
|
+
<name>IETF</name>
|
265
|
+
<address>
|
266
|
+
<formattedAddress>1 Infinity Loop + California</formattedAddress>
|
267
|
+
</address>
|
268
|
+
<phone>3333333</phone>
|
269
|
+
<phone type='fax'>4444444</phone>
|
270
|
+
<email>x@example.com</email>
|
271
|
+
<uri>http://www.example.com</uri>
|
272
|
+
</organization>
|
273
|
+
</contributor>
|
274
|
+
<contributor>
|
275
|
+
<role type="publisher"/>
|
276
|
+
<organization>
|
277
|
+
<name>International Organization for Standardization</name>
|
278
|
+
<abbreviation>ISO</abbreviation>
|
279
|
+
<address>
|
280
|
+
<formattedAddress>1 Infinity Loop + California</formattedAddress>
|
281
|
+
</address>
|
282
|
+
<phone>3333333</phone>
|
283
|
+
<phone type='fax'>4444444</phone>
|
284
|
+
<email>x@example.com</email>
|
285
|
+
<uri>http://www.example.com</uri>
|
286
|
+
</organization>
|
287
|
+
</contributor>
|
288
|
+
<language>el</language>
|
289
|
+
<script>Grek</script>
|
290
|
+
<status>
|
291
|
+
<stage abbreviation="IS">60</stage>
|
292
|
+
<substage>60</substage>
|
293
|
+
</status>
|
294
|
+
<copyright>
|
295
|
+
<from>2001</from>
|
296
|
+
<owner>
|
297
|
+
<organization>
|
298
|
+
<name>International Organization for Standardization</name>
|
299
|
+
<abbreviation>ISO</abbreviation>
|
300
|
+
<address>
|
301
|
+
<formattedAddress>1 Infinity Loop + California</formattedAddress>
|
302
|
+
</address>
|
303
|
+
<phone>3333333</phone>
|
304
|
+
<phone type='fax'>4444444</phone>
|
305
|
+
<email>x@example.com</email>
|
306
|
+
<uri>http://www.example.com</uri>
|
307
|
+
#{' '}
|
308
|
+
</organization>
|
309
|
+
</owner>
|
310
|
+
</copyright>
|
311
|
+
<copyright>
|
312
|
+
<from>2001</from>
|
313
|
+
<owner>
|
314
|
+
<organization>
|
315
|
+
<name>IETF</name>
|
316
|
+
<address>
|
317
|
+
<formattedAddress>1 Infinity Loop + California</formattedAddress>
|
318
|
+
</address>
|
319
|
+
<phone>3333333</phone>
|
320
|
+
<phone type='fax'>4444444</phone>
|
321
|
+
<email>x@example.com</email>
|
322
|
+
<uri>http://www.example.com</uri>
|
323
|
+
</organization>
|
324
|
+
</owner>
|
325
|
+
</copyright>
|
326
|
+
<ext>
|
327
|
+
<doctype>technical-report</doctype>
|
328
|
+
<editorialgroup>
|
329
|
+
<technical-committee/>
|
330
|
+
<subcommittee/>
|
331
|
+
<workgroup/>
|
332
|
+
</editorialgroup>
|
333
|
+
<structuredidentifier>
|
334
|
+
<project-number part="1" subpart="1">ISO/IEC/IETF 1000</project-number>
|
335
|
+
</structuredidentifier>
|
336
|
+
<stagename>International standard</stagename>
|
337
|
+
</ext>
|
338
|
+
</bibdata>
|
339
|
+
<sections/>
|
340
|
+
</iso-standard>
|
341
|
+
OUTPUT
|
331
342
|
end
|
332
343
|
|
333
344
|
it "processes subdivisions" do
|
@@ -354,7 +365,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
354
365
|
:pub-email: x@example.com
|
355
366
|
:pub-uri: http://www.example.com
|
356
367
|
INPUT
|
357
|
-
expect(xmlpp(strip_guid(output
|
368
|
+
expect(xmlpp(strip_guid(output
|
369
|
+
.sub(%r{<boilerplate>.*</boilerplate>}m, ""))))
|
358
370
|
.to be_equivalent_to xmlpp(<<~"OUTPUT")
|
359
371
|
<iso-standard xmlns="https://www.metanorma.org/ns/iso" type="semantic" version="#{Metanorma::ISO::VERSION}">
|
360
372
|
<bibdata type='standard'>
|
@@ -449,12 +461,81 @@ RSpec.describe Asciidoctor::ISO do
|
|
449
461
|
:doctype: international-standard
|
450
462
|
:iteration: 2
|
451
463
|
INPUT
|
452
|
-
expect(xmlpp(output.sub(%r{<boilerplate>.*</boilerplate>}m, "")))
|
453
|
-
|
464
|
+
expect(xmlpp(output.sub(%r{<boilerplate>.*</boilerplate>}m, "")))
|
465
|
+
.to be_equivalent_to xmlpp(<<~"OUTPUT")
|
466
|
+
<iso-standard type="semantic" version="#{Metanorma::ISO::VERSION}" xmlns="https://www.metanorma.org/ns/iso">
|
467
|
+
<bibdata type="standard">
|
468
|
+
<docidentifier type='ISO'>ISO/FDIS 1000.2</docidentifier>
|
469
|
+
<docidentifier type='iso-with-lang'>ISO/FDIS 1000.2(F)</docidentifier>
|
470
|
+
<docidentifier type='iso-reference'>ISO/FDIS 1000.2(F)</docidentifier>
|
471
|
+
<docnumber>1000</docnumber>
|
472
|
+
<contributor>
|
473
|
+
<role type="author"/>
|
474
|
+
<organization>
|
475
|
+
<name>International Organization for Standardization</name>
|
476
|
+
<abbreviation>ISO</abbreviation>
|
477
|
+
</organization>
|
478
|
+
</contributor>
|
479
|
+
<contributor>
|
480
|
+
<role type="publisher"/>
|
481
|
+
<organization>
|
482
|
+
<name>International Organization for Standardization</name>
|
483
|
+
<abbreviation>ISO</abbreviation>
|
484
|
+
</organization>
|
485
|
+
</contributor>
|
486
|
+
<language>fr</language>
|
487
|
+
<script>Latn</script>
|
488
|
+
<status>
|
489
|
+
<stage abbreviation="FDIS">50</stage>
|
490
|
+
<substage>00</substage>
|
491
|
+
<iteration>2</iteration>
|
492
|
+
</status>
|
493
|
+
<copyright>
|
494
|
+
<from>#{Date.today.year}</from>
|
495
|
+
<owner>
|
496
|
+
<organization>
|
497
|
+
<name>International Organization for Standardization</name>
|
498
|
+
<abbreviation>ISO</abbreviation>
|
499
|
+
</organization>
|
500
|
+
</owner>
|
501
|
+
</copyright>
|
502
|
+
<ext>
|
503
|
+
<doctype>international-standard</doctype>
|
504
|
+
<editorialgroup>
|
505
|
+
<technical-committee/>
|
506
|
+
<subcommittee/>
|
507
|
+
<workgroup/>
|
508
|
+
</editorialgroup>
|
509
|
+
<structuredidentifier>
|
510
|
+
<project-number>ISO 1000</project-number>
|
511
|
+
</structuredidentifier>
|
512
|
+
<stagename>Final draft</stagename>
|
513
|
+
</ext>
|
514
|
+
</bibdata>
|
515
|
+
<sections/>
|
516
|
+
</iso-standard>
|
517
|
+
OUTPUT
|
518
|
+
end
|
519
|
+
|
520
|
+
it "defaults substage for stage 60" do
|
521
|
+
output = Asciidoctor.convert(<<~"INPUT", *OPTIONS)
|
522
|
+
= Document title
|
523
|
+
Author
|
524
|
+
:docfile: test.adoc
|
525
|
+
:nodoc:
|
526
|
+
:novalid:
|
527
|
+
:no-isobib:
|
528
|
+
:docnumber: 1000
|
529
|
+
:docstage: 60
|
530
|
+
INPUT
|
531
|
+
|
532
|
+
expect(xmlpp(output.sub(%r{<boilerplate>.*</boilerplate>}m, "")))
|
533
|
+
.to be_equivalent_to xmlpp(<<~"OUTPUT")
|
534
|
+
<iso-standard xmlns="https://www.metanorma.org/ns/iso" type="semantic" version="#{Metanorma::ISO::VERSION}">
|
454
535
|
<bibdata type="standard">
|
455
|
-
|
456
|
-
<docidentifier type='iso-with-lang'>ISO
|
457
|
-
<docidentifier type='iso-reference'>ISO
|
536
|
+
<docidentifier type="ISO">ISO 1000</docidentifier>
|
537
|
+
<docidentifier type='iso-with-lang'>ISO 1000(E)</docidentifier>
|
538
|
+
<docidentifier type='iso-reference'>ISO 1000(E)</docidentifier>
|
458
539
|
<docnumber>1000</docnumber>
|
459
540
|
<contributor>
|
460
541
|
<role type="author"/>
|
@@ -470,12 +551,12 @@ RSpec.describe Asciidoctor::ISO do
|
|
470
551
|
<abbreviation>ISO</abbreviation>
|
471
552
|
</organization>
|
472
553
|
</contributor>
|
473
|
-
|
554
|
+
|
555
|
+
<language>en</language>
|
474
556
|
<script>Latn</script>
|
475
557
|
<status>
|
476
|
-
<stage abbreviation="
|
477
|
-
<substage>
|
478
|
-
<iteration>2</iteration>
|
558
|
+
<stage abbreviation="IS">60</stage>
|
559
|
+
<substage>60</substage>
|
479
560
|
</status>
|
480
561
|
<copyright>
|
481
562
|
<from>#{Date.today.year}</from>
|
@@ -487,7 +568,7 @@ RSpec.describe Asciidoctor::ISO do
|
|
487
568
|
</owner>
|
488
569
|
</copyright>
|
489
570
|
<ext>
|
490
|
-
<doctype>
|
571
|
+
<doctype>article</doctype>
|
491
572
|
<editorialgroup>
|
492
573
|
<technical-committee/>
|
493
574
|
<subcommittee/>
|
@@ -496,15 +577,15 @@ RSpec.describe Asciidoctor::ISO do
|
|
496
577
|
<structuredidentifier>
|
497
578
|
<project-number>ISO 1000</project-number>
|
498
579
|
</structuredidentifier>
|
499
|
-
<stagename>
|
580
|
+
<stagename>International standard</stagename>
|
500
581
|
</ext>
|
501
582
|
</bibdata>
|
502
583
|
<sections/>
|
503
|
-
|
504
|
-
|
584
|
+
</iso-standard>
|
585
|
+
OUTPUT
|
505
586
|
end
|
506
587
|
|
507
|
-
it "
|
588
|
+
it "populates metadata for PRF" do
|
508
589
|
output = Asciidoctor.convert(<<~"INPUT", *OPTIONS)
|
509
590
|
= Document title
|
510
591
|
Author
|
@@ -514,64 +595,65 @@ RSpec.describe Asciidoctor::ISO do
|
|
514
595
|
:no-isobib:
|
515
596
|
:docnumber: 1000
|
516
597
|
:docstage: 60
|
598
|
+
:docsubstage: 00
|
517
599
|
INPUT
|
600
|
+
expect(xmlpp(output.sub(%r{<boilerplate>.*</boilerplate>}m, "")))
|
601
|
+
.to be_equivalent_to xmlpp(<<~"OUTPUT")
|
602
|
+
<iso-standard xmlns="https://www.metanorma.org/ns/iso" type="semantic" version="#{Metanorma::ISO::VERSION}">
|
603
|
+
<bibdata type="standard">
|
604
|
+
<docidentifier type="ISO">ISO 1000</docidentifier>
|
605
|
+
<docidentifier type='iso-with-lang'>ISO 1000(E)</docidentifier>
|
606
|
+
<docidentifier type='iso-reference'>ISO 1000(E)</docidentifier>
|
607
|
+
<docnumber>1000</docnumber>
|
608
|
+
<contributor>
|
609
|
+
<role type="author"/>
|
610
|
+
<organization>
|
611
|
+
<name>International Organization for Standardization</name>
|
612
|
+
<abbreviation>ISO</abbreviation>
|
613
|
+
</organization>
|
614
|
+
</contributor>
|
615
|
+
<contributor>
|
616
|
+
<role type="publisher"/>
|
617
|
+
<organization>
|
618
|
+
<name>International Organization for Standardization</name>
|
619
|
+
<abbreviation>ISO</abbreviation>
|
620
|
+
</organization>
|
621
|
+
</contributor>
|
518
622
|
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
<organization>
|
551
|
-
<name>International Organization for Standardization</name>
|
552
|
-
<abbreviation>ISO</abbreviation>
|
553
|
-
</organization>
|
554
|
-
</owner>
|
555
|
-
</copyright>
|
556
|
-
<ext>
|
557
|
-
<doctype>article</doctype>
|
558
|
-
<editorialgroup>
|
559
|
-
<technical-committee/>
|
560
|
-
<subcommittee/>
|
561
|
-
<workgroup/>
|
562
|
-
</editorialgroup>
|
563
|
-
<structuredidentifier>
|
564
|
-
<project-number>ISO 1000</project-number>
|
565
|
-
</structuredidentifier>
|
566
|
-
<stagename>International standard</stagename>
|
567
|
-
</ext>
|
568
|
-
</bibdata>
|
569
|
-
<sections/>
|
570
|
-
</iso-standard>
|
571
|
-
OUTPUT
|
623
|
+
<language>en</language>
|
624
|
+
<script>Latn</script>
|
625
|
+
<status>
|
626
|
+
<stage abbreviation="PRF">60</stage>
|
627
|
+
<substage>00</substage>
|
628
|
+
</status>
|
629
|
+
<copyright>
|
630
|
+
<from>#{Date.today.year}</from>
|
631
|
+
<owner>
|
632
|
+
<organization>
|
633
|
+
<name>International Organization for Standardization</name>
|
634
|
+
<abbreviation>ISO</abbreviation>
|
635
|
+
</organization>
|
636
|
+
</owner>
|
637
|
+
</copyright>
|
638
|
+
<ext>
|
639
|
+
<doctype>article</doctype>
|
640
|
+
<editorialgroup>
|
641
|
+
<technical-committee/>
|
642
|
+
<subcommittee/>
|
643
|
+
<workgroup/>
|
644
|
+
</editorialgroup>
|
645
|
+
<structuredidentifier>
|
646
|
+
<project-number>ISO 1000</project-number>
|
647
|
+
</structuredidentifier>
|
648
|
+
<stagename>Proof</stagename>
|
649
|
+
</ext>
|
650
|
+
</bibdata>
|
651
|
+
<sections/>
|
652
|
+
</iso-standard>
|
653
|
+
OUTPUT
|
572
654
|
end
|
573
655
|
|
574
|
-
it "
|
656
|
+
it "defaults metadata for DIR" do
|
575
657
|
output = Asciidoctor.convert(<<~"INPUT", *OPTIONS)
|
576
658
|
= Document title
|
577
659
|
Author
|
@@ -580,62 +662,62 @@ RSpec.describe Asciidoctor::ISO do
|
|
580
662
|
:novalid:
|
581
663
|
:no-isobib:
|
582
664
|
:docnumber: 1000
|
583
|
-
:
|
584
|
-
:docsubstage: 00
|
665
|
+
:doctype: directive
|
585
666
|
INPUT
|
586
|
-
expect(xmlpp(output.sub(%r{<boilerplate>.*</boilerplate>}m, ""))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
587
|
-
<iso-standard xmlns="https://www.metanorma.org/ns/iso" type="semantic" version="#{Metanorma::ISO::VERSION}">
|
588
|
-
<bibdata type="standard">
|
589
|
-
<docidentifier type="ISO">ISO 1000</docidentifier>
|
590
|
-
<docidentifier type='iso-with-lang'>ISO 1000(E)</docidentifier>
|
591
|
-
<docidentifier type='iso-reference'>ISO 1000(E)</docidentifier>
|
592
|
-
<docnumber>1000</docnumber>
|
593
|
-
<contributor>
|
594
|
-
<role type="author"/>
|
595
|
-
<organization>
|
596
|
-
<name>International Organization for Standardization</name>
|
597
|
-
<abbreviation>ISO</abbreviation>
|
598
|
-
</organization>
|
599
|
-
</contributor>
|
600
|
-
<contributor>
|
601
|
-
<role type="publisher"/>
|
602
|
-
<organization>
|
603
|
-
<name>International Organization for Standardization</name>
|
604
|
-
<abbreviation>ISO</abbreviation>
|
605
|
-
</organization>
|
606
|
-
</contributor>
|
607
667
|
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
<
|
613
|
-
|
614
|
-
|
615
|
-
<
|
616
|
-
<
|
668
|
+
expect(xmlpp(output.sub(%r{<boilerplate>.*</boilerplate>}m, "")))
|
669
|
+
.to be_equivalent_to xmlpp(<<~"OUTPUT")
|
670
|
+
<iso-standard xmlns="https://www.metanorma.org/ns/iso" type="semantic" version="#{Metanorma::ISO::VERSION}">
|
671
|
+
<bibdata type='standard'>
|
672
|
+
<docidentifier type='ISO'>ISO DIR 1000</docidentifier>
|
673
|
+
<docidentifier type='iso-with-lang'>ISO DIR 1000(E)</docidentifier>
|
674
|
+
<docidentifier type='iso-reference'>ISO DIR 1000(E)</docidentifier>
|
675
|
+
<docnumber>1000</docnumber>
|
676
|
+
<contributor>
|
677
|
+
<role type='author'/>
|
617
678
|
<organization>
|
618
679
|
<name>International Organization for Standardization</name>
|
619
680
|
<abbreviation>ISO</abbreviation>
|
620
681
|
</organization>
|
621
|
-
</
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
</
|
630
|
-
<
|
631
|
-
|
632
|
-
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
|
637
|
-
|
638
|
-
|
682
|
+
</contributor>
|
683
|
+
<contributor>
|
684
|
+
<role type='publisher'/>
|
685
|
+
<organization>
|
686
|
+
<name>International Organization for Standardization</name>
|
687
|
+
<abbreviation>ISO</abbreviation>
|
688
|
+
</organization>
|
689
|
+
</contributor>
|
690
|
+
<language>en</language>
|
691
|
+
<script>Latn</script>
|
692
|
+
<status>
|
693
|
+
<stage abbreviation='IS'>60</stage>
|
694
|
+
<substage>60</substage>
|
695
|
+
</status>
|
696
|
+
<copyright>
|
697
|
+
<from>2021</from>
|
698
|
+
<owner>
|
699
|
+
<organization>
|
700
|
+
<name>International Organization for Standardization</name>
|
701
|
+
<abbreviation>ISO</abbreviation>
|
702
|
+
</organization>
|
703
|
+
</owner>
|
704
|
+
</copyright>
|
705
|
+
<ext>
|
706
|
+
<doctype>directive</doctype>
|
707
|
+
<editorialgroup>
|
708
|
+
<technical-committee/>
|
709
|
+
<subcommittee/>
|
710
|
+
<workgroup/>
|
711
|
+
</editorialgroup>
|
712
|
+
<structuredidentifier>
|
713
|
+
<project-number>ISO 1000</project-number>
|
714
|
+
</structuredidentifier>
|
715
|
+
<stagename>International standard</stagename>
|
716
|
+
</ext>
|
717
|
+
</bibdata>
|
718
|
+
<sections> </sections>
|
719
|
+
</iso-standard>
|
720
|
+
OUTPUT
|
639
721
|
end
|
640
722
|
|
641
723
|
it "reads scripts into blank HTML document" do
|
@@ -661,9 +743,12 @@ RSpec.describe Asciidoctor::ISO do
|
|
661
743
|
:no-pdf:
|
662
744
|
INPUT
|
663
745
|
html = File.read("test.html", encoding: "utf-8")
|
664
|
-
expect(html)
|
665
|
-
|
666
|
-
expect(html)
|
746
|
+
expect(html)
|
747
|
+
.to match(%r[\bpre[^{]+\{[^{]+font-family: "Courier New", monospace;]m)
|
748
|
+
expect(html)
|
749
|
+
.to match(%r[blockquote[^{]+\{[^{]+font-family: "Cambria", serif;]m)
|
750
|
+
expect(html)
|
751
|
+
.to match(%r[\.h2Annex[^{]+\{[^{]+font-family: "Cambria", serif;]m)
|
667
752
|
end
|
668
753
|
|
669
754
|
it "uses default fonts for alt doc" do
|
@@ -676,9 +761,12 @@ RSpec.describe Asciidoctor::ISO do
|
|
676
761
|
:no-pdf:
|
677
762
|
INPUT
|
678
763
|
html = File.read("test_alt.html", encoding: "utf-8")
|
679
|
-
expect(html)
|
680
|
-
|
681
|
-
expect(html)
|
764
|
+
expect(html)
|
765
|
+
.to match(%r[\bpre[^{]+\{[^{]+font-family: "Space Mono", monospace;]m)
|
766
|
+
expect(html)
|
767
|
+
.to match(%r[blockquote[^{]+\{[^{]+font-family: "Lato", sans-serif;]m)
|
768
|
+
expect(html)
|
769
|
+
.to match(%r[\.h2Annex[^{]+\{[^{]+font-family: "Lato", sans-serif;]m)
|
682
770
|
end
|
683
771
|
|
684
772
|
it "uses Chinese fonts" do
|
@@ -692,9 +780,12 @@ RSpec.describe Asciidoctor::ISO do
|
|
692
780
|
:no-pdf:
|
693
781
|
INPUT
|
694
782
|
html = File.read("test.html", encoding: "utf-8")
|
695
|
-
expect(html)
|
696
|
-
|
697
|
-
expect(html)
|
783
|
+
expect(html)
|
784
|
+
.to match(%r[\bpre[^{]+\{[^{]+font-family: "Courier New", monospace;]m)
|
785
|
+
expect(html)
|
786
|
+
.to match(%r[blockquote[^{]+\{[^{]+font-family: "Source Han Sans", serif;]m)
|
787
|
+
expect(html)
|
788
|
+
.to match(%r[\.h2Annex[^{]+\{[^{]+font-family: "Source Han Sans", sans-serif;]m)
|
698
789
|
end
|
699
790
|
|
700
791
|
it "uses specified fonts" do
|
@@ -712,7 +803,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
712
803
|
INPUT
|
713
804
|
html = File.read("test.html", encoding: "utf-8")
|
714
805
|
expect(html).to match(%r[\bpre[^{]+\{[^{]+font-family: Andale Mono;]m)
|
715
|
-
expect(html)
|
806
|
+
expect(html)
|
807
|
+
.to match(%r[blockquote[^{]+\{[^{]+font-family: Zapf Chancery;]m)
|
716
808
|
expect(html).to match(%r[\.h2Annex[^{]+\{[^{]+font-family: Comic Sans;]m)
|
717
809
|
end
|
718
810
|
|