metanorma-itu 1.2.10 → 1.2.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +3 -0
- data/lib/asciidoctor/itu/boilerplate.xml +5 -2
- data/lib/asciidoctor/itu/cleanup.rb +9 -0
- data/lib/asciidoctor/itu/converter.rb +1 -0
- data/lib/asciidoctor/itu/front.rb +14 -15
- data/lib/asciidoctor/itu/isodoc.rng +26 -3
- data/lib/asciidoctor/itu/itu.rng +70 -0
- data/lib/asciidoctor/itu/validate.rb +12 -4
- data/lib/isodoc/itu/base_convert.rb +65 -52
- data/lib/isodoc/itu/cleanup.rb +55 -0
- data/lib/isodoc/itu/html/header.html +12 -8
- data/lib/isodoc/itu/html/html_itu_titlepage.html +15 -3
- data/lib/isodoc/itu/html/htmlstyle.css +48 -12
- data/lib/isodoc/itu/html/htmlstyle.scss +9 -5
- data/lib/isodoc/itu/html/word_itu_intro.html +6 -0
- data/lib/isodoc/itu/html/word_itu_titlepage.html +29 -6
- data/lib/isodoc/itu/html/wordstyle.css +3 -0
- data/lib/isodoc/itu/html/wordstyle.scss +3 -0
- data/lib/isodoc/itu/i18n-en.yaml +4 -0
- data/lib/isodoc/itu/itu.recommendation-annex.xsl +18 -2
- data/lib/isodoc/itu/itu.recommendation.xsl +18 -2
- data/lib/isodoc/itu/itu.resolution.xsl +18 -2
- data/lib/isodoc/itu/itu.technical-paper.xsl +18 -2
- data/lib/isodoc/itu/itu.technical-report.xsl +18 -2
- data/lib/isodoc/itu/metadata.rb +41 -7
- data/lib/isodoc/itu/presentation_xml_convert.rb +49 -3
- data/lib/isodoc/itu/xref.rb +93 -39
- data/lib/metanorma/itu/version.rb +1 -1
- data/metanorma-itu.gemspec +1 -1
- metadata +5 -4
@@ -2218,7 +2218,12 @@
|
|
2218
2218
|
|
2219
2219
|
<xsl:variable name="table_attributes">
|
2220
2220
|
<attribute name="table-layout">fixed</attribute>
|
2221
|
-
<attribute name="width">
|
2221
|
+
<attribute name="width">
|
2222
|
+
<xsl:choose>
|
2223
|
+
<xsl:when test="@width"><xsl:value-of select="@width"/></xsl:when>
|
2224
|
+
<xsl:otherwise>100%</xsl:otherwise>
|
2225
|
+
</xsl:choose>
|
2226
|
+
</attribute>
|
2222
2227
|
<attribute name="margin-left"><xsl:value-of select="$margin-left"/>mm</attribute>
|
2223
2228
|
<attribute name="margin-right"><xsl:value-of select="$margin-left"/>mm</attribute>
|
2224
2229
|
|
@@ -3426,6 +3431,10 @@
|
|
3426
3431
|
</xsl:if>
|
3427
3432
|
<xsl:apply-templates/>
|
3428
3433
|
</fo:inline>
|
3434
|
+
</xsl:template><xsl:template match="*[local-name()='underline']">
|
3435
|
+
<fo:inline text-decoration="underline">
|
3436
|
+
<xsl:apply-templates/>
|
3437
|
+
</fo:inline>
|
3429
3438
|
</xsl:template><xsl:template match="*[local-name()='del']">
|
3430
3439
|
<fo:inline font-size="10pt" color="red" text-decoration="line-through">
|
3431
3440
|
<xsl:apply-templates/>
|
@@ -4984,6 +4993,8 @@
|
|
4984
4993
|
<xsl:value-of select="translate(.,'. ','')"/>
|
4985
4994
|
</xsl:template><xsl:template match="*[local-name() = 'name']/*[local-name() = 'forename']/text()" mode="strip">
|
4986
4995
|
<xsl:value-of select="substring(.,1,1)"/>
|
4996
|
+
</xsl:template><xsl:template match="*[local-name() = 'title']" mode="title">
|
4997
|
+
<fo:inline><xsl:apply-templates/></fo:inline>
|
4987
4998
|
</xsl:template><xsl:template name="convertDate">
|
4988
4999
|
<xsl:param name="date"/>
|
4989
5000
|
<xsl:param name="format" select="'short'"/>
|
@@ -5263,6 +5274,11 @@
|
|
5263
5274
|
<xsl:call-template name="getLang"/>
|
5264
5275
|
</xsl:variable>
|
5265
5276
|
|
5266
|
-
<xsl:
|
5277
|
+
<xsl:choose>
|
5278
|
+
<xsl:when test="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]">
|
5279
|
+
<xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
|
5280
|
+
</xsl:when>
|
5281
|
+
<xsl:otherwise><xsl:value-of select="$key"/></xsl:otherwise>
|
5282
|
+
</xsl:choose>
|
5267
5283
|
|
5268
5284
|
</xsl:template></xsl:stylesheet>
|
@@ -2218,7 +2218,12 @@
|
|
2218
2218
|
|
2219
2219
|
<xsl:variable name="table_attributes">
|
2220
2220
|
<attribute name="table-layout">fixed</attribute>
|
2221
|
-
<attribute name="width">
|
2221
|
+
<attribute name="width">
|
2222
|
+
<xsl:choose>
|
2223
|
+
<xsl:when test="@width"><xsl:value-of select="@width"/></xsl:when>
|
2224
|
+
<xsl:otherwise>100%</xsl:otherwise>
|
2225
|
+
</xsl:choose>
|
2226
|
+
</attribute>
|
2222
2227
|
<attribute name="margin-left"><xsl:value-of select="$margin-left"/>mm</attribute>
|
2223
2228
|
<attribute name="margin-right"><xsl:value-of select="$margin-left"/>mm</attribute>
|
2224
2229
|
|
@@ -3426,6 +3431,10 @@
|
|
3426
3431
|
</xsl:if>
|
3427
3432
|
<xsl:apply-templates/>
|
3428
3433
|
</fo:inline>
|
3434
|
+
</xsl:template><xsl:template match="*[local-name()='underline']">
|
3435
|
+
<fo:inline text-decoration="underline">
|
3436
|
+
<xsl:apply-templates/>
|
3437
|
+
</fo:inline>
|
3429
3438
|
</xsl:template><xsl:template match="*[local-name()='del']">
|
3430
3439
|
<fo:inline font-size="10pt" color="red" text-decoration="line-through">
|
3431
3440
|
<xsl:apply-templates/>
|
@@ -4984,6 +4993,8 @@
|
|
4984
4993
|
<xsl:value-of select="translate(.,'. ','')"/>
|
4985
4994
|
</xsl:template><xsl:template match="*[local-name() = 'name']/*[local-name() = 'forename']/text()" mode="strip">
|
4986
4995
|
<xsl:value-of select="substring(.,1,1)"/>
|
4996
|
+
</xsl:template><xsl:template match="*[local-name() = 'title']" mode="title">
|
4997
|
+
<fo:inline><xsl:apply-templates/></fo:inline>
|
4987
4998
|
</xsl:template><xsl:template name="convertDate">
|
4988
4999
|
<xsl:param name="date"/>
|
4989
5000
|
<xsl:param name="format" select="'short'"/>
|
@@ -5263,6 +5274,11 @@
|
|
5263
5274
|
<xsl:call-template name="getLang"/>
|
5264
5275
|
</xsl:variable>
|
5265
5276
|
|
5266
|
-
<xsl:
|
5277
|
+
<xsl:choose>
|
5278
|
+
<xsl:when test="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]">
|
5279
|
+
<xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
|
5280
|
+
</xsl:when>
|
5281
|
+
<xsl:otherwise><xsl:value-of select="$key"/></xsl:otherwise>
|
5282
|
+
</xsl:choose>
|
5267
5283
|
|
5268
5284
|
</xsl:template></xsl:stylesheet>
|
@@ -2218,7 +2218,12 @@
|
|
2218
2218
|
|
2219
2219
|
<xsl:variable name="table_attributes">
|
2220
2220
|
<attribute name="table-layout">fixed</attribute>
|
2221
|
-
<attribute name="width">
|
2221
|
+
<attribute name="width">
|
2222
|
+
<xsl:choose>
|
2223
|
+
<xsl:when test="@width"><xsl:value-of select="@width"/></xsl:when>
|
2224
|
+
<xsl:otherwise>100%</xsl:otherwise>
|
2225
|
+
</xsl:choose>
|
2226
|
+
</attribute>
|
2222
2227
|
<attribute name="margin-left"><xsl:value-of select="$margin-left"/>mm</attribute>
|
2223
2228
|
<attribute name="margin-right"><xsl:value-of select="$margin-left"/>mm</attribute>
|
2224
2229
|
|
@@ -3426,6 +3431,10 @@
|
|
3426
3431
|
</xsl:if>
|
3427
3432
|
<xsl:apply-templates/>
|
3428
3433
|
</fo:inline>
|
3434
|
+
</xsl:template><xsl:template match="*[local-name()='underline']">
|
3435
|
+
<fo:inline text-decoration="underline">
|
3436
|
+
<xsl:apply-templates/>
|
3437
|
+
</fo:inline>
|
3429
3438
|
</xsl:template><xsl:template match="*[local-name()='del']">
|
3430
3439
|
<fo:inline font-size="10pt" color="red" text-decoration="line-through">
|
3431
3440
|
<xsl:apply-templates/>
|
@@ -4984,6 +4993,8 @@
|
|
4984
4993
|
<xsl:value-of select="translate(.,'. ','')"/>
|
4985
4994
|
</xsl:template><xsl:template match="*[local-name() = 'name']/*[local-name() = 'forename']/text()" mode="strip">
|
4986
4995
|
<xsl:value-of select="substring(.,1,1)"/>
|
4996
|
+
</xsl:template><xsl:template match="*[local-name() = 'title']" mode="title">
|
4997
|
+
<fo:inline><xsl:apply-templates/></fo:inline>
|
4987
4998
|
</xsl:template><xsl:template name="convertDate">
|
4988
4999
|
<xsl:param name="date"/>
|
4989
5000
|
<xsl:param name="format" select="'short'"/>
|
@@ -5263,6 +5274,11 @@
|
|
5263
5274
|
<xsl:call-template name="getLang"/>
|
5264
5275
|
</xsl:variable>
|
5265
5276
|
|
5266
|
-
<xsl:
|
5277
|
+
<xsl:choose>
|
5278
|
+
<xsl:when test="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]">
|
5279
|
+
<xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
|
5280
|
+
</xsl:when>
|
5281
|
+
<xsl:otherwise><xsl:value-of select="$key"/></xsl:otherwise>
|
5282
|
+
</xsl:choose>
|
5267
5283
|
|
5268
5284
|
</xsl:template></xsl:stylesheet>
|
@@ -2218,7 +2218,12 @@
|
|
2218
2218
|
|
2219
2219
|
<xsl:variable name="table_attributes">
|
2220
2220
|
<attribute name="table-layout">fixed</attribute>
|
2221
|
-
<attribute name="width">
|
2221
|
+
<attribute name="width">
|
2222
|
+
<xsl:choose>
|
2223
|
+
<xsl:when test="@width"><xsl:value-of select="@width"/></xsl:when>
|
2224
|
+
<xsl:otherwise>100%</xsl:otherwise>
|
2225
|
+
</xsl:choose>
|
2226
|
+
</attribute>
|
2222
2227
|
<attribute name="margin-left"><xsl:value-of select="$margin-left"/>mm</attribute>
|
2223
2228
|
<attribute name="margin-right"><xsl:value-of select="$margin-left"/>mm</attribute>
|
2224
2229
|
|
@@ -3426,6 +3431,10 @@
|
|
3426
3431
|
</xsl:if>
|
3427
3432
|
<xsl:apply-templates/>
|
3428
3433
|
</fo:inline>
|
3434
|
+
</xsl:template><xsl:template match="*[local-name()='underline']">
|
3435
|
+
<fo:inline text-decoration="underline">
|
3436
|
+
<xsl:apply-templates/>
|
3437
|
+
</fo:inline>
|
3429
3438
|
</xsl:template><xsl:template match="*[local-name()='del']">
|
3430
3439
|
<fo:inline font-size="10pt" color="red" text-decoration="line-through">
|
3431
3440
|
<xsl:apply-templates/>
|
@@ -4984,6 +4993,8 @@
|
|
4984
4993
|
<xsl:value-of select="translate(.,'. ','')"/>
|
4985
4994
|
</xsl:template><xsl:template match="*[local-name() = 'name']/*[local-name() = 'forename']/text()" mode="strip">
|
4986
4995
|
<xsl:value-of select="substring(.,1,1)"/>
|
4996
|
+
</xsl:template><xsl:template match="*[local-name() = 'title']" mode="title">
|
4997
|
+
<fo:inline><xsl:apply-templates/></fo:inline>
|
4987
4998
|
</xsl:template><xsl:template name="convertDate">
|
4988
4999
|
<xsl:param name="date"/>
|
4989
5000
|
<xsl:param name="format" select="'short'"/>
|
@@ -5263,6 +5274,11 @@
|
|
5263
5274
|
<xsl:call-template name="getLang"/>
|
5264
5275
|
</xsl:variable>
|
5265
5276
|
|
5266
|
-
<xsl:
|
5277
|
+
<xsl:choose>
|
5278
|
+
<xsl:when test="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]">
|
5279
|
+
<xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
|
5280
|
+
</xsl:when>
|
5281
|
+
<xsl:otherwise><xsl:value-of select="$key"/></xsl:otherwise>
|
5282
|
+
</xsl:choose>
|
5267
5283
|
|
5268
5284
|
</xsl:template></xsl:stylesheet>
|
@@ -2218,7 +2218,12 @@
|
|
2218
2218
|
|
2219
2219
|
<xsl:variable name="table_attributes">
|
2220
2220
|
<attribute name="table-layout">fixed</attribute>
|
2221
|
-
<attribute name="width">
|
2221
|
+
<attribute name="width">
|
2222
|
+
<xsl:choose>
|
2223
|
+
<xsl:when test="@width"><xsl:value-of select="@width"/></xsl:when>
|
2224
|
+
<xsl:otherwise>100%</xsl:otherwise>
|
2225
|
+
</xsl:choose>
|
2226
|
+
</attribute>
|
2222
2227
|
<attribute name="margin-left"><xsl:value-of select="$margin-left"/>mm</attribute>
|
2223
2228
|
<attribute name="margin-right"><xsl:value-of select="$margin-left"/>mm</attribute>
|
2224
2229
|
|
@@ -3426,6 +3431,10 @@
|
|
3426
3431
|
</xsl:if>
|
3427
3432
|
<xsl:apply-templates/>
|
3428
3433
|
</fo:inline>
|
3434
|
+
</xsl:template><xsl:template match="*[local-name()='underline']">
|
3435
|
+
<fo:inline text-decoration="underline">
|
3436
|
+
<xsl:apply-templates/>
|
3437
|
+
</fo:inline>
|
3429
3438
|
</xsl:template><xsl:template match="*[local-name()='del']">
|
3430
3439
|
<fo:inline font-size="10pt" color="red" text-decoration="line-through">
|
3431
3440
|
<xsl:apply-templates/>
|
@@ -4984,6 +4993,8 @@
|
|
4984
4993
|
<xsl:value-of select="translate(.,'. ','')"/>
|
4985
4994
|
</xsl:template><xsl:template match="*[local-name() = 'name']/*[local-name() = 'forename']/text()" mode="strip">
|
4986
4995
|
<xsl:value-of select="substring(.,1,1)"/>
|
4996
|
+
</xsl:template><xsl:template match="*[local-name() = 'title']" mode="title">
|
4997
|
+
<fo:inline><xsl:apply-templates/></fo:inline>
|
4987
4998
|
</xsl:template><xsl:template name="convertDate">
|
4988
4999
|
<xsl:param name="date"/>
|
4989
5000
|
<xsl:param name="format" select="'short'"/>
|
@@ -5263,6 +5274,11 @@
|
|
5263
5274
|
<xsl:call-template name="getLang"/>
|
5264
5275
|
</xsl:variable>
|
5265
5276
|
|
5266
|
-
<xsl:
|
5277
|
+
<xsl:choose>
|
5278
|
+
<xsl:when test="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]">
|
5279
|
+
<xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
|
5280
|
+
</xsl:when>
|
5281
|
+
<xsl:otherwise><xsl:value-of select="$key"/></xsl:otherwise>
|
5282
|
+
</xsl:choose>
|
5267
5283
|
|
5268
5284
|
</xsl:template></xsl:stylesheet>
|
data/lib/isodoc/itu/metadata.rb
CHANGED
@@ -149,21 +149,55 @@ module IsoDoc
|
|
149
149
|
def ddMMMYYYY(isodate)
|
150
150
|
m = /(?<yr>\d\d\d\d)-(?<mo>\d\d)-(?<dd>\d\d)/.match isodate
|
151
151
|
return isodate unless m && m[:yr] && m[:mo] && m[:dd]
|
152
|
-
mmm = DateTime.parse(isodate).localize(@lang.to_sym)
|
153
|
-
to_additional_s("MMM")
|
152
|
+
mmm = DateTime.parse(isodate).localize(@lang.to_sym).to_additional_s("MMM")
|
154
153
|
@i18n.l10n("#{m[:dd]} #{mmm} #{m[:yr]}")
|
155
154
|
end
|
156
155
|
|
156
|
+
def ddMMMMYYYY(date1, date2)
|
157
|
+
m1 = /(?<yr>\d\d\d\d)-(?<mo>\d\d)-(?<dd>\d\d)/.match date1
|
158
|
+
m2 = /(?<yr>\d\d\d\d)-(?<mo>\d\d)-(?<dd>\d\d)/.match date2
|
159
|
+
if m1 && m1[:yr] && m1[:mo] && m1[:dd]
|
160
|
+
dd1 = m1[:dd].sub(/^0/, "")
|
161
|
+
if m2 && m2[:yr] && m2[:mo] && m2[:dd]
|
162
|
+
dd2 = m2[:dd].sub(/^0/, "")
|
163
|
+
if m1[:yr] == m2[:yr]
|
164
|
+
if m1[:mo] == m2[:mo]
|
165
|
+
@i18n.l10n("#{dd1}–#{dd2} #{months[m1[:mo].to_sym]} #{m1[:yr]}")
|
166
|
+
else
|
167
|
+
@i18n.l10n("#{dd1} #{months[m1[:mo].to_sym]} – "\
|
168
|
+
"#{dd2} #{months[m2[:mo].to_sym]} #{m1[:yr]}")
|
169
|
+
end
|
170
|
+
else
|
171
|
+
@i18n.l10n("#{dd1} #{months[m1[:mo].to_sym]} #{m1[:yr]} – "\
|
172
|
+
"#{dd2} #{months[m2[:mo].to_sym]} #{m2[:yr]}")
|
173
|
+
end
|
174
|
+
else
|
175
|
+
date2.nil? ? @i18n.l10n("#{dd1} #{months[m1[:mo].to_sym]} #{m1[:yr]}") : "#{date1}/#{date2}"
|
176
|
+
end
|
177
|
+
else
|
178
|
+
date2.nil? ? date1 : "#{date1}/#{date2}"
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
157
182
|
def techreport(isoxml, _out)
|
158
|
-
a = isoxml&.at(ns("//bibdata/ext/meeting"))&.text
|
159
|
-
|
160
|
-
set(:
|
183
|
+
if a = isoxml&.at(ns("//bibdata/ext/meeting"))&.text
|
184
|
+
set(:meeting, a)
|
185
|
+
set(:meeting_acronym, a)
|
186
|
+
end
|
187
|
+
a = isoxml&.at(ns("//bibdata/ext/meeting/@acronym"))&.text and set(:meeting_acronym, a)
|
188
|
+
a = isoxml&.at(ns("//bibdata/ext/meeting-place"))&.text and set(:meeting_place, a)
|
189
|
+
a = isoxml&.at(ns("//bibdata/ext/intended-type"))&.text and set(:intended_type, a)
|
161
190
|
a = isoxml&.at(ns("//bibdata/ext/source"))&.text and set(:source, a)
|
191
|
+
meeting(isoxml)
|
192
|
+
end
|
193
|
+
|
194
|
+
def meeting(isoxml)
|
195
|
+
resolution = isoxml&.at(ns("//bibdata/ext/doctype"))&.text == "resolution"
|
162
196
|
if o = isoxml&.at(ns("//bibdata/ext/meeting-date/on"))&.text
|
163
|
-
set(:meeting_date, ddMMMYYYY(o))
|
197
|
+
set(:meeting_date, resolution ? ddMMMMYYYY(o, nil) : ddMMMYYYY(o))
|
164
198
|
elsif f = isoxml&.at(ns("//bibdata/ext/meeting-date/from"))&.text
|
165
199
|
t = isoxml&.at(ns("//bibdata/ext/meeting-date/to"))&.text
|
166
|
-
set(:meeting_date, "#{ddMMMYYYY(f)}/#{ddMMMYYYY(t)}")
|
200
|
+
set(:meeting_date, resolution ? ddMMMMYYYY(f, t) : "#{ddMMMYYYY(f)}/#{ddMMMYYYY(t)}")
|
167
201
|
end
|
168
202
|
end
|
169
203
|
end
|
@@ -36,6 +36,11 @@ module IsoDoc
|
|
36
36
|
get_eref_linkend(f)
|
37
37
|
end
|
38
38
|
|
39
|
+
def note1(f)
|
40
|
+
return if f["type"] == "title-footnote"
|
41
|
+
super
|
42
|
+
end
|
43
|
+
|
39
44
|
def get_eref_linkend(node)
|
40
45
|
contents = non_locality_elems(node).select do |c|
|
41
46
|
!c.text? || /\S/.match(c)
|
@@ -43,8 +48,7 @@ module IsoDoc
|
|
43
48
|
return unless contents.empty?
|
44
49
|
link = anchor_linkend(node, docid_l10n(node["target"] || node["citeas"]))
|
45
50
|
link && !/^\[.*\]$/.match(link) and link = "[#{link}]"
|
46
|
-
link += eref_localities(node.xpath(ns("./locality | ./localityStack")),
|
47
|
-
link)
|
51
|
+
link += eref_localities(node.xpath(ns("./locality | ./localityStack")), link)
|
48
52
|
non_locality_elems(node).each { |n| n.remove }
|
49
53
|
node.add_child(link)
|
50
54
|
end
|
@@ -65,7 +69,28 @@ module IsoDoc
|
|
65
69
|
end
|
66
70
|
|
67
71
|
def bibdata_title(b)
|
68
|
-
b&.at(ns("./ext/doctype"))&.text
|
72
|
+
case b&.at(ns("./ext/doctype"))&.text
|
73
|
+
when "service-publication" then bibdata_title_service_population(b)
|
74
|
+
when "resolution" then bibdata_title_resolution(b)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
def bibdata_title_resolution(b)
|
79
|
+
num = b&.at(ns("./docnumber"))&.text
|
80
|
+
place = b&.at(ns("./ext/meeting-place"))&.text
|
81
|
+
ed = b&.at(ns("./edition"))&.text
|
82
|
+
rev = (ed && ed != "1") ? "#{@i18n.get["revision_abbreviation"]} " : ""
|
83
|
+
year = b&.at(ns("./ext/meeting-date/from | ./ext/meeting-date/on"))&.text&.gsub(/-.*$/, "")
|
84
|
+
num = b&.at(ns("./docnumber"))&.text
|
85
|
+
text = @i18n.l10n("#{@i18n.get['doctype_dict']['resolution'].upcase} #{num} (#{rev}#{place}, #{year})")
|
86
|
+
ins = b.at(ns("./title"))
|
87
|
+
ins.next = <<~END
|
88
|
+
<title language="#{@lang}" format="text/plain" type="resolution">#{text}</title>
|
89
|
+
<title language="#{@lang}" format="text/plain" type="resolution-placedate">#{place}, #{year}</title>
|
90
|
+
END
|
91
|
+
end
|
92
|
+
|
93
|
+
def bibdata_title_service_population(b)
|
69
94
|
date = b&.at(ns("./date[@type = 'published']"))&.text or return
|
70
95
|
text = l10n(@i18n.get["position_on"].sub(/%/, ddmmmmyyyy(date)))
|
71
96
|
ins = b.at(ns("./title"))
|
@@ -116,6 +141,27 @@ module IsoDoc
|
|
116
141
|
{group: "'"}
|
117
142
|
end
|
118
143
|
|
144
|
+
def clause1(f)
|
145
|
+
return super unless f&.at(ns("//bibdata/ext/doctype"))&.text == "resolution"
|
146
|
+
return super unless %w(sections bibliography).include? f.parent.name
|
147
|
+
return if @suppressheadingnumbers || f["unnumbered"]
|
148
|
+
t = f.at(ns("./title")) and t["depth"] = "1"
|
149
|
+
lbl = @xrefs.anchor(f['id'], :label, false) or return
|
150
|
+
f.elements.first.previous =
|
151
|
+
"<p align='center' keep-with-next='true'>#{@i18n.get['section'].upcase} #{lbl}</p>"
|
152
|
+
end
|
153
|
+
|
154
|
+
def annex1(f)
|
155
|
+
return super unless f&.at(ns("//bibdata/ext/doctype"))&.text == "resolution"
|
156
|
+
lbl = @xrefs.anchor(f['id'], :label)
|
157
|
+
subhead = (@i18n.l10n("(#{@i18n.get['to']} ") +
|
158
|
+
f.at(ns("//bibdata/title[@type = 'resolution']")).children.to_xml + @i18n.l10n(")"))
|
159
|
+
f.elements.first.previous = "<p align='center'>#{lbl}<br/>#{subhead}</p>"
|
160
|
+
if t = f.at(ns("./title"))
|
161
|
+
t.children = "<strong>#{t.children.to_xml}</strong>"
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
119
165
|
include Init
|
120
166
|
end
|
121
167
|
end
|
data/lib/isodoc/itu/xref.rb
CHANGED
@@ -3,6 +3,9 @@ require "fileutils"
|
|
3
3
|
|
4
4
|
module IsoDoc
|
5
5
|
module ITU
|
6
|
+
class Counter < IsoDoc::XrefGen::Counter
|
7
|
+
end
|
8
|
+
|
6
9
|
class Xref < IsoDoc::Xref
|
7
10
|
def initialize(lang, script, klass, labels, options)
|
8
11
|
super
|
@@ -10,23 +13,24 @@ module IsoDoc
|
|
10
13
|
end
|
11
14
|
|
12
15
|
def annex_name_lbl(clause, num)
|
13
|
-
lbl = clause["obligation"] == "informative" ?
|
14
|
-
|
15
|
-
|
16
|
+
lbl = clause["obligation"] == "informative" ? @labels["appendix"] : @labels["annex"]
|
17
|
+
@doctype == "resolution" ? l10n("#{lbl.upcase} #{num}") :
|
18
|
+
l10n("<strong>#{lbl} #{num}</strong>")
|
16
19
|
end
|
17
20
|
|
18
21
|
def annex_names(clause, num)
|
19
22
|
lbl = clause["obligation"] == "informative" ?
|
20
23
|
@labels["appendix"] : @labels["annex"]
|
21
24
|
@anchors[clause["id"]] =
|
22
|
-
{ label: annex_name_lbl(clause, num), type: "clause",
|
23
|
-
xref: l10n("#{lbl} #{num}"), level: 1, value: num }
|
25
|
+
{ label: annex_name_lbl(clause, num), type: "clause", xref: l10n("#{lbl} #{num}"), level: 1, value: num }
|
24
26
|
if a = single_annex_special_section(clause)
|
25
27
|
annex_names1(a, "#{num}", 1)
|
26
28
|
else
|
29
|
+
i = Counter.new
|
27
30
|
clause.xpath(ns("./clause | ./references | ./terms | ./definitions")).
|
28
|
-
|
29
|
-
|
31
|
+
each do |c|
|
32
|
+
i.increment(c)
|
33
|
+
annex_names1(c, "#{num}.#{i.print}", 2)
|
30
34
|
end
|
31
35
|
end
|
32
36
|
hierarchical_asset_names(clause, num)
|
@@ -34,42 +38,49 @@ module IsoDoc
|
|
34
38
|
|
35
39
|
def back_anchor_names(docxml)
|
36
40
|
super
|
37
|
-
if annexid =
|
38
|
-
docxml&.at(ns("//bibdata/ext/structuredidentifier/annexid"))&.text
|
41
|
+
if annexid = docxml&.at(ns("//bibdata/ext/structuredidentifier/annexid"))&.text
|
39
42
|
docxml.xpath(ns("//annex")).each { |c| annex_names(c, annexid) }
|
40
43
|
else
|
44
|
+
i = Counter.new(0, numerals: :roman)
|
41
45
|
docxml.xpath(ns("//annex[@obligation = 'informative']"))
|
42
|
-
.each_with_index do |c
|
43
|
-
|
46
|
+
.each_with_index do |c|
|
47
|
+
i.increment(c)
|
48
|
+
annex_names(c, i.print.upcase)
|
44
49
|
end
|
50
|
+
i = Counter.new("@")
|
45
51
|
docxml.xpath(ns("//annex[not(@obligation = 'informative')]"))
|
46
|
-
.
|
47
|
-
|
52
|
+
.each do |c|
|
53
|
+
i.increment(c)
|
54
|
+
i.increment(c) if i.print == "I"
|
55
|
+
annex_names(c, i.print)
|
48
56
|
end
|
49
57
|
end
|
50
58
|
end
|
51
59
|
|
52
60
|
def annex_names1(clause, num, level)
|
53
61
|
@anchors[clause["id"]] =
|
54
|
-
{ label: num, xref: l10n("#{@labels["annex_subclause"]} #{num}"),
|
62
|
+
{ label: num, xref: @doctype == "resolution" ? num : l10n("#{@labels["annex_subclause"]} #{num}"),
|
55
63
|
level: level, type: "clause" }
|
64
|
+
i = Counter.new
|
56
65
|
clause.xpath(ns("./clause | ./references | ./terms | ./definitions"))
|
57
|
-
.
|
58
|
-
|
66
|
+
.each do |c|
|
67
|
+
i.increment(c)
|
68
|
+
annex_names1(c, "#{num}.#{i.print}", level + 1)
|
59
69
|
end
|
60
70
|
end
|
61
71
|
|
62
72
|
def initial_anchor_names(d)
|
73
|
+
@doctype = d&.at(ns("//bibdata/ext/doctype"))&.text
|
63
74
|
d.xpath(ns("//boilerplate//clause")).each { |c| preface_names(c) }
|
64
75
|
d.xpath("//xmlns:preface/child::*").each { |c| preface_names(c) }
|
65
76
|
@hierarchical_assets ?
|
66
77
|
hierarchical_asset_names(d.xpath("//xmlns:preface/child::*"),
|
67
78
|
"Preface") :
|
68
79
|
sequential_asset_names(d.xpath("//xmlns:preface/child::*"))
|
69
|
-
n =
|
80
|
+
n = Counter.new
|
81
|
+
n = section_names(d.at(ns("//clause[@type = 'scope']")), n, 1)
|
70
82
|
n = section_names(d.at(ns(@klass.norm_ref_xpath)), n, 1)
|
71
|
-
n = section_names(d.at(ns("//sections/terms | "
|
72
|
-
"//sections/clause[descendant::terms]")), n, 1)
|
83
|
+
n = section_names(d.at(ns("//sections/terms | //sections/clause[descendant::terms]")), n, 1)
|
73
84
|
n = section_names(d.at(ns("//sections/definitions")), n, 1)
|
74
85
|
clause_names(d, n)
|
75
86
|
middle_section_asset_names(d)
|
@@ -103,35 +114,29 @@ module IsoDoc
|
|
103
114
|
end
|
104
115
|
label = c.print + (j.zero? ? "" : "#{hierfigsep}#{(96 + j).chr.to_s}")
|
105
116
|
next if t["id"].nil? || t["id"].empty?
|
106
|
-
@anchors[t["id"]] =
|
107
|
-
anchor_struct(label, nil, @labels["figure"], "figure", t["unnumbered"])
|
117
|
+
@anchors[t["id"]] = anchor_struct(label, nil, @labels["figure"], "figure", t["unnumbered"])
|
108
118
|
end
|
109
119
|
end
|
110
120
|
|
111
121
|
def hierarchical_figure_names(clause, num)
|
112
122
|
c = IsoDoc::XrefGen::Counter.new
|
113
123
|
j = 0
|
114
|
-
clause.xpath(ns(".//figure | "
|
115
|
-
".//sourcecode[not(ancestor::example)]")).each do |t|
|
124
|
+
clause.xpath(ns(".//figure | .//sourcecode[not(ancestor::example)]")).each do |t|
|
116
125
|
if t.parent.name == "figure" then j += 1
|
117
126
|
else
|
118
127
|
j = 0
|
119
128
|
c.increment(t)
|
120
129
|
end
|
121
|
-
label = "#{num}#{hiersep}#{c.print}" +
|
122
|
-
(j.zero? ? "" : "#{hierfigsep}#{(96 + j).chr.to_s}")
|
130
|
+
label = "#{num}#{hiersep}#{c.print}" + (j.zero? ? "" : "#{hierfigsep}#{(96 + j).chr.to_s}")
|
123
131
|
next if t["id"].nil? || t["id"].empty?
|
124
|
-
@anchors[t["id"]] =
|
125
|
-
anchor_struct(label, nil, @labels["figure"], "figure",
|
126
|
-
t["unnumbered"])
|
132
|
+
@anchors[t["id"]] = anchor_struct(label, nil, @labels["figure"], "figure", t["unnumbered"])
|
127
133
|
end
|
128
134
|
end
|
129
135
|
|
130
136
|
def sequential_formula_names(clause)
|
131
137
|
clause&.first&.xpath(ns(middle_sections))&.each do |c|
|
132
138
|
if c["id"] && @anchors[c["id"]]
|
133
|
-
hierarchical_formula_names(c, @anchors[c["id"]][:label] ||
|
134
|
-
@anchors[c["id"]][:xref] || "???")
|
139
|
+
hierarchical_formula_names(c, @anchors[c["id"]][:label] || @anchors[c["id"]][:xref] || "???")
|
135
140
|
else
|
136
141
|
hierarchical_formula_names(c, "???")
|
137
142
|
end
|
@@ -144,15 +149,13 @@ module IsoDoc
|
|
144
149
|
next if t["id"].nil? || t["id"].empty?
|
145
150
|
@anchors[t["id"]] = anchor_struct(
|
146
151
|
"#{num}-#{c.increment(t).print}", nil,
|
147
|
-
t["inequality"] ? @labels["inequality"] : @labels["formula"],
|
148
|
-
"formula", t["unnumbered"])
|
152
|
+
t["inequality"] ? @labels["inequality"] : @labels["formula"], "formula", t["unnumbered"])
|
149
153
|
end
|
150
154
|
end
|
151
155
|
|
152
156
|
def reference_names(ref)
|
153
157
|
super
|
154
|
-
@anchors[ref["id"]] =
|
155
|
-
{ xref: @anchors[ref["id"]][:xref].sub(/^\[/, '').sub(/\]$/, '') }
|
158
|
+
@anchors[ref["id"]] = { xref: @anchors[ref["id"]][:xref].sub(/^\[/, '').sub(/\]$/, '') }
|
156
159
|
end
|
157
160
|
|
158
161
|
def termnote_anchor_names(docxml)
|
@@ -163,14 +166,65 @@ module IsoDoc
|
|
163
166
|
return if n["id"].nil? || n["id"].empty?
|
164
167
|
idx = notes.size == 1 ? "" : " #{c.increment(n).print}"
|
165
168
|
@anchors[n["id"]] =
|
166
|
-
{ label: termnote_label(idx).strip, type: "termnote",
|
167
|
-
|
168
|
-
xref: l10n("#{anchor(t['id'], :xref)}, "\
|
169
|
-
"#{@labels["note_xref"]} #{c.print}") }
|
170
|
-
|
169
|
+
{ label: termnote_label(idx).strip, type: "termnote", value: idx,
|
170
|
+
xref: l10n("#{anchor(t['id'], :xref)}, #{@labels["note_xref"]} #{c.print}") }
|
171
171
|
end
|
172
172
|
end
|
173
173
|
end
|
174
|
+
|
175
|
+
def clause_names(docxml, sect_num)
|
176
|
+
docxml.xpath(ns("//sections/clause[not(@unnumbered = 'true')][not(@type = 'scope')]")).
|
177
|
+
each do |c|
|
178
|
+
section_names(c, sect_num, 1)
|
179
|
+
end
|
180
|
+
docxml.xpath(ns("//sections/clause[@unnumbered = 'true']")).each do |c|
|
181
|
+
unnumbered_section_names(c, 1)
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
185
|
+
def section_names(clause, num, lvl)
|
186
|
+
return num if clause.nil?
|
187
|
+
num.increment(clause)
|
188
|
+
lbl = @doctype == "resolution" ? @labels["section"] : @labels["clause"]
|
189
|
+
@anchors[clause["id"]] =
|
190
|
+
{ label: num.print, xref: l10n("#{lbl} #{num.print}"), level: lvl, type: "clause" }
|
191
|
+
i = Counter.new()
|
192
|
+
clause.xpath(ns(SUBCLAUSES)).each do |c|
|
193
|
+
i.increment(c)
|
194
|
+
section_names1(c, "#{num.print}.#{i.print}", lvl + 1)
|
195
|
+
end
|
196
|
+
num
|
197
|
+
end
|
198
|
+
|
199
|
+
def section_names1(clause, num, level)
|
200
|
+
@anchors[clause["id"]] =
|
201
|
+
{ label: num, level: level,
|
202
|
+
xref: @doctype == "resolution" ? num : l10n("#{@labels["clause"]} #{num}") }
|
203
|
+
i = Counter.new()
|
204
|
+
clause.xpath(ns(SUBCLAUSES)).each do |c|
|
205
|
+
i.increment(c)
|
206
|
+
section_names1(c, "#{num}.#{i.print}", level + 1)
|
207
|
+
end
|
208
|
+
end
|
209
|
+
|
210
|
+
def unnumbered_section_names(clause, lvl)
|
211
|
+
return if clause.nil?
|
212
|
+
lbl = clause&.at(ns("./title"))&.text || "[#{clause["id"]}]"
|
213
|
+
@anchors[clause["id"]] =
|
214
|
+
{ label: lbl, xref: l10n(%{"#{lbl}"}), level: lvl, type: "clause" }
|
215
|
+
clause.xpath(ns(SUBCLAUSES)).each_with_index do |c, i|
|
216
|
+
unnumbered_section_names1(c, lvl + 1)
|
217
|
+
end
|
218
|
+
end
|
219
|
+
|
220
|
+
def unnumbered_section_names1(clause, level)
|
221
|
+
lbl = clause&.at(ns("./title"))&.text || "[#{clause["id"]}]"
|
222
|
+
@anchors[clause["id"]] =
|
223
|
+
{ label: lbl, xref: l10n(%{"#{lbl}"}), level: level, type: "clause" }
|
224
|
+
clause.xpath(ns(SUBCLAUSES)).each do |c|
|
225
|
+
unnumbered_section_names1(c, level + 1)
|
226
|
+
end
|
227
|
+
end
|
174
228
|
end
|
175
229
|
end
|
176
230
|
end
|