metanorma-iso 2.0.5 → 2.0.7
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/lib/isodoc/iso/base_convert.rb +3 -3
- data/lib/isodoc/iso/html/header-dis.html +391 -0
- data/lib/isodoc/iso/html/header.html +42 -33
- data/lib/isodoc/iso/html/isodoc-dis.css +4524 -0
- data/lib/isodoc/iso/html/isodoc-dis.scss +4289 -0
- data/lib/isodoc/iso/html/isodoc.css +9 -7
- data/lib/isodoc/iso/html/isodoc.scss +7 -5
- data/lib/isodoc/iso/html/style-human.css +0 -1
- data/lib/isodoc/iso/html/style-human.scss +0 -1
- data/lib/isodoc/iso/html/style-iso.css +0 -1
- data/lib/isodoc/iso/html/style-iso.scss +0 -1
- data/lib/isodoc/iso/html/word_iso_intro-dis.html +7 -0
- data/lib/isodoc/iso/html/word_iso_titlepage-dis.html +51 -0
- data/lib/isodoc/iso/html/word_iso_titlepage.html +12 -11
- data/lib/isodoc/iso/html/wordstyle-dis.css +2160 -0
- data/lib/isodoc/iso/html/wordstyle-dis.scss +2011 -0
- data/lib/isodoc/iso/html/wordstyle.css +26 -19
- data/lib/isodoc/iso/html/wordstyle.scss +32 -25
- data/lib/isodoc/iso/i18n-en.yaml +2 -2
- data/lib/isodoc/iso/i18n-fr.yaml +2 -2
- data/lib/isodoc/iso/i18n-ru.yaml +2 -2
- data/lib/isodoc/iso/i18n-zh-Hans.yaml +2 -2
- data/lib/isodoc/iso/index.rb +7 -4
- data/lib/isodoc/iso/iso.amendment.xsl +111 -28
- data/lib/isodoc/iso/iso.international-standard.xsl +111 -28
- data/lib/isodoc/iso/metadata.rb +5 -12
- data/lib/isodoc/iso/sts_convert.rb +8 -3
- data/lib/isodoc/iso/word_convert.rb +12 -0
- data/lib/metanorma/iso/boilerplate-fr.xml +5 -6
- data/lib/metanorma/iso/boilerplate-ru.xml +4 -6
- data/lib/metanorma/iso/boilerplate.xml +5 -6
- data/lib/metanorma/iso/cleanup.rb +8 -2
- data/lib/metanorma/iso/front_id.rb +1 -0
- data/lib/metanorma/iso/validate_list.rb +20 -5
- data/lib/metanorma/iso/version.rb +1 -1
- data/metanorma-iso.gemspec +1 -1
- data/spec/isodoc/ref_spec.rb +11 -7
- data/spec/metanorma/amd_spec.rb +6 -7
- data/spec/metanorma/base_spec.rb +0 -1
- data/spec/metanorma/cleanup_spec.rb +10 -10
- data/spec/metanorma/refs_spec.rb +85 -144
- data/spec/metanorma/section_spec.rb +15 -18
- data/spec/metanorma/validate_spec.rb +46 -25
- data/spec/spec_helper.rb +2 -2
- data/spec/vcr_cassettes/docrels.yml +37 -45
- data/spec/vcr_cassettes/withdrawn_iso.yml +31 -37
- metadata +12 -5
@@ -1396,8 +1396,9 @@
|
|
1396
1396
|
</fo:block>
|
1397
1397
|
</xsl:when>
|
1398
1398
|
<xsl:otherwise>
|
1399
|
+
<xsl:value-of select="$linebreak"/>
|
1399
1400
|
<xsl:value-of select="$part-text"/>
|
1400
|
-
<xsl:text>
|
1401
|
+
<xsl:text> </xsl:text>
|
1401
1402
|
</xsl:otherwise>
|
1402
1403
|
</xsl:choose>
|
1403
1404
|
</xsl:if>
|
@@ -1729,7 +1730,8 @@
|
|
1729
1730
|
</xsl:when>
|
1730
1731
|
<xsl:otherwise>
|
1731
1732
|
<!-- <xsl:value-of select="translate(., $thin_space, ' ')"/> -->
|
1732
|
-
<xsl:value-of select="."/>
|
1733
|
+
<!-- <xsl:value-of select="."/> -->
|
1734
|
+
<xsl:call-template name="text"/>
|
1733
1735
|
</xsl:otherwise>
|
1734
1736
|
</xsl:choose>
|
1735
1737
|
|
@@ -1939,7 +1941,7 @@
|
|
1939
1941
|
</xsl:template>
|
1940
1942
|
|
1941
1943
|
|
1942
|
-
<xsl:param name="svg_images"/><xsl:variable name="images" select="document($svg_images)"/><xsl:param name="basepath"/><xsl:param name="external_index"/><xsl:param name="syntax-highlight">false</xsl:param><xsl:
|
1944
|
+
<xsl:param name="svg_images"/><xsl:variable name="images" select="document($svg_images)"/><xsl:param name="basepath"/><xsl:param name="external_index"/><xsl:param name="syntax-highlight">false</xsl:param><xsl:variable name="lang">
|
1943
1945
|
<xsl:call-template name="getLang"/>
|
1944
1946
|
</xsl:variable><xsl:variable name="pageWidth_">
|
1945
1947
|
210
|
@@ -3347,8 +3349,27 @@
|
|
3347
3349
|
<xsl:sort select="@displayorder" data-type="number"/>
|
3348
3350
|
<xsl:apply-templates select="."/>
|
3349
3351
|
</xsl:for-each>
|
3350
|
-
</xsl:template><xsl:template match="text()">
|
3351
|
-
<xsl:
|
3352
|
+
</xsl:template><xsl:variable name="tag_open">###fo:inline###</xsl:variable><xsl:variable name="tag_close">###/fo:inline###</xsl:variable><xsl:template match="text()" name="text">
|
3353
|
+
<xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
|
3354
|
+
<xsl:variable name="text" select="java:replaceAll(java:java.lang.String.new(.),$regex_standard_reference,concat($tag_open,'$1',$tag_close))"/>
|
3355
|
+
<xsl:call-template name="replace_fo_inline">
|
3356
|
+
<xsl:with-param name="text" select="$text"/>
|
3357
|
+
</xsl:call-template>
|
3358
|
+
</xsl:template><xsl:template name="replace_fo_inline">
|
3359
|
+
<xsl:param name="text"/>
|
3360
|
+
<xsl:choose>
|
3361
|
+
<xsl:when test="contains($text, $tag_open)">
|
3362
|
+
<xsl:value-of select="substring-before($text, $tag_open)"/>
|
3363
|
+
<xsl:text disable-output-escaping="yes"><fo:inline keep-together.within-line="always"></xsl:text>
|
3364
|
+
<xsl:variable name="text_after" select="substring-after($text, $tag_open)"/>
|
3365
|
+
<xsl:value-of select="substring-before($text_after, $tag_close)"/>
|
3366
|
+
<xsl:text disable-output-escaping="yes"></fo:inline></xsl:text>
|
3367
|
+
<xsl:call-template name="replace_fo_inline">
|
3368
|
+
<xsl:with-param name="text" select="substring-after($text_after, $tag_close)"/>
|
3369
|
+
</xsl:call-template>
|
3370
|
+
</xsl:when>
|
3371
|
+
<xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
|
3372
|
+
</xsl:choose>
|
3352
3373
|
</xsl:template><xsl:template match="*[local-name()='br']">
|
3353
3374
|
<xsl:value-of select="$linebreak"/>
|
3354
3375
|
</xsl:template><xsl:template match="*[local-name()='copyright-statement']">
|
@@ -6577,7 +6598,51 @@
|
|
6577
6598
|
<xsl:with-param name="text" select="$text_step1"/>
|
6578
6599
|
</xsl:call-template>
|
6579
6600
|
</xsl:variable>
|
6580
|
-
|
6601
|
+
|
6602
|
+
<!-- <xsl:value-of select="$text_step2"/> -->
|
6603
|
+
|
6604
|
+
<!-- add zero-width space after space -->
|
6605
|
+
<xsl:variable name="text_step3" select="java:replaceAll(java:java.lang.String.new($text_step2),' ',' ')"/>
|
6606
|
+
|
6607
|
+
<!-- split text by zero-width space -->
|
6608
|
+
<xsl:variable name="text_step4">
|
6609
|
+
<xsl:call-template name="split">
|
6610
|
+
<xsl:with-param name="pText" select="$text_step3"/>
|
6611
|
+
<xsl:with-param name="sep" select="$zero_width_space"/>
|
6612
|
+
<xsl:with-param name="normalize-space">false</xsl:with-param>
|
6613
|
+
<xsl:with-param name="keep_sep">true</xsl:with-param>
|
6614
|
+
</xsl:call-template>
|
6615
|
+
</xsl:variable>
|
6616
|
+
|
6617
|
+
<xsl:for-each select="xalan:nodeset($text_step4)/item">
|
6618
|
+
<xsl:choose>
|
6619
|
+
<xsl:when test="string-length() > 30"> <!-- word with length more than 30 will be interspersed with zero-width space -->
|
6620
|
+
<xsl:call-template name="interspers">
|
6621
|
+
<xsl:with-param name="str" select="."/>
|
6622
|
+
</xsl:call-template>
|
6623
|
+
</xsl:when>
|
6624
|
+
<xsl:otherwise>
|
6625
|
+
<xsl:value-of select="."/>
|
6626
|
+
</xsl:otherwise>
|
6627
|
+
</xsl:choose>
|
6628
|
+
</xsl:for-each>
|
6629
|
+
|
6630
|
+
</xsl:template><xsl:template name="interspers">
|
6631
|
+
<xsl:param name="str"/>
|
6632
|
+
<xsl:param name="char" select="$zero_width_space"/>
|
6633
|
+
<xsl:if test="$str != ''">
|
6634
|
+
<xsl:value-of select="substring($str, 1, 1)"/>
|
6635
|
+
|
6636
|
+
<xsl:variable name="next_char" select="substring($str, 2, 1)"/>
|
6637
|
+
<xsl:if test="not(contains(concat(' -.:=_— ', $char), $next_char))">
|
6638
|
+
<xsl:value-of select="$char"/>
|
6639
|
+
</xsl:if>
|
6640
|
+
|
6641
|
+
<xsl:call-template name="interspers">
|
6642
|
+
<xsl:with-param name="str" select="substring($str, 2)"/>
|
6643
|
+
<xsl:with-param name="char" select="$char"/>
|
6644
|
+
</xsl:call-template>
|
6645
|
+
</xsl:if>
|
6581
6646
|
</xsl:template><xsl:template match="*" mode="syntax_highlight">
|
6582
6647
|
<xsl:apply-templates mode="syntax_highlight"/>
|
6583
6648
|
</xsl:template><xsl:variable name="syntax_highlight_styles_">
|
@@ -6958,7 +7023,7 @@
|
|
6958
7023
|
<xsl:variable name="element">
|
6959
7024
|
|
6960
7025
|
<xsl:choose>
|
6961
|
-
<xsl:when test="$num = 1">inline</xsl:when>
|
7026
|
+
<xsl:when test="$num = 1 and not(contains($fo_element, 'block'))">inline</xsl:when>
|
6962
7027
|
<xsl:otherwise>block</xsl:otherwise>
|
6963
7028
|
</xsl:choose>
|
6964
7029
|
|
@@ -7050,7 +7115,8 @@
|
|
7050
7115
|
<fo:inline><xsl:apply-templates/></fo:inline>
|
7051
7116
|
</xsl:template><xsl:template match="*[local-name() = 'modification']/text()">
|
7052
7117
|
<xsl:if test="normalize-space() != ''">
|
7053
|
-
<xsl:value-of select="."/>
|
7118
|
+
<!-- <xsl:value-of select="."/> -->
|
7119
|
+
<xsl:call-template name="text"/>
|
7054
7120
|
</xsl:if>
|
7055
7121
|
</xsl:template><xsl:template match="*[local-name() = 'quote']">
|
7056
7122
|
<fo:block-container margin-left="0mm">
|
@@ -7090,11 +7156,24 @@
|
|
7090
7156
|
</xsl:template><xsl:template match="*[local-name() = 'author']">
|
7091
7157
|
<xsl:text>— </xsl:text>
|
7092
7158
|
<xsl:apply-templates/>
|
7093
|
-
</xsl:template><xsl:
|
7159
|
+
</xsl:template><xsl:variable name="bibitems_">
|
7160
|
+
<xsl:for-each select="//*[local-name() = 'bibitem']">
|
7161
|
+
<xsl:copy-of select="."/>
|
7162
|
+
</xsl:for-each>
|
7163
|
+
</xsl:variable><xsl:variable name="bibitems" select="xalan:nodeset($bibitems_)"/><xsl:variable name="bibitems_hidden_">
|
7164
|
+
<xsl:for-each select="//*[local-name() = 'bibitem'][@hidden='true']">
|
7165
|
+
<xsl:copy-of select="."/>
|
7166
|
+
</xsl:for-each>
|
7167
|
+
<xsl:for-each select="//*[local-name() = 'references'][@hidden='true']//*[local-name() = 'bibitem']">
|
7168
|
+
<xsl:copy-of select="."/>
|
7169
|
+
</xsl:for-each>
|
7170
|
+
</xsl:variable><xsl:variable name="bibitems_hidden" select="xalan:nodeset($bibitems_hidden_)"/><xsl:template match="*[local-name() = 'eref']">
|
7094
7171
|
<xsl:variable name="current_bibitemid" select="@bibitemid"/>
|
7095
|
-
<xsl:variable name="external-destination" select="normalize-space(key('bibitems', $current_bibitemid)/*[local-name() = 'uri'][@type = 'citation'])"/>
|
7172
|
+
<!-- <xsl:variable name="external-destination" select="normalize-space(key('bibitems', $current_bibitemid)/*[local-name() = 'uri'][@type = 'citation'])"/> -->
|
7173
|
+
<xsl:variable name="external-destination" select="normalize-space($bibitems/*[local-name() ='bibitem'][@id = $current_bibitemid]/*[local-name() = 'uri'][@type = 'citation'])"/>
|
7096
7174
|
<xsl:choose>
|
7097
|
-
<xsl:when test="$external-destination != '' or not(key('bibitems_hidden', $current_bibitemid))"> <!-- if in the bibliography there is the item with @bibitemid (and not hidden), then create link (internal to the bibitem or external) -->
|
7175
|
+
<!-- <xsl:when test="$external-destination != '' or not(key('bibitems_hidden', $current_bibitemid))"> --> <!-- if in the bibliography there is the item with @bibitemid (and not hidden), then create link (internal to the bibitem or external) -->
|
7176
|
+
<xsl:when test="$external-destination != '' or not($bibitems_hidden/*[local-name() ='bibitem'][@id = $current_bibitemid])"> <!-- if in the bibliography there is the item with @bibitemid (and not hidden), then create link (internal to the bibitem or external) -->
|
7098
7177
|
<fo:inline xsl:use-attribute-sets="eref-style">
|
7099
7178
|
<xsl:if test="@type = 'footnote'">
|
7100
7179
|
<xsl:attribute name="keep-together.within-line">always</xsl:attribute>
|
@@ -8201,7 +8280,7 @@
|
|
8201
8280
|
<xsl:copy>
|
8202
8281
|
<xsl:copy-of select="@*"/>
|
8203
8282
|
<!-- copy all elements from bibliography except 'Normative references' (moved to 'sections') -->
|
8204
|
-
<xsl:for-each select="*[not(@normative='true') and not(*[
|
8283
|
+
<xsl:for-each select="*[not(@normative='true') and not(*[@normative='true'])]">
|
8205
8284
|
<xsl:sort select="@displayorder" data-type="number"/>
|
8206
8285
|
<xsl:apply-templates select="." mode="update_xml_step1"/>
|
8207
8286
|
</xsl:for-each>
|
@@ -8240,7 +8319,8 @@
|
|
8240
8319
|
<xsl:variable name="position"><xsl:number count="*[local-name() = $local_name][@bibitemid = $bibitemid]" level="any"/></xsl:variable>
|
8241
8320
|
<xsl:if test="normalize-space($position) = '1'">
|
8242
8321
|
<xsl:variable name="fn_text">
|
8243
|
-
<xsl:copy-of select="key('bibitems', $bibitemid)[1]/*[local-name() = 'note'][not(@type='Unpublished-Status')][normalize-space() = $localized_string_withdrawn or starts-with(normalize-space(), $localized_string_cancelled_and_replaced)]/node()"/>
|
8322
|
+
<!-- <xsl:copy-of select="key('bibitems', $bibitemid)[1]/*[local-name() = 'note'][not(@type='Unpublished-Status')][normalize-space() = $localized_string_withdrawn or starts-with(normalize-space(), $localized_string_cancelled_and_replaced)]/node()" /> -->
|
8323
|
+
<xsl:copy-of select="$bibitems/*[local-name() ='bibitem'][@id = $bibitemid][1]/*[local-name() = 'note'][not(@type='Unpublished-Status')][normalize-space() = $localized_string_withdrawn or starts-with(normalize-space(), $localized_string_cancelled_and_replaced)]/node()"/>
|
8244
8324
|
</xsl:variable>
|
8245
8325
|
<xsl:if test="normalize-space($fn_text) != ''">
|
8246
8326
|
<xsl:element name="fn" namespace="{$namespace_full}">
|
@@ -8511,22 +8591,25 @@
|
|
8511
8591
|
<xsl:param name="pText" select="."/>
|
8512
8592
|
<xsl:param name="sep" select="','"/>
|
8513
8593
|
<xsl:param name="normalize-space" select="'true'"/>
|
8594
|
+
<xsl:param name="keep_sep" select="'false'"/>
|
8514
8595
|
<xsl:if test="string-length($pText) >0">
|
8515
|
-
|
8516
|
-
|
8517
|
-
|
8518
|
-
|
8519
|
-
|
8520
|
-
|
8521
|
-
|
8522
|
-
|
8523
|
-
|
8524
|
-
|
8525
|
-
|
8526
|
-
<xsl:
|
8527
|
-
|
8528
|
-
|
8529
|
-
|
8596
|
+
<item>
|
8597
|
+
<xsl:choose>
|
8598
|
+
<xsl:when test="$normalize-space = 'true'">
|
8599
|
+
<xsl:value-of select="normalize-space(substring-before(concat($pText, $sep), $sep))"/>
|
8600
|
+
</xsl:when>
|
8601
|
+
<xsl:otherwise>
|
8602
|
+
<xsl:value-of select="substring-before(concat($pText, $sep), $sep)"/>
|
8603
|
+
</xsl:otherwise>
|
8604
|
+
</xsl:choose>
|
8605
|
+
</item>
|
8606
|
+
<xsl:if test="$keep_sep = 'true' and contains($pText, $sep)"><item><xsl:value-of select="$sep"/></item></xsl:if>
|
8607
|
+
<xsl:call-template name="split">
|
8608
|
+
<xsl:with-param name="pText" select="substring-after($pText, $sep)"/>
|
8609
|
+
<xsl:with-param name="sep" select="$sep"/>
|
8610
|
+
<xsl:with-param name="normalize-space" select="$normalize-space"/>
|
8611
|
+
<xsl:with-param name="keep_sep" select="$keep_sep"/>
|
8612
|
+
</xsl:call-template>
|
8530
8613
|
</xsl:if>
|
8531
8614
|
</xsl:template><xsl:template name="getDocumentId">
|
8532
8615
|
<xsl:call-template name="getLang"/><xsl:value-of select="//*[local-name() = 'p'][1]/@id"/>
|
data/lib/isodoc/iso/metadata.rb
CHANGED
@@ -56,14 +56,10 @@ module IsoDoc
|
|
56
56
|
end
|
57
57
|
|
58
58
|
def docid(isoxml, _out)
|
59
|
-
|
60
|
-
set(:
|
61
|
-
|
62
|
-
set(:
|
63
|
-
dn = isoxml.at(ns("//bibdata/docidentifier[@type = 'iso-with-lang']"))
|
64
|
-
set(:docnumber_lang, dn&.text)
|
65
|
-
dn = isoxml.at(ns("//bibdata/docidentifier[@type = 'iso-reference']"))
|
66
|
-
set(:docnumber_reference, dn&.text)
|
59
|
+
set(:docnumber, isoxml&.at(ns("//bibdata/docidentifier[@type = 'ISO']"))&.text)
|
60
|
+
set(:tc_docnumber, isoxml.xpath(ns("//bibdata/docidentifier[@type = 'iso-tc']")).map(&:text))
|
61
|
+
set(:docnumber_lang, isoxml&.at(ns("//bibdata/docidentifier[@type = 'iso-with-lang']"))&.text)
|
62
|
+
set(:docnumber_reference, isoxml&.at(ns("//bibdata/docidentifier[@type = 'iso-reference']"))&.text)
|
67
63
|
end
|
68
64
|
|
69
65
|
# we don't leave this to i18n.rb, because we have both English and
|
@@ -166,10 +162,7 @@ module IsoDoc
|
|
166
162
|
end
|
167
163
|
|
168
164
|
def subtitle(isoxml, _out)
|
169
|
-
lang =
|
170
|
-
when "fr", "ru" then "en"
|
171
|
-
else "fr"
|
172
|
-
end
|
165
|
+
lang = @lang == "en" ? "fr" : "en"
|
173
166
|
intro, main, part, amd = title_parts(isoxml, lang)
|
174
167
|
partnumber, subpartnumber, amdnumber, corrnumber = title_nums(isoxml)
|
175
168
|
|
@@ -10,14 +10,19 @@ module IsoDoc
|
|
10
10
|
@suffix = "sts.xml"
|
11
11
|
end
|
12
12
|
|
13
|
-
def
|
14
|
-
file = File.read(in_fname, encoding: "utf-8") if file.nil?
|
15
|
-
_docxml, filename, dir = convert_init(file, in_fname, debug)
|
13
|
+
def inputfile(in_fname, filename)
|
16
14
|
/\.xml$/.match?(in_fname) or
|
17
15
|
in_fname = Tempfile.open([filename, ".xml"], encoding: "utf-8") do |f|
|
18
16
|
f.write file
|
19
17
|
f.path
|
20
18
|
end
|
19
|
+
in_fname
|
20
|
+
end
|
21
|
+
|
22
|
+
def convert(in_fname, file = nil, debug = false, out_fname = nil)
|
23
|
+
file = File.read(in_fname, encoding: "utf-8") if file.nil?
|
24
|
+
_docxml, filename, dir = convert_init(file, in_fname, debug)
|
25
|
+
in_fname = inputfile(in_fname, filename)
|
21
26
|
FileUtils.rm_rf dir
|
22
27
|
MnConvert.convert(in_fname,
|
23
28
|
{ input_format: MnConvert::InputFormat::MN,
|
@@ -45,6 +45,18 @@ module IsoDoc
|
|
45
45
|
olstyle: "l2" }
|
46
46
|
end
|
47
47
|
|
48
|
+
def convert1(docxml, filename, dir)
|
49
|
+
@dis = /^[45].$/.match?(docxml&.at(ns("//bibdata/status/stage"))&.text)
|
50
|
+
if @dis
|
51
|
+
@wordstylesheet_name = html_doc_path("wordstyle-dis.scss")
|
52
|
+
@standardstylesheet_name = html_doc_path("isodoc-dis.scss")
|
53
|
+
@wordcoverpage = html_doc_path("word_iso_titlepage-dis.html")
|
54
|
+
@wordintropage = html_doc_path("word_iso_intro-dis.html")
|
55
|
+
@header = html_doc_path("header-dis.html")
|
56
|
+
end
|
57
|
+
super
|
58
|
+
end
|
59
|
+
|
48
60
|
def make_body(xml, docxml)
|
49
61
|
body_attr = { lang: "EN-US", link: "blue", vlink: "#954F72" }
|
50
62
|
xml.body **body_attr do |body|
|
@@ -1,11 +1,11 @@
|
|
1
1
|
<boilerplate>
|
2
2
|
<copyright-statement>
|
3
3
|
<clause>
|
4
|
-
<title>DOCUMENT PROTÉGÉ PAR COPYRIGHT</title>
|
5
4
|
<p id="boilerplate-year">© {{ agency }} {{ docyear }}</p>
|
6
5
|
|
7
6
|
<p id="boilerplate-message">
|
8
|
-
Droits de reproduction réservés. Sauf indication contraire,
|
7
|
+
Droits de reproduction réservés. Sauf indication contraire, ou requise dans le cadre de sa mise en œuvre,
|
8
|
+
aucune partie de cette publication ne
|
9
9
|
peut être reproduite ni utilisée sous quelque forme que ce soit et par aucun procédé, électronique
|
10
10
|
ou mécanique, y compris la photocopie, l’affichage sur l’internet ou sur un Intranet, sans
|
11
11
|
autorisation écrite préalable. Les demandes d’autorisation peuvent être adressées à l’ISO à
|
@@ -14,10 +14,9 @@ l’adresse ci-après ou au comité membre de l’ISO dans le pays du demandeur.
|
|
14
14
|
|
15
15
|
<p id="boilerplate-address" align="left">
|
16
16
|
ISO copyright office<br/>
|
17
|
-
Ch. de Blandonnet 8
|
18
|
-
CH-1214 Vernier, Geneva
|
19
|
-
|
20
|
-
Fax  + 41 22 749 09 47<br/>
|
17
|
+
CP 401 • Ch. de Blandonnet 8<br/>
|
18
|
+
CH-1214 Vernier, Geneva<br/>
|
19
|
+
Tél.  + 41 22 749 01 11<br/>
|
21
20
|
Email: copyright@iso.org<br/>
|
22
21
|
Website: www.iso.org
|
23
22
|
</p>
|
@@ -1,21 +1,19 @@
|
|
1
1
|
<boilerplate>
|
2
2
|
<copyright-statement>
|
3
3
|
<clause>
|
4
|
-
<title>ДОКУМЕНТ, ОХРАНЯЕМЫЙ АВТОРСКИМ ПРАВОМ</title>
|
5
4
|
<p id="boilerplate-year">
|
6
5
|
© {{ agency }} {{ docyear }}
|
7
6
|
</p>
|
8
7
|
|
9
8
|
<p id="boilerplate-message">
|
10
|
-
Все права защищены. Если иначе не
|
9
|
+
Все права защищены. Если иначе не определено или не требуется в контексте его реализации, никакая часть этой публикации не может быть воспроизведена или использована иначе в любой форме или каким-либо образом, электронным или механическим, включая фотокопирование, или публикацию в Интернете или интранете, без предварительного письменного разрешения. Разрешение может быть запрошено ISO по адресу, указанному ниже, или у органа — члена ISO страны запрашивающего.
|
11
10
|
</p>
|
12
11
|
|
13
12
|
<p id="boilerplate-address" align="left">
|
14
13
|
Бюро ISO по охране авторских прав<br/>
|
15
|
-
Ch. de Blandonnet 8
|
16
|
-
CH-1214 Vernier, Geneva
|
17
|
-
|
18
|
-
Fax  + 41 22 749 09 47<br/>
|
14
|
+
CP 401 • Ch. de Blandonnet 8<br/>
|
15
|
+
CH-1214 Vernier, Geneva<br/>
|
16
|
+
Тел.  + 41 22 749 01 11<br/>
|
19
17
|
Электронная почта: copyright@iso.org<br/>
|
20
18
|
Сайт: www.iso.org
|
21
19
|
</p>
|
@@ -1,14 +1,14 @@
|
|
1
1
|
<boilerplate>
|
2
2
|
<copyright-statement>
|
3
3
|
<clause>
|
4
|
-
<title>COPYRIGHT PROTECTED DOCUMENT</title>
|
5
4
|
<p id="boilerplate-year">
|
6
5
|
© {{ agency }} {{ docyear }}
|
7
6
|
</p>
|
8
7
|
|
9
8
|
<p id="boilerplate-message">
|
10
9
|
All rights
|
11
|
-
reserved. Unless otherwise specified,
|
10
|
+
reserved. Unless otherwise specified, or required in the context of its implementation,
|
11
|
+
no part of this publication may be
|
12
12
|
reproduced or utilized otherwise in any form or by any means, electronic or
|
13
13
|
mechanical, including photocopying, or posting on the internet or an intranet,
|
14
14
|
without prior written permission. Permission can be requested from either ISO
|
@@ -17,10 +17,9 @@ at the address below or ISO's member body in the country of the requester.
|
|
17
17
|
|
18
18
|
<p id="boilerplate-address" align="left">
|
19
19
|
ISO copyright office<br/>
|
20
|
-
Ch. de Blandonnet 8
|
21
|
-
CH-1214 Vernier, Geneva
|
22
|
-
|
23
|
-
Fax  + 41 22 749 09 47<br/>
|
20
|
+
CP 401 • Ch. de Blandonnet 8<br/>
|
21
|
+
CH-1214 Vernier, Geneva<br/>
|
22
|
+
Phone:  + 41 22 749 01 11<br/>
|
24
23
|
Email: copyright@iso.org<br/>
|
25
24
|
Website: www.iso.org
|
26
25
|
</p>
|
@@ -165,8 +165,7 @@ module Metanorma
|
|
165
165
|
def withdrawn_note(xmldoc)
|
166
166
|
xmldoc.xpath("//bibitem[not(note[@type = 'Unpublished-Status'])]")
|
167
167
|
.each do |b|
|
168
|
-
next
|
169
|
-
next unless (s = b.at("./status/stage")) && (s.text.to_i >= 90)
|
168
|
+
next unless withdrawn_ref?(b)
|
170
169
|
|
171
170
|
if id = replacement_standard(b)
|
172
171
|
insert_unpub_note(b, @i18n.cancelled_and_replaced.sub(/%/, id))
|
@@ -176,6 +175,13 @@ module Metanorma
|
|
176
175
|
end
|
177
176
|
end
|
178
177
|
|
178
|
+
def withdrawn_ref?(biblio)
|
179
|
+
return false if pub_class(biblio) > 2
|
180
|
+
|
181
|
+
(s = biblio.at("./status/stage")) && (s.text.to_i == 95) &&
|
182
|
+
(t = biblio.at("./status/substage")) && (t.text.to_i == 99)
|
183
|
+
end
|
184
|
+
|
179
185
|
def replacement_standard(biblio)
|
180
186
|
r = biblio.at("./relation[@type = 'updates']/bibitem") or return nil
|
181
187
|
id = r.at("./formattedref | ./docidentifier[@primary = 'true'] | "\
|
@@ -39,6 +39,7 @@ module Metanorma
|
|
39
39
|
ret = STAGE_ABBRS[stage.to_sym]
|
40
40
|
ret = "PRF" if stage == "60" && substage == "00"
|
41
41
|
ret = "AWI" if stage == "10" && substage == "99"
|
42
|
+
ret = "AWI" if stage == "20" && substage == "00"
|
42
43
|
if %w(amendment technical-corrigendum technical-report
|
43
44
|
technical-specification).include?(doctype)
|
44
45
|
ret = "D" if stage == "40" && doctype == "amendment"
|
@@ -43,6 +43,7 @@ module Metanorma
|
|
43
43
|
|
44
44
|
def skip_list_punctuation(list)
|
45
45
|
return true if list.at("./ancestor::table")
|
46
|
+
return true if list.at("./following-sibling::term") # terms boilerplate
|
46
47
|
|
47
48
|
list.xpath(".//li").each do |entry|
|
48
49
|
l = entry.dup
|
@@ -65,7 +66,7 @@ module Metanorma
|
|
65
66
|
|
66
67
|
# if first list entry starts lowercase, treat as sentence broken up
|
67
68
|
def list_after_colon_punctuation(list, entries)
|
68
|
-
lower = list.at(".//li").text
|
69
|
+
lower = starts_lowercase?(list.at(".//li").text)
|
69
70
|
entries.each_with_index do |li, i|
|
70
71
|
if lower
|
71
72
|
list_semicolon_phrase(li, i == entries.size - 1)
|
@@ -77,10 +78,14 @@ module Metanorma
|
|
77
78
|
|
78
79
|
def list_semicolon_phrase(elem, last)
|
79
80
|
text = elem.text.strip
|
80
|
-
|
81
|
+
starts_lowercase?(text) or
|
81
82
|
style_warning(elem, "List entry of broken up sentence must start "\
|
82
83
|
"with lowercase letter", text)
|
83
|
-
|
84
|
+
list_semicolon_phrase_punct(elem, text, last)
|
85
|
+
end
|
86
|
+
|
87
|
+
def list_semicolon_phrase_punct(elem, text, last)
|
88
|
+
punct = text.strip.sub(/^.*?(\S)$/m, "\\1")
|
84
89
|
if last
|
85
90
|
punct == "." or
|
86
91
|
style_warning(elem, "Final list entry of broken up "\
|
@@ -94,14 +99,24 @@ module Metanorma
|
|
94
99
|
|
95
100
|
def list_full_sentence(elem)
|
96
101
|
text = elem.text.strip
|
97
|
-
|
102
|
+
starts_uppercase?(text) or
|
98
103
|
style_warning(elem, "List entry of separate sentences must start "\
|
99
104
|
"with uppercase letter", text)
|
100
|
-
punct = text.sub(/^.*?(\S)
|
105
|
+
punct = text.strip.sub(/^.*?(\S)$/m, "\\1")
|
101
106
|
punct == "." or
|
102
107
|
style_warning(elem, "List entry of separate sentences must "\
|
103
108
|
"end with full stop", text)
|
104
109
|
end
|
110
|
+
|
111
|
+
# allow that all-caps word (acronym) is agnostic as to lowercase
|
112
|
+
def starts_lowercase?(text)
|
113
|
+
text.match?(/^[^[[:upper:]][[:lower:]]]*[[:lower:]]/) ||
|
114
|
+
text.match?(/^[^[[:upper:]][[:lower:]]]*[[:upper:]][[:upper:]]+[^[[:alpha:]]]/)
|
115
|
+
end
|
116
|
+
|
117
|
+
def starts_uppercase?(text)
|
118
|
+
text.match?(/^[^[[:upper:]][[:lower:]]]*[[:upper:]]/)
|
119
|
+
end
|
105
120
|
end
|
106
121
|
end
|
107
122
|
end
|
data/metanorma-iso.gemspec
CHANGED
@@ -46,6 +46,6 @@ Gem::Specification.new do |spec|
|
|
46
46
|
spec.add_development_dependency "sassc", "2.4.0"
|
47
47
|
spec.add_development_dependency "simplecov", "~> 0.15"
|
48
48
|
spec.add_development_dependency "timecop", "~> 0.9"
|
49
|
-
spec.add_development_dependency "vcr", "~>
|
49
|
+
spec.add_development_dependency "vcr", "~> 6.1.0"
|
50
50
|
spec.add_development_dependency "webmock"
|
51
51
|
end
|
data/spec/isodoc/ref_spec.rb
CHANGED
@@ -272,7 +272,7 @@ RSpec.describe IsoDoc do
|
|
272
272
|
</note>
|
273
273
|
<bibitem id="ISO3696" type="standard">
|
274
274
|
<title format="text/plain">Water for analytical laboratory use</title>
|
275
|
-
<docidentifier type='metanorma-ordinal'>[
|
275
|
+
<docidentifier type='metanorma-ordinal'>[3]</docidentifier>
|
276
276
|
<docidentifier type="ISO">ISO 3696</docidentifier>
|
277
277
|
<contributor>
|
278
278
|
<role type="publisher"/>
|
@@ -295,7 +295,7 @@ RSpec.describe IsoDoc do
|
|
295
295
|
</bibitem>
|
296
296
|
<bibitem id="ref11">
|
297
297
|
<title>Internet Calendaring and Scheduling Core Object Specification (iCalendar)</title>
|
298
|
-
<docidentifier type='metanorma-ordinal'>[
|
298
|
+
<docidentifier type='metanorma-ordinal'>[4]</docidentifier>
|
299
299
|
<docidentifier type="IETF">IETF RFC 10</docidentifier>
|
300
300
|
</bibitem>
|
301
301
|
<bibitem id="ref12">
|
@@ -363,7 +363,7 @@ RSpec.describe IsoDoc do
|
|
363
363
|
<p>
|
364
364
|
<span class="note_label">NOTE</span>  This is another annotation of document ISSN.</p>
|
365
365
|
</div>
|
366
|
-
<p class="Biblio" id="ISO3696">[
|
366
|
+
<p class="Biblio" id="ISO3696">[3]  ISO 3696,
|
367
367
|
<i>Water for analytical laboratory use</i></p>
|
368
368
|
<p class="Biblio" id="ref10">[10]  <span style="font-variant:small-caps;">Standard No I.C.C 167</span>
|
369
369
|
.
|
@@ -371,7 +371,7 @@ RSpec.describe IsoDoc do
|
|
371
371
|
(see
|
372
372
|
<a href="http://www.icc.or.at">http://www.icc.or.at</a>
|
373
373
|
)</p>
|
374
|
-
<p class="Biblio" id="ref11">[
|
374
|
+
<p class="Biblio" id="ref11">[4]  IETF RFC 10,
|
375
375
|
<i>Internet Calendaring and Scheduling Core Object Specification (iCalendar)</i></p>
|
376
376
|
<p class="Biblio" id="ref12">Citn  IETF RFC 20, CitationWorks. 2019.
|
377
377
|
<i>How to cite a reference</i>
|
@@ -384,8 +384,12 @@ RSpec.describe IsoDoc do
|
|
384
384
|
</body>
|
385
385
|
</html>
|
386
386
|
OUTPUT
|
387
|
-
expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({})
|
388
|
-
.
|
389
|
-
|
387
|
+
expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({})
|
388
|
+
.convert("test", input, true))
|
389
|
+
.sub(%r{<localized-strings>.*</localized-strings>}m, ""))
|
390
|
+
.to be_equivalent_to xmlpp(presxml)
|
391
|
+
expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({})
|
392
|
+
.convert("test", presxml, true)))
|
393
|
+
.to be_equivalent_to xmlpp(html)
|
390
394
|
end
|
391
395
|
end
|
data/spec/metanorma/amd_spec.rb
CHANGED
@@ -280,7 +280,7 @@ RSpec.describe Metanorma::ISO do
|
|
280
280
|
OUTPUT
|
281
281
|
end
|
282
282
|
|
283
|
-
it "processes metadata, amendment" do
|
283
|
+
it "processes metadata, amendment, stage 30" do
|
284
284
|
output = Asciidoctor.convert(<<~"INPUT", *OPTIONS)
|
285
285
|
= Document title
|
286
286
|
Author
|
@@ -350,7 +350,7 @@ RSpec.describe Metanorma::ISO do
|
|
350
350
|
OUTPUT
|
351
351
|
end
|
352
352
|
|
353
|
-
it "processes metadata, amendment" do
|
353
|
+
it "processes metadata, amendment, stage 40" do
|
354
354
|
output = Asciidoctor.convert(<<~"INPUT", *OPTIONS)
|
355
355
|
= Document title
|
356
356
|
Author
|
@@ -419,7 +419,7 @@ RSpec.describe Metanorma::ISO do
|
|
419
419
|
OUTPUT
|
420
420
|
end
|
421
421
|
|
422
|
-
it "processes metadata, amendment" do
|
422
|
+
it "processes metadata, amendment, published" do
|
423
423
|
output = Asciidoctor.convert(<<~"INPUT", *OPTIONS)
|
424
424
|
= Document title
|
425
425
|
Author
|
@@ -487,7 +487,7 @@ RSpec.describe Metanorma::ISO do
|
|
487
487
|
OUTPUT
|
488
488
|
end
|
489
489
|
|
490
|
-
it "processes metadata, corrigendum" do
|
490
|
+
it "processes metadata, corrigendum, stage 30" do
|
491
491
|
output = Asciidoctor.convert(<<~"INPUT", *OPTIONS)
|
492
492
|
= Document title
|
493
493
|
Author
|
@@ -503,7 +503,6 @@ RSpec.describe Metanorma::ISO do
|
|
503
503
|
:corrigendum-number: 3
|
504
504
|
INPUT
|
505
505
|
expect(xmlpp(output.sub(%r{<boilerplate>.*</boilerplate>}m, ""))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
506
|
-
#{' '}
|
507
506
|
<iso-standard type="semantic" version="#{Metanorma::ISO::VERSION}" xmlns="https://www.metanorma.org/ns/iso">
|
508
507
|
<bibdata type="standard">
|
509
508
|
<docidentifier type="ISO">ISO 17301-1:2030/CD Cor.3</docidentifier>
|
@@ -557,7 +556,7 @@ RSpec.describe Metanorma::ISO do
|
|
557
556
|
OUTPUT
|
558
557
|
end
|
559
558
|
|
560
|
-
it "processes metadata, corrigendum" do
|
559
|
+
it "processes metadata, corrigendum, stage 50" do
|
561
560
|
output = Asciidoctor.convert(<<~"INPUT", *OPTIONS)
|
562
561
|
= Document title
|
563
562
|
Author
|
@@ -626,7 +625,7 @@ RSpec.describe Metanorma::ISO do
|
|
626
625
|
OUTPUT
|
627
626
|
end
|
628
627
|
|
629
|
-
it "processes metadata, corrigendum" do
|
628
|
+
it "processes metadata, corrigendum, published" do
|
630
629
|
output = Asciidoctor.convert(<<~"INPUT", *OPTIONS)
|
631
630
|
= Document title
|
632
631
|
Author
|
data/spec/metanorma/base_spec.rb
CHANGED