metanorma-iso 1.10.4 → 1.10.5
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/.github/workflows/ubuntu.yml +1 -1
- data/lib/asciidoctor/iso/front.rb +15 -2
- data/lib/asciidoctor/iso/front_id.rb +20 -17
- data/lib/asciidoctor/iso/isodoc.rng +6 -2
- data/lib/asciidoctor/iso/validate_image.rb +1 -1
- data/lib/isodoc/iso/base_convert.rb +14 -31
- data/lib/isodoc/iso/html/style-human.css +19 -8
- data/lib/isodoc/iso/html/style-human.scss +10 -8
- data/lib/isodoc/iso/html/style-iso.css +14 -5
- data/lib/isodoc/iso/html/style-iso.scss +5 -5
- data/lib/isodoc/iso/html/wordstyle.css +10 -8
- data/lib/isodoc/iso/html/wordstyle.scss +10 -8
- data/lib/isodoc/iso/index.rb +53 -45
- data/lib/isodoc/iso/iso.amendment.xsl +54 -2
- data/lib/isodoc/iso/iso.international-standard.xsl +54 -2
- data/lib/isodoc/iso/metadata.rb +27 -22
- data/lib/isodoc/iso/presentation_xml_convert.rb +41 -16
- data/lib/isodoc/iso/sts_convert.rb +2 -4
- data/lib/metanorma/iso/version.rb +1 -1
- data/spec/asciidoctor/base_spec.rb +397 -545
- data/spec/isodoc/amd_spec.rb +261 -250
- data/spec/isodoc/inline_spec.rb +238 -212
- data/spec/isodoc/iso_spec.rb +3 -1
- data/spec/isodoc/terms_spec.rb +4 -4
- data/spec/vcr_cassettes/docrels.yml +31 -421
- metadata +2 -2
data/lib/isodoc/iso/index.rb
CHANGED
@@ -5,32 +5,36 @@ module IsoDoc
|
|
5
5
|
%(id="_#{UUIDTools::UUID.random_create}")
|
6
6
|
end
|
7
7
|
|
8
|
-
def index(
|
9
|
-
|
10
|
-
|
11
|
-
|
8
|
+
def index(xml)
|
9
|
+
if xml.at(ns("//index"))
|
10
|
+
i = xml.at(ns("//indexsect")) ||
|
11
|
+
xml.root.add_child("<indexsect #{add_id}><title>#{@i18n.index}"\
|
12
|
+
"</title></indexsect>").first
|
13
|
+
index = sort_indexterms(xml.xpath(ns("//index")),
|
14
|
+
xml.xpath(ns("//index-xref[@also = 'false']")),
|
15
|
+
xml.xpath(ns("//index-xref[@also = 'true']")))
|
16
|
+
index1(xml, i, index)
|
17
|
+
else xml.xpath(ns("//indexsect")).each(&:remove)
|
12
18
|
end
|
13
|
-
i = docxml.at(ns("//indexsect")) ||
|
14
|
-
docxml.root.add_child("<indexsect #{add_id}><title>#{@i18n.index}</title></indexsect>").first
|
15
|
-
index = sort_indexterms(docxml.xpath(ns("//index")),
|
16
|
-
docxml.xpath(ns("//index-xref[@also = 'false']")),
|
17
|
-
docxml.xpath(ns("//index-xref[@also = 'true']")))
|
18
|
-
index1(docxml, i, index)
|
19
19
|
end
|
20
20
|
|
21
|
-
def index1(docxml,
|
22
|
-
c =
|
21
|
+
def index1(docxml, indexsect, index)
|
22
|
+
c = indexsect.add_child("<ul></ul>").first
|
23
23
|
index.keys.sort.each do |k|
|
24
|
-
# c = i.add_child "<clause #{add_id}><title>#{k}</title><ul></ul></clause>"
|
25
24
|
words = index[k].keys.each_with_object({}) do |w, v|
|
26
25
|
v[sortable(w).downcase] = w
|
27
26
|
end
|
28
27
|
words.keys.localize(@lang.to_sym).sort.to_a.each do |w|
|
29
|
-
# c.first.at(ns("./ul")).add_child index_entries(words, index[k], w)
|
30
28
|
c.add_child index_entries(words, index[k], w)
|
31
29
|
end
|
32
30
|
end
|
33
|
-
docxml
|
31
|
+
index1_cleanup(docxml)
|
32
|
+
end
|
33
|
+
|
34
|
+
def index1_cleanup(docxml)
|
35
|
+
docxml.xpath(ns("//indexsect//xref")).each do |x|
|
36
|
+
x.children.remove
|
37
|
+
end
|
34
38
|
@xrefs.bookmark_anchor_names(docxml)
|
35
39
|
end
|
36
40
|
|
@@ -56,7 +60,7 @@ module IsoDoc
|
|
56
60
|
end
|
57
61
|
ret += "</ul>"
|
58
62
|
end
|
59
|
-
ret
|
63
|
+
"#{ret}</li>"
|
60
64
|
end
|
61
65
|
|
62
66
|
def index_entries2(words, index, secondary)
|
@@ -75,30 +79,29 @@ module IsoDoc
|
|
75
79
|
end
|
76
80
|
ret += "</ul>"
|
77
81
|
end
|
78
|
-
ret
|
82
|
+
"#{ret}</li>"
|
79
83
|
end
|
80
84
|
|
81
85
|
def index_entries_head(head, entries, opt)
|
82
86
|
ret = "<li>#{head}"
|
83
87
|
xref = entries&.dig(:xref)&.join(", ")
|
84
|
-
|
85
|
-
|
86
|
-
end
|
87
|
-
see = see_sort&.keys&.localize(@lang.to_sym)&.sort&.to_a&.map do |k|
|
88
|
-
see_sort[k]
|
89
|
-
end&.join(", ")
|
90
|
-
also_sort = entries&.dig(:also)&.each_with_object({}) do |w, v|
|
91
|
-
v[sortable(w).downcase] = w
|
92
|
-
end
|
93
|
-
also = also_sort&.keys&.localize(@lang.to_sym)&.sort&.to_a&.map do |k|
|
94
|
-
also_sort[k]
|
95
|
-
end&.join(", ")
|
88
|
+
see = index_entries_see(entries, :see)
|
89
|
+
also = index_entries_see(entries, :also)
|
96
90
|
ret += "#{opt[:xref_lbl]} #{xref}" if xref
|
97
91
|
ret += "#{opt[:see_lbl]} #{see}" if see
|
98
92
|
ret += "#{opt[:also_lbl]} #{also}" if also
|
99
93
|
ret
|
100
94
|
end
|
101
95
|
|
96
|
+
def index_entries_see(entries, label)
|
97
|
+
see_sort = entries&.dig(label)&.each_with_object({}) do |w, v|
|
98
|
+
v[sortable(w).downcase] = w
|
99
|
+
end
|
100
|
+
see_sort&.keys&.localize(@lang.to_sym)&.sort&.to_a&.map do |k|
|
101
|
+
see_sort[k]
|
102
|
+
end&.join(", ")
|
103
|
+
end
|
104
|
+
|
102
105
|
def see_lbl
|
103
106
|
@lang == "en" ? @i18n.see : "<em>#{@i18n.see}</em>"
|
104
107
|
end
|
@@ -119,13 +122,8 @@ module IsoDoc
|
|
119
122
|
|
120
123
|
def extract_indexsee(val, terms, label)
|
121
124
|
terms.each_with_object(val) do |t, v|
|
122
|
-
term = t
|
123
|
-
term2
|
124
|
-
term3 = t&.at(ns("./tertiary"))&.children&.to_xml
|
125
|
-
v[term] ||= {}
|
126
|
-
v[term][term2] ||= {}
|
127
|
-
v[term][term2][term3] ||= {}
|
128
|
-
v[term][term2][term3][label] ||= []
|
125
|
+
term, term2, term3 = extract_indexterms_init(t)
|
126
|
+
term_hash_init(v, term, term2, term3, label)
|
129
127
|
v[term][term2][term3][label] << t&.at(ns("./target"))&.children&.to_xml
|
130
128
|
t.remove
|
131
129
|
end
|
@@ -138,22 +136,32 @@ module IsoDoc
|
|
138
136
|
end
|
139
137
|
end
|
140
138
|
|
141
|
-
# attributes are decoded into UTF-8,
|
139
|
+
# attributes are decoded into UTF-8,
|
140
|
+
# elements in extract_indexsee are still in entities
|
142
141
|
def extract_indexterms(terms)
|
143
142
|
terms.each_with_object({}) do |t, v|
|
144
|
-
term = t
|
145
|
-
term2 = t&.at(ns("./secondary"))&.children&.to_xml
|
146
|
-
term3 = t&.at(ns("./tertiary"))&.children&.to_xml
|
143
|
+
term, term2, term3 = extract_indexterms_init(t)
|
147
144
|
index2bookmark(t)
|
148
|
-
v
|
149
|
-
v[term][term2] ||= {}
|
150
|
-
v[term][term2][term3] ||= {}
|
151
|
-
v[term][term2][term3][:xref] ||= []
|
145
|
+
term_hash_init(v, term, term2, term3, :xref)
|
152
146
|
to = t["to"] ? "to='#{t['to']}' " : ""
|
153
|
-
v[term][term2][term3][:xref] << "<xref target='#{t['id']}'
|
147
|
+
v[term][term2][term3][:xref] << "<xref target='#{t['id']}' "\
|
148
|
+
"#{to}pagenumber='true'/>"
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
def extract_indexterms_init(term)
|
153
|
+
%w(primary secondary tertiary).each_with_object([]) do |x, m|
|
154
|
+
m << term&.at(ns("./#{x}"))&.children&.to_xml
|
154
155
|
end
|
155
156
|
end
|
156
157
|
|
158
|
+
def term_hash_init(hash, term, term2, term3, label)
|
159
|
+
hash[term] ||= {}
|
160
|
+
hash[term][term2] ||= {}
|
161
|
+
hash[term][term2][term3] ||= {}
|
162
|
+
hash[term][term2][term3][label] ||= []
|
163
|
+
end
|
164
|
+
|
157
165
|
def index2bookmark(node)
|
158
166
|
node.name = "bookmark"
|
159
167
|
node.children.each(&:remove)
|
@@ -1423,7 +1423,9 @@
|
|
1423
1423
|
|
1424
1424
|
<xsl:template name="getListItemFormat">
|
1425
1425
|
<xsl:choose>
|
1426
|
-
<xsl:when test="local-name(..) = 'ul'"
|
1426
|
+
<xsl:when test="local-name(..) = 'ul'">
|
1427
|
+
<xsl:call-template name="setULLabel"/>
|
1428
|
+
</xsl:when>
|
1427
1429
|
<xsl:otherwise> <!-- for ordered lists -->
|
1428
1430
|
<xsl:choose>
|
1429
1431
|
<xsl:when test="../@type = 'arabic'">
|
@@ -1545,7 +1547,7 @@
|
|
1545
1547
|
</xsl:choose>
|
1546
1548
|
</xsl:template>
|
1547
1549
|
|
1548
|
-
<xsl:template match="iso:title">
|
1550
|
+
<xsl:template match="iso:title" name="title">
|
1549
1551
|
|
1550
1552
|
<xsl:variable name="level">
|
1551
1553
|
<xsl:call-template name="getLevel"/>
|
@@ -4482,6 +4484,7 @@
|
|
4482
4484
|
</xsl:template><xsl:template match="*[local-name()='dd']" mode="dl"/><xsl:template match="*[local-name()='dd']" mode="dl_process">
|
4483
4485
|
<xsl:apply-templates/>
|
4484
4486
|
</xsl:template><xsl:template match="*[local-name()='dd']"/><xsl:template match="*[local-name()='dd']" mode="process">
|
4487
|
+
<xsl:apply-templates select="@language"/>
|
4485
4488
|
<xsl:apply-templates/>
|
4486
4489
|
</xsl:template><xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
|
4487
4490
|
<fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
|
@@ -6689,6 +6692,51 @@
|
|
6689
6692
|
</xsl:template><xsl:template match="*[local-name() = 'name']/text()">
|
6690
6693
|
<!-- 0xA0 to space replacement -->
|
6691
6694
|
<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),' ',' ')"/>
|
6695
|
+
</xsl:template><xsl:variable name="ul_labels_">
|
6696
|
+
|
6697
|
+
|
6698
|
+
|
6699
|
+
|
6700
|
+
|
6701
|
+
|
6702
|
+
|
6703
|
+
<label>—</label> <!-- em dash -->
|
6704
|
+
|
6705
|
+
|
6706
|
+
|
6707
|
+
|
6708
|
+
|
6709
|
+
|
6710
|
+
|
6711
|
+
|
6712
|
+
|
6713
|
+
|
6714
|
+
|
6715
|
+
</xsl:variable><xsl:variable name="ul_labels" select="xalan:nodeset($ul_labels_)"/><xsl:template name="setULLabel">
|
6716
|
+
<xsl:variable name="list_level_" select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
|
6717
|
+
<xsl:variable name="list_level">
|
6718
|
+
<xsl:choose>
|
6719
|
+
<xsl:when test="$list_level_ <= 3"><xsl:value-of select="$list_level_"/></xsl:when>
|
6720
|
+
<xsl:otherwise><xsl:value-of select="$list_level_ mod 3"/></xsl:otherwise>
|
6721
|
+
</xsl:choose>
|
6722
|
+
</xsl:variable>
|
6723
|
+
<xsl:choose>
|
6724
|
+
<xsl:when test="$ul_labels/label[not(@level)]"> <!-- one label for all levels -->
|
6725
|
+
<xsl:apply-templates select="$ul_labels/label[not(@level)]" mode="ul_labels"/>
|
6726
|
+
</xsl:when>
|
6727
|
+
<xsl:when test="$list_level mod 3 = 0">
|
6728
|
+
<xsl:apply-templates select="$ul_labels/label[@level = 3]" mode="ul_labels"/>
|
6729
|
+
</xsl:when>
|
6730
|
+
<xsl:when test="$list_level mod 2 = 0">
|
6731
|
+
<xsl:apply-templates select="$ul_labels/label[@level = 2]" mode="ul_labels"/>
|
6732
|
+
</xsl:when>
|
6733
|
+
<xsl:otherwise>
|
6734
|
+
<xsl:apply-templates select="$ul_labels/label[@level = 1]" mode="ul_labels"/>
|
6735
|
+
</xsl:otherwise>
|
6736
|
+
</xsl:choose>
|
6737
|
+
</xsl:template><xsl:template match="label" mode="ul_labels">
|
6738
|
+
<xsl:copy-of select="@*[not(local-name() = 'level')]"/>
|
6739
|
+
<xsl:value-of select="."/>
|
6692
6740
|
</xsl:template><xsl:template match="*[local-name() = 'ul'] | *[local-name() = 'ol']">
|
6693
6741
|
<xsl:choose>
|
6694
6742
|
<xsl:when test="parent::*[local-name() = 'note'] or parent::*[local-name() = 'termnote']">
|
@@ -7168,6 +7216,10 @@
|
|
7168
7216
|
</svg>
|
7169
7217
|
</fo:instream-foreign-object>
|
7170
7218
|
</fo:inline>
|
7219
|
+
</xsl:template><xsl:template match="@language">
|
7220
|
+
<xsl:copy-of select="."/>
|
7221
|
+
</xsl:template><xsl:template match="*[local-name() = 'p'][@type = 'floating-title']" priority="4">
|
7222
|
+
<xsl:call-template name="title"/>
|
7171
7223
|
</xsl:template><xsl:template name="convertDate">
|
7172
7224
|
<xsl:param name="date"/>
|
7173
7225
|
<xsl:param name="format" select="'short'"/>
|
@@ -1423,7 +1423,9 @@
|
|
1423
1423
|
|
1424
1424
|
<xsl:template name="getListItemFormat">
|
1425
1425
|
<xsl:choose>
|
1426
|
-
<xsl:when test="local-name(..) = 'ul'"
|
1426
|
+
<xsl:when test="local-name(..) = 'ul'">
|
1427
|
+
<xsl:call-template name="setULLabel"/>
|
1428
|
+
</xsl:when>
|
1427
1429
|
<xsl:otherwise> <!-- for ordered lists -->
|
1428
1430
|
<xsl:choose>
|
1429
1431
|
<xsl:when test="../@type = 'arabic'">
|
@@ -1545,7 +1547,7 @@
|
|
1545
1547
|
</xsl:choose>
|
1546
1548
|
</xsl:template>
|
1547
1549
|
|
1548
|
-
<xsl:template match="iso:title">
|
1550
|
+
<xsl:template match="iso:title" name="title">
|
1549
1551
|
|
1550
1552
|
<xsl:variable name="level">
|
1551
1553
|
<xsl:call-template name="getLevel"/>
|
@@ -4482,6 +4484,7 @@
|
|
4482
4484
|
</xsl:template><xsl:template match="*[local-name()='dd']" mode="dl"/><xsl:template match="*[local-name()='dd']" mode="dl_process">
|
4483
4485
|
<xsl:apply-templates/>
|
4484
4486
|
</xsl:template><xsl:template match="*[local-name()='dd']"/><xsl:template match="*[local-name()='dd']" mode="process">
|
4487
|
+
<xsl:apply-templates select="@language"/>
|
4485
4488
|
<xsl:apply-templates/>
|
4486
4489
|
</xsl:template><xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
|
4487
4490
|
<fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
|
@@ -6689,6 +6692,51 @@
|
|
6689
6692
|
</xsl:template><xsl:template match="*[local-name() = 'name']/text()">
|
6690
6693
|
<!-- 0xA0 to space replacement -->
|
6691
6694
|
<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),' ',' ')"/>
|
6695
|
+
</xsl:template><xsl:variable name="ul_labels_">
|
6696
|
+
|
6697
|
+
|
6698
|
+
|
6699
|
+
|
6700
|
+
|
6701
|
+
|
6702
|
+
|
6703
|
+
<label>—</label> <!-- em dash -->
|
6704
|
+
|
6705
|
+
|
6706
|
+
|
6707
|
+
|
6708
|
+
|
6709
|
+
|
6710
|
+
|
6711
|
+
|
6712
|
+
|
6713
|
+
|
6714
|
+
|
6715
|
+
</xsl:variable><xsl:variable name="ul_labels" select="xalan:nodeset($ul_labels_)"/><xsl:template name="setULLabel">
|
6716
|
+
<xsl:variable name="list_level_" select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
|
6717
|
+
<xsl:variable name="list_level">
|
6718
|
+
<xsl:choose>
|
6719
|
+
<xsl:when test="$list_level_ <= 3"><xsl:value-of select="$list_level_"/></xsl:when>
|
6720
|
+
<xsl:otherwise><xsl:value-of select="$list_level_ mod 3"/></xsl:otherwise>
|
6721
|
+
</xsl:choose>
|
6722
|
+
</xsl:variable>
|
6723
|
+
<xsl:choose>
|
6724
|
+
<xsl:when test="$ul_labels/label[not(@level)]"> <!-- one label for all levels -->
|
6725
|
+
<xsl:apply-templates select="$ul_labels/label[not(@level)]" mode="ul_labels"/>
|
6726
|
+
</xsl:when>
|
6727
|
+
<xsl:when test="$list_level mod 3 = 0">
|
6728
|
+
<xsl:apply-templates select="$ul_labels/label[@level = 3]" mode="ul_labels"/>
|
6729
|
+
</xsl:when>
|
6730
|
+
<xsl:when test="$list_level mod 2 = 0">
|
6731
|
+
<xsl:apply-templates select="$ul_labels/label[@level = 2]" mode="ul_labels"/>
|
6732
|
+
</xsl:when>
|
6733
|
+
<xsl:otherwise>
|
6734
|
+
<xsl:apply-templates select="$ul_labels/label[@level = 1]" mode="ul_labels"/>
|
6735
|
+
</xsl:otherwise>
|
6736
|
+
</xsl:choose>
|
6737
|
+
</xsl:template><xsl:template match="label" mode="ul_labels">
|
6738
|
+
<xsl:copy-of select="@*[not(local-name() = 'level')]"/>
|
6739
|
+
<xsl:value-of select="."/>
|
6692
6740
|
</xsl:template><xsl:template match="*[local-name() = 'ul'] | *[local-name() = 'ol']">
|
6693
6741
|
<xsl:choose>
|
6694
6742
|
<xsl:when test="parent::*[local-name() = 'note'] or parent::*[local-name() = 'termnote']">
|
@@ -7168,6 +7216,10 @@
|
|
7168
7216
|
</svg>
|
7169
7217
|
</fo:instream-foreign-object>
|
7170
7218
|
</fo:inline>
|
7219
|
+
</xsl:template><xsl:template match="@language">
|
7220
|
+
<xsl:copy-of select="."/>
|
7221
|
+
</xsl:template><xsl:template match="*[local-name() = 'p'][@type = 'floating-title']" priority="4">
|
7222
|
+
<xsl:call-template name="title"/>
|
7171
7223
|
</xsl:template><xsl:template name="convertDate">
|
7172
7224
|
<xsl:param name="date"/>
|
7173
7225
|
<xsl:param name="format" select="'short'"/>
|
data/lib/isodoc/iso/metadata.rb
CHANGED
@@ -21,9 +21,8 @@ module IsoDoc
|
|
21
21
|
stage = "DTS" if stage == "DIS"
|
22
22
|
stage = "FDTS" if stage == "FDIS"
|
23
23
|
end
|
24
|
-
|
24
|
+
%w(PWI NWIP WD CD).include?(stage) && iter and
|
25
25
|
stage += iter
|
26
|
-
end
|
27
26
|
stage = "Pre#{stage}" if /^0\./.match?(draft)
|
28
27
|
stage
|
29
28
|
end
|
@@ -31,20 +30,25 @@ module IsoDoc
|
|
31
30
|
def docstatus(isoxml, _out)
|
32
31
|
docstatus = isoxml.at(ns("//bibdata/status/stage"))
|
33
32
|
set(:unpublished, false)
|
34
|
-
if docstatus
|
35
|
-
set(:stage, docstatus.text)
|
36
|
-
set(:stage_int, docstatus.text.to_i)
|
37
|
-
set(:unpublished, unpublished(docstatus.text))
|
38
|
-
set(:statusabbr, status_abbrev(docstatus["abbreviation"] || "??",
|
39
|
-
isoxml&.at(ns("//bibdata/status/substage"))&.text,
|
40
|
-
isoxml&.at(ns("//bibdata/status/iteration"))&.text,
|
41
|
-
isoxml&.at(ns("//bibdata/version/draft"))&.text,
|
42
|
-
isoxml&.at(ns("//bibdata/ext/doctype"))&.text))
|
43
|
-
unpublished(docstatus.text) and
|
44
|
-
set(:stageabbr, docstatus["abbreviation"])
|
45
|
-
end
|
46
33
|
revdate = isoxml.at(ns("//bibdata/version/revision-date"))
|
47
34
|
set(:revdate, revdate&.text)
|
35
|
+
if docstatus
|
36
|
+
docstatus1(isoxml, docstatus)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def docstatus1(isoxml, docstatus)
|
41
|
+
set(:stage, docstatus.text)
|
42
|
+
set(:stage_int, docstatus.text.to_i)
|
43
|
+
set(:unpublished, unpublished(docstatus.text))
|
44
|
+
set(:statusabbr,
|
45
|
+
status_abbrev(docstatus["abbreviation"] || "??",
|
46
|
+
isoxml&.at(ns("//bibdata/status/substage"))&.text,
|
47
|
+
isoxml&.at(ns("//bibdata/status/iteration"))&.text,
|
48
|
+
isoxml&.at(ns("//bibdata/version/draft"))&.text,
|
49
|
+
isoxml&.at(ns("//bibdata/ext/doctype"))&.text))
|
50
|
+
unpublished(docstatus.text) and
|
51
|
+
set(:stageabbr, docstatus["abbreviation"])
|
48
52
|
end
|
49
53
|
|
50
54
|
def unpublished(status)
|
@@ -73,8 +77,7 @@ module IsoDoc
|
|
73
77
|
|
74
78
|
def amd_label(lang)
|
75
79
|
case lang
|
76
|
-
when "en" then "AMENDMENT"
|
77
|
-
when "fr" then "AMENDMENT"
|
80
|
+
when "en", "fr" then "AMENDMENT"
|
78
81
|
end
|
79
82
|
end
|
80
83
|
|
@@ -183,10 +186,10 @@ module IsoDoc
|
|
183
186
|
end
|
184
187
|
|
185
188
|
def tc(xml)
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
189
|
+
tc_type = xml.at(ns("//bibdata/ext/editorialgroup/technical-committee/"\
|
190
|
+
"@type"))&.text || "TC"
|
191
|
+
if tc_num = xml.at(ns("//bibdata/ext/editorialgroup/"\
|
192
|
+
"technical-committee/@number"))
|
190
193
|
tcid = "#{tc_type} #{tc_num.text}"
|
191
194
|
set(:tc, tcid)
|
192
195
|
set(:editorialgroup, get[:editorialgroup] << tcid)
|
@@ -195,7 +198,8 @@ module IsoDoc
|
|
195
198
|
|
196
199
|
def sc(xml)
|
197
200
|
sc_num = xml.at(ns("//bibdata/ext/editorialgroup/subcommittee/@number"))
|
198
|
-
sc_type = xml.at(ns("//bibdata/ext/editorialgroup/subcommittee
|
201
|
+
sc_type = xml.at(ns("//bibdata/ext/editorialgroup/subcommittee/"\
|
202
|
+
"@type"))&.text || "SC"
|
199
203
|
if sc_num
|
200
204
|
scid = "#{sc_type} #{sc_num.text}"
|
201
205
|
set(:sc, scid)
|
@@ -205,7 +209,8 @@ module IsoDoc
|
|
205
209
|
|
206
210
|
def wg(xml)
|
207
211
|
wg_num = xml.at(ns("//bibdata/ext/editorialgroup/workgroup/@number"))
|
208
|
-
wg_type = xml.at(ns("//bibdata/ext/editorialgroup/workgroup
|
212
|
+
wg_type = xml.at(ns("//bibdata/ext/editorialgroup/workgroup/"\
|
213
|
+
"@type"))&.text || "WG"
|
209
214
|
if wg_num
|
210
215
|
wgid = "#{wg_type} #{wg_num.text}"
|
211
216
|
set(:wg, wgid)
|
@@ -113,28 +113,29 @@ module IsoDoc
|
|
113
113
|
end
|
114
114
|
|
115
115
|
def concept(docxml)
|
116
|
-
docxml
|
117
|
-
concept_term(f, m)
|
118
|
-
end
|
116
|
+
concept_term(docxml)
|
119
117
|
docxml.xpath(ns("//concept")).each do |node|
|
120
|
-
concept_render(node, ital:
|
121
|
-
|
122
|
-
|
123
|
-
|
118
|
+
concept_render(node, ital: "false", ref: "false",
|
119
|
+
linkref: "true", linkmention: "false")
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
def concept_term(docxml)
|
124
|
+
docxml.xpath(ns("//term")).each do |f|
|
125
|
+
m = {}
|
126
|
+
f.xpath(ns(".//concept")).each do |c|
|
127
|
+
concept_term1(c, m)
|
128
|
+
end
|
124
129
|
end
|
125
130
|
end
|
126
131
|
|
127
|
-
def
|
132
|
+
def concept_term1(node, seen)
|
128
133
|
term = node&.at(ns("./refterm"))&.to_xml
|
129
134
|
if term && seen[term]
|
130
|
-
concept_render(node, ital:
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
else concept_render(node, ital: node["ital"] || "true",
|
135
|
-
ref: node["ref"] || "true",
|
136
|
-
linkref: node["linkref"] || "true",
|
137
|
-
linkmention: node["linkmention"] || "false")
|
135
|
+
concept_render(node, ital: "false", ref: "false",
|
136
|
+
linkref: "true", linkmention: "false")
|
137
|
+
else concept_render(node, ital: "true", ref: "true",
|
138
|
+
linkref: "true", linkmention: "false")
|
138
139
|
end
|
139
140
|
seen[term] = true if term
|
140
141
|
seen
|
@@ -184,6 +185,30 @@ module IsoDoc
|
|
184
185
|
"<#{d.remove.children.to_xml}> "
|
185
186
|
end
|
186
187
|
|
188
|
+
def insertall_after_here(node, insert, name)
|
189
|
+
node.children.each do |n|
|
190
|
+
next unless n.name == name
|
191
|
+
|
192
|
+
insert.next = n.remove
|
193
|
+
insert = n
|
194
|
+
end
|
195
|
+
insert
|
196
|
+
end
|
197
|
+
|
198
|
+
def termexamples_before_termnotes(node)
|
199
|
+
return unless insert = node.at(ns("./definition"))
|
200
|
+
|
201
|
+
insert = insertall_after_here(node, insert, "termexample")
|
202
|
+
insertall_after_here(node, insert, "termnote")
|
203
|
+
end
|
204
|
+
|
205
|
+
def terms(docxml)
|
206
|
+
docxml.xpath(ns("//term[termnote][termexample]")).each do |node|
|
207
|
+
termexamples_before_termnotes(node)
|
208
|
+
end
|
209
|
+
super
|
210
|
+
end
|
211
|
+
|
187
212
|
include Init
|
188
213
|
end
|
189
214
|
end
|
@@ -20,10 +20,8 @@ module IsoDoc
|
|
20
20
|
end
|
21
21
|
FileUtils.rm_rf dir
|
22
22
|
MnConvert.convert(in_fname,
|
23
|
-
{
|
24
|
-
|
25
|
-
output_file: out_fname || "#{filename}.#{@suffix}",
|
26
|
-
})
|
23
|
+
{ input_format: MnConvert::InputFormat::MN,
|
24
|
+
output_file: out_fname || "#{filename}.#{@suffix}" })
|
27
25
|
end
|
28
26
|
end
|
29
27
|
end
|