metanorma-itu 2.2.15 → 2.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/isodoc/itu/base_convert.rb +18 -66
- data/lib/isodoc/itu/html_convert.rb +5 -10
- data/lib/isodoc/itu/i18n-ar.yaml +1 -0
- data/lib/isodoc/itu/i18n-de.yaml +1 -0
- data/lib/isodoc/itu/i18n-en.yaml +1 -0
- data/lib/isodoc/itu/i18n-es.yaml +1 -0
- data/lib/isodoc/itu/i18n-fr.yaml +1 -0
- data/lib/isodoc/itu/i18n-ru.yaml +1 -0
- data/lib/isodoc/itu/i18n-zh-Hans.yaml +1 -0
- data/lib/isodoc/itu/itu.implementers-guide.xsl +135 -57
- data/lib/isodoc/itu/itu.in-force.xsl +135 -57
- data/lib/isodoc/itu/itu.recommendation-annex.xsl +135 -57
- data/lib/isodoc/itu/itu.recommendation-supplement.xsl +135 -57
- data/lib/isodoc/itu/itu.recommendation.xsl +135 -57
- data/lib/isodoc/itu/itu.resolution.xsl +135 -57
- data/lib/isodoc/itu/itu.service-publication.xsl +135 -57
- data/lib/isodoc/itu/itu.technical-paper.xsl +135 -57
- data/lib/isodoc/itu/itu.technical-report.xsl +135 -57
- data/lib/isodoc/itu/presentation_bibdata.rb +1 -1
- data/lib/isodoc/itu/presentation_preface.rb +78 -0
- data/lib/isodoc/itu/presentation_xml_convert.rb +62 -59
- data/lib/isodoc/itu/word_convert.rb +0 -27
- data/lib/isodoc/itu/xref.rb +4 -54
- data/lib/isodoc/itu/xref_section.rb +55 -13
- data/lib/metanorma/itu/isodoc.rng +29 -4
- data/lib/metanorma/itu/version.rb +1 -1
- data/metanorma-itu.gemspec +1 -1
- metadata +5 -4
@@ -34,17 +34,19 @@
|
|
34
34
|
<xsl:variable name="contents_">
|
35
35
|
<contents>
|
36
36
|
<!-- <xsl:apply-templates select="/itu:itu-standard/itu:preface/node()" mode="contents"/> -->
|
37
|
-
<xsl:apply-templates select="/itu:itu-standard/itu:sections/itu:clause[@type='scope']" mode="contents"/>
|
37
|
+
<!-- <xsl:apply-templates select="/itu:itu-standard/itu:sections/itu:clause[@type='scope']" mode="contents" /> -->
|
38
38
|
|
39
39
|
<!-- Normative references -->
|
40
|
-
<xsl:apply-templates select="/itu:itu-standard/itu:bibliography/itu:references[@normative='true']" mode="contents"/>
|
41
|
-
|
42
|
-
<xsl:apply-templates select="/itu:itu-standard/itu:sections/*[not(@type='scope')]" mode="contents"/>
|
43
|
-
|
44
|
-
<xsl:apply-templates select="/itu:itu-standard/itu:annex" mode="contents"/>
|
40
|
+
<!-- <xsl:apply-templates select="/itu:itu-standard/itu:bibliography/itu:references[@normative='true']" mode="contents" />
|
41
|
+
|
42
|
+
<xsl:apply-templates select="/itu:itu-standard/itu:sections/*[not(@type='scope')]" mode="contents" />
|
43
|
+
|
44
|
+
<xsl:apply-templates select="/itu:itu-standard/itu:annex" mode="contents"/> -->
|
45
45
|
|
46
46
|
<!-- Bibliography -->
|
47
|
-
<xsl:apply-templates select="/itu:itu-standard/itu:bibliography/itu:references[not(@normative='true')]" mode="contents"/>
|
47
|
+
<!-- <xsl:apply-templates select="/itu:itu-standard/itu:bibliography/itu:references[not(@normative='true')]" mode="contents"/> -->
|
48
|
+
|
49
|
+
<xsl:call-template name="processMainSectionsDefault_Contents"/>
|
48
50
|
|
49
51
|
<xsl:apply-templates select="//itu:table" mode="contents"/>
|
50
52
|
|
@@ -1069,16 +1071,16 @@
|
|
1069
1071
|
|
1070
1072
|
<fo:flow flow-name="xsl-region-body">
|
1071
1073
|
|
1072
|
-
<xsl:if test="$doctype != 'service-publication'">
|
1073
|
-
<fo:block-container font-size="14pt">
|
1074
|
+
<!-- <xsl:if test="$doctype != 'service-publication' and 1 = 2">
|
1075
|
+
<fo:block-container font-size="14pt" >
|
1074
1076
|
<xsl:choose>
|
1075
1077
|
<xsl:when test="$doctype = 'resolution'">
|
1076
1078
|
<fo:block text-align="center">
|
1077
1079
|
<xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:title[@type='resolution' and @language = $lang]"/>
|
1078
1080
|
</fo:block>
|
1079
1081
|
</xsl:when>
|
1080
|
-
<xsl:when
|
1081
|
-
<xsl:when
|
1082
|
+
<xsl:when test="$doctype = 'implementers-guide'"></xsl:when>
|
1083
|
+
<xsl:when test="$doctype = 'recommendation-supplement'">
|
1082
1084
|
<fo:block font-weight="bold">
|
1083
1085
|
<xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:docidentifier[@type = 'ITU-Supplement-Internal']"/>
|
1084
1086
|
</fo:block>
|
@@ -1086,30 +1088,30 @@
|
|
1086
1088
|
<xsl:otherwise>
|
1087
1089
|
<fo:block font-weight="bold">
|
1088
1090
|
<xsl:value-of select="$doctypeTitle"/>
|
1089
|
-
<xsl:text
|
1091
|
+
<xsl:text> </xsl:text>
|
1090
1092
|
<xsl:value-of select="$docname"/>
|
1091
1093
|
</fo:block>
|
1092
1094
|
</xsl:otherwise>
|
1093
1095
|
</xsl:choose>
|
1094
|
-
|
1096
|
+
|
1095
1097
|
<fo:block font-weight="bold" text-align="center" margin-top="15pt" margin-bottom="15pt" role="H1">
|
1096
1098
|
<xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:title[@type = 'main' and @language = $lang]"/>
|
1097
|
-
|
1099
|
+
|
1098
1100
|
<xsl:variable name="subtitle" select="/itu:itu-standard/itu:bibdata/itu:title[@type = 'subtitle' and @language = $lang]"/>
|
1099
1101
|
<xsl:if test="$subtitle != ''">
|
1100
1102
|
<fo:block margin-top="18pt" font-weight="normal" font-style="italic">
|
1101
|
-
<xsl:if test="$lang = 'ar'">
|
1103
|
+
<xsl:if test="$lang = 'ar'">
|
1102
1104
|
<xsl:attribute name="font-style">normal</xsl:attribute>
|
1103
1105
|
</xsl:if>
|
1104
1106
|
<xsl:value-of select="$subtitle"/>
|
1105
|
-
</fo:block>
|
1107
|
+
</fo:block>
|
1106
1108
|
</xsl:if>
|
1107
|
-
|
1109
|
+
|
1108
1110
|
<xsl:variable name="resolution-placedate" select="/itu:itu-standard/itu:bibdata/itu:title[@type = 'resolution-placedate' and @language = $lang]"/>
|
1109
1111
|
<xsl:if test="$doctype = 'resolution' and $resolution-placedate != ''">
|
1110
1112
|
<fo:block font-size="11pt" margin-top="6pt" font-weight="normal">
|
1111
1113
|
<fo:inline font-style="italic">
|
1112
|
-
<xsl:if test="$lang = 'ar'">
|
1114
|
+
<xsl:if test="$lang = 'ar'">
|
1113
1115
|
<xsl:attribute name="font-style">normal</xsl:attribute>
|
1114
1116
|
</xsl:if>
|
1115
1117
|
<xsl:text>(</xsl:text><xsl:value-of select="$resolution-placedate"/><xsl:text>)</xsl:text>
|
@@ -1119,22 +1121,25 @@
|
|
1119
1121
|
</xsl:if>
|
1120
1122
|
</fo:block>
|
1121
1123
|
</fo:block-container>
|
1122
|
-
</xsl:if>
|
1124
|
+
</xsl:if> -->
|
1123
1125
|
|
1124
1126
|
<!-- Clause(s) -->
|
1125
1127
|
<fo:block>
|
1126
1128
|
<!-- Scope -->
|
1127
|
-
<xsl:apply-templates select="/itu:itu-standard/itu:sections/itu:clause[@type='scope']"/>
|
1129
|
+
<!-- <xsl:apply-templates select="/itu:itu-standard/itu:sections/itu:clause[@type='scope']" /> -->
|
1128
1130
|
|
1129
1131
|
<!-- Normative references -->
|
1130
|
-
<xsl:apply-templates select="/itu:itu-standard/itu:bibliography/itu:references[@normative='true']"/>
|
1132
|
+
<!-- <xsl:apply-templates select="/itu:itu-standard/itu:bibliography/itu:references[@normative='true']" />
|
1133
|
+
|
1134
|
+
<xsl:apply-templates select="/itu:itu-standard/itu:sections/*[not(@type='scope')]" />
|
1135
|
+
|
1136
|
+
<xsl:apply-templates select="/itu:itu-standard/itu:annex"/> -->
|
1131
1137
|
|
1132
|
-
|
1138
|
+
<!-- Bibliography -->
|
1139
|
+
<!-- <xsl:apply-templates select="/itu:itu-standard/itu:bibliography/itu:references[not(@normative='true')]"/> -->
|
1133
1140
|
|
1134
|
-
<xsl:
|
1141
|
+
<xsl:call-template name="processMainSectionsDefault"/>
|
1135
1142
|
|
1136
|
-
<!-- Bibliography -->
|
1137
|
-
<xsl:apply-templates select="/itu:itu-standard/itu:bibliography/itu:references[not(@normative='true')]"/> <!-- @id = 'bibliography' -->
|
1138
1143
|
</fo:block>
|
1139
1144
|
|
1140
1145
|
</fo:flow>
|
@@ -1286,6 +1291,37 @@
|
|
1286
1291
|
</fo:block>
|
1287
1292
|
</xsl:template>
|
1288
1293
|
|
1294
|
+
<xsl:template match="itu:clause[@type = 'keyword']" priority="4"/>
|
1295
|
+
|
1296
|
+
<xsl:template match="itu:sections/itu:p[@class = 'zzSTDTitle1']" priority="4">
|
1297
|
+
<fo:block font-size="14pt">
|
1298
|
+
<xsl:choose>
|
1299
|
+
<xsl:when test="$doctype = 'resolution'">
|
1300
|
+
<xsl:attribute name="text-align">center</xsl:attribute>
|
1301
|
+
</xsl:when>
|
1302
|
+
<xsl:otherwise>
|
1303
|
+
<xsl:attribute name="font-weight">bold</xsl:attribute>
|
1304
|
+
</xsl:otherwise>
|
1305
|
+
</xsl:choose>
|
1306
|
+
<xsl:apply-templates/>
|
1307
|
+
</fo:block>
|
1308
|
+
</xsl:template>
|
1309
|
+
|
1310
|
+
<xsl:template match="itu:sections/itu:p[@class = 'zzSTDTitle2']" priority="4">
|
1311
|
+
<fo:block font-size="14pt" font-weight="bold" text-align="center" margin-top="15pt" margin-bottom="15pt" role="H1">
|
1312
|
+
<xsl:if test="$lang = 'ar'"> <!-- to prevent rendering `###` due the missing Arabic glyphs in the italic font (Times New Roman) -->
|
1313
|
+
<xsl:attribute name="font-style">normal</xsl:attribute>
|
1314
|
+
</xsl:if>
|
1315
|
+
<!-- Example: <p align="center" class="zzSTDTitle2" displayorder="4"><em>(Hammamet, 2016</em>) -->
|
1316
|
+
<xsl:if test="@align = 'center'">
|
1317
|
+
<xsl:attribute name="font-size">11pt</xsl:attribute>
|
1318
|
+
<xsl:attribute name="margin-top">6pt</xsl:attribute>
|
1319
|
+
<xsl:attribute name="font-weight">normal</xsl:attribute>
|
1320
|
+
</xsl:if>
|
1321
|
+
<xsl:apply-templates/>
|
1322
|
+
</fo:block>
|
1323
|
+
</xsl:template>
|
1324
|
+
|
1289
1325
|
<xsl:template match="node()">
|
1290
1326
|
<xsl:apply-templates/>
|
1291
1327
|
</xsl:template>
|
@@ -1740,25 +1776,25 @@
|
|
1740
1776
|
</xsl:template> -->
|
1741
1777
|
|
1742
1778
|
<!-- footnotes for title -->
|
1743
|
-
<xsl:template match="itu:bibdata/itu:note[@type = 'title-footnote']" mode="title_footnote">
|
1779
|
+
<!-- <xsl:template match="itu:bibdata/itu:note[@type = 'title-footnote']" mode="title_footnote">
|
1744
1780
|
<xsl:variable name="number" select="position()"/>
|
1745
1781
|
<fo:footnote>
|
1746
1782
|
<fo:inline font-size="60%" keep-with-previous.within-line="always" vertical-align="super">
|
1747
1783
|
<fo:basic-link internal-destination="title_footnote_{$number}" fox:alt-text="titlefootnote {$number}">
|
1748
1784
|
<xsl:value-of select="$number"/>
|
1749
1785
|
</fo:basic-link>
|
1750
|
-
<xsl:if test="position() != last()">,</xsl:if
|
1786
|
+
<xsl:if test="position() != last()">,</xsl:if>
|
1751
1787
|
</fo:inline>
|
1752
1788
|
<fo:footnote-body>
|
1753
1789
|
<fo:block font-size="11pt" margin-bottom="12pt" text-align="justify">
|
1754
1790
|
<fo:inline id="title_footnote_{$number}" font-size="85%" padding-right="2mm" keep-with-next.within-line="always" baseline-shift="30%">
|
1755
1791
|
<xsl:value-of select="$number"/>
|
1756
1792
|
</fo:inline>
|
1757
|
-
<xsl:apply-templates/>
|
1793
|
+
<xsl:apply-templates />
|
1758
1794
|
</fo:block>
|
1759
1795
|
</fo:footnote-body>
|
1760
1796
|
</fo:footnote>
|
1761
|
-
</xsl:template>
|
1797
|
+
</xsl:template> -->
|
1762
1798
|
|
1763
1799
|
<xsl:template match="*[local-name()='tt']" priority="2">
|
1764
1800
|
<xsl:variable name="element-name">
|
@@ -2455,11 +2491,26 @@
|
|
2455
2491
|
<xsl:value-of select="$font_extended"/><xsl:text>, </xsl:text>
|
2456
2492
|
</xsl:if>
|
2457
2493
|
|
2458
|
-
<xsl:
|
2494
|
+
<xsl:variable name="font_family" select="."/>
|
2459
2495
|
|
2460
|
-
<xsl:
|
2461
|
-
<xsl:
|
2462
|
-
|
2496
|
+
<xsl:choose>
|
2497
|
+
<xsl:when test="$additional_fonts = ''">
|
2498
|
+
<xsl:value-of select="$font_family"/>
|
2499
|
+
</xsl:when>
|
2500
|
+
<xsl:otherwise> <!-- $additional_fonts != '' -->
|
2501
|
+
<xsl:choose>
|
2502
|
+
<xsl:when test="contains($font_family, ',')">
|
2503
|
+
<xsl:value-of select="substring-before($font_family, ',')"/>
|
2504
|
+
<xsl:text>, </xsl:text><xsl:value-of select="$additional_fonts"/>
|
2505
|
+
<xsl:text>, </xsl:text><xsl:value-of select="substring-after($font_family, ',')"/>
|
2506
|
+
</xsl:when>
|
2507
|
+
<xsl:otherwise>
|
2508
|
+
<xsl:value-of select="$font_family"/>
|
2509
|
+
<xsl:text>, </xsl:text><xsl:value-of select="$additional_fonts"/>
|
2510
|
+
</xsl:otherwise>
|
2511
|
+
</xsl:choose>
|
2512
|
+
</xsl:otherwise>
|
2513
|
+
</xsl:choose>
|
2463
2514
|
</xsl:attribute>
|
2464
2515
|
</xsl:when>
|
2465
2516
|
<xsl:otherwise>
|
@@ -5021,21 +5072,21 @@
|
|
5021
5072
|
|
5022
5073
|
<xsl:template match="*[local-name()='table']/*[local-name()='note' or local-name() = 'example']" priority="2">
|
5023
5074
|
|
5024
|
-
|
5075
|
+
<fo:block xsl:use-attribute-sets="table-note-style">
|
5025
5076
|
|
5026
|
-
|
5077
|
+
<xsl:call-template name="refine_table-note-style"/>
|
5027
5078
|
|
5028
|
-
|
5029
|
-
|
5079
|
+
<!-- Table's note/example name (NOTE, for example) -->
|
5080
|
+
<fo:inline xsl:use-attribute-sets="table-note-name-style">
|
5030
5081
|
|
5031
|
-
|
5082
|
+
<xsl:call-template name="refine_table-note-name-style"/>
|
5032
5083
|
|
5033
|
-
|
5084
|
+
<xsl:apply-templates select="*[local-name() = 'name']"/>
|
5034
5085
|
|
5035
|
-
|
5086
|
+
</fo:inline>
|
5036
5087
|
|
5037
|
-
|
5038
|
-
|
5088
|
+
<xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
|
5089
|
+
</fo:block>
|
5039
5090
|
|
5040
5091
|
</xsl:template> <!-- table/note -->
|
5041
5092
|
|
@@ -6114,6 +6165,9 @@
|
|
6114
6165
|
<!-- END Definition List -->
|
6115
6166
|
<!-- ===================== -->
|
6116
6167
|
|
6168
|
+
<!-- default: ignore title in sections/p -->
|
6169
|
+
<xsl:template match="*[local-name() = 'sections']/*[local-name() = 'p'][starts-with(@class, 'zzSTDTitle')]" priority="3"/>
|
6170
|
+
|
6117
6171
|
<!-- ========================= -->
|
6118
6172
|
<!-- Rich text formatting -->
|
6119
6173
|
<!-- ========================= -->
|
@@ -8170,8 +8224,12 @@
|
|
8170
8224
|
<xsl:variable name="isAdded" select="../@added"/>
|
8171
8225
|
<xsl:variable name="isDeleted" select="../@deleted"/>
|
8172
8226
|
<xsl:choose>
|
8173
|
-
<xsl:when test="ancestor::*[local-name() = 'title']">
|
8227
|
+
<xsl:when test="ancestor::*[local-name() = 'title'] or not(parent::*[local-name() = 'figure']) or parent::*[local-name() = 'p']">
|
8174
8228
|
<fo:inline padding-left="1mm" padding-right="1mm">
|
8229
|
+
<xsl:if test="not(parent::*[local-name() = 'figure']) or parent::*[local-name() = 'p']">
|
8230
|
+
<xsl:attribute name="padding-left">0mm</xsl:attribute>
|
8231
|
+
<xsl:attribute name="padding-right">0mm</xsl:attribute>
|
8232
|
+
</xsl:if>
|
8175
8233
|
<xsl:variable name="src">
|
8176
8234
|
<xsl:call-template name="image_src"/>
|
8177
8235
|
</xsl:variable>
|
@@ -8204,25 +8262,45 @@
|
|
8204
8262
|
<fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style">
|
8205
8263
|
<xsl:if test="not(@mimetype = 'image/svg+xml') and ../*[local-name() = 'name'] and not(ancestor::*[local-name() = 'table'])">
|
8206
8264
|
|
8207
|
-
<xsl:
|
8208
|
-
<xsl:
|
8209
|
-
<xsl:
|
8210
|
-
|
8211
|
-
|
8212
|
-
</xsl:variable>
|
8265
|
+
<xsl:if test="@width != '' and @width != 'auto' and @width != 'text-width' and @width != 'full-page-width' and @width != 'narrow'">
|
8266
|
+
<xsl:attribute name="width">
|
8267
|
+
<xsl:value-of select="@width"/>
|
8268
|
+
</xsl:attribute>
|
8269
|
+
</xsl:if>
|
8213
8270
|
|
8214
|
-
<xsl:
|
8271
|
+
<xsl:if test="@height != '' and @height != 'auto'">
|
8272
|
+
<xsl:attribute name="height">
|
8273
|
+
<xsl:value-of select="@height"/>
|
8274
|
+
</xsl:attribute>
|
8275
|
+
</xsl:if>
|
8215
8276
|
|
8216
|
-
|
8277
|
+
<xsl:choose>
|
8278
|
+
<xsl:when test="@width != '' and @width != 'auto' and @height != '' and @height != 'auto'">
|
8279
|
+
<xsl:attribute name="scaling">non-uniform</xsl:attribute>
|
8280
|
+
</xsl:when>
|
8281
|
+
<xsl:otherwise>
|
8217
8282
|
|
8218
|
-
|
8283
|
+
<xsl:variable name="img_src">
|
8284
|
+
<xsl:choose>
|
8285
|
+
<xsl:when test="not(starts-with(@src, 'data:'))"><xsl:value-of select="concat($basepath, @src)"/></xsl:when>
|
8286
|
+
<xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
|
8287
|
+
</xsl:choose>
|
8288
|
+
</xsl:variable>
|
8219
8289
|
|
8220
|
-
|
8221
|
-
<xsl:if test="number($scale) < 100">
|
8290
|
+
<xsl:variable name="image_width_effective">
|
8222
8291
|
|
8223
|
-
|
8292
|
+
<xsl:value-of select="$width_effective"/>
|
8224
8293
|
|
8225
|
-
|
8294
|
+
</xsl:variable>
|
8295
|
+
|
8296
|
+
<xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $image_width_effective, $height_effective)"/>
|
8297
|
+
<xsl:if test="number($scale) < 100">
|
8298
|
+
|
8299
|
+
<xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
|
8300
|
+
|
8301
|
+
</xsl:if>
|
8302
|
+
</xsl:otherwise>
|
8303
|
+
</xsl:choose>
|
8226
8304
|
|
8227
8305
|
</xsl:if>
|
8228
8306
|
|
@@ -11911,7 +11989,7 @@
|
|
11911
11989
|
<xsl:template match="*[local-name() = 'span']" mode="update_xml_step1">
|
11912
11990
|
<xsl:apply-templates mode="update_xml_step1"/>
|
11913
11991
|
</xsl:template>
|
11914
|
-
<xsl:template match="*[local-name() = 'sourcecode']//*[local-name() = 'span'][@class]" mode="update_xml_step1" priority="2">
|
11992
|
+
<xsl:template match="*[local-name() = 'sections']/*[local-name() = 'p'][starts-with(@class, 'zzSTDTitle')]/*[local-name() = 'span'][@class] | *[local-name() = 'sourcecode']//*[local-name() = 'span'][@class]" mode="update_xml_step1" priority="2">
|
11915
11993
|
<xsl:copy>
|
11916
11994
|
<xsl:copy-of select="@*"/>
|
11917
11995
|
<xsl:apply-templates mode="update_xml_step1"/>
|
@@ -40,7 +40,7 @@ module IsoDoc
|
|
40
40
|
|
41
41
|
def bibdata_title_service_population(bib)
|
42
42
|
date = bib&.at(ns("./date[@type = 'published']"))&.text or return
|
43
|
-
text = l10n(@i18n.get["position_on"].sub(
|
43
|
+
text = l10n(@i18n.get["position_on"].sub("%", ddmmmmyyyy(date)))
|
44
44
|
ins = bib.at(ns("./title"))
|
45
45
|
ins.next = <<~INS
|
46
46
|
<title language="#{@lang}" format="text/plain" type="position-sp">#{text}</title>
|
@@ -0,0 +1,78 @@
|
|
1
|
+
module IsoDoc
|
2
|
+
module ITU
|
3
|
+
class PresentationXMLConvert < IsoDoc::PresentationXMLConvert
|
4
|
+
def insert_preface_sections(docxml)
|
5
|
+
x = insert_editors_clause(docxml) and
|
6
|
+
editors_insert_pt(docxml).next = x
|
7
|
+
end
|
8
|
+
|
9
|
+
def editors_insert_pt(docxml)
|
10
|
+
docxml.at(ns("//preface")) || docxml.at(ns("//sections"))
|
11
|
+
.add_previous_sibling("<preface> </preface>").first
|
12
|
+
ins = docxml.at(ns("//preface/acknolwedgements")) and return ins
|
13
|
+
docxml.at(ns("//preface")).children[-1]
|
14
|
+
end
|
15
|
+
|
16
|
+
def insert_editors_clause(doc)
|
17
|
+
ret = extract_editors(doc) or return
|
18
|
+
eds = ret[:names].each_with_object([]).with_index do |(_x, acc), i|
|
19
|
+
acc << { name: ret[:names][i], affiliation: ret[:affiliations][i],
|
20
|
+
email: ret[:emails][i] }
|
21
|
+
end
|
22
|
+
editors_clause(eds)
|
23
|
+
end
|
24
|
+
|
25
|
+
def extract_editors(doc)
|
26
|
+
e = doc.xpath(ns("//bibdata/contributor[role/@type = 'editor']/person"))
|
27
|
+
e.empty? and return
|
28
|
+
{ names: @meta.extract_person_names(e),
|
29
|
+
affiliations: @meta.extract_person_affiliations(e),
|
30
|
+
emails: e.reduce([]) { |ret, p| ret << p.at(ns("./email"))&.text } }
|
31
|
+
end
|
32
|
+
|
33
|
+
def editors_clause(eds)
|
34
|
+
ed_lbl = @i18n.inflect(@i18n.get["editor_full"],
|
35
|
+
number: eds.size > 1 ? "pl" : "sg")
|
36
|
+
ed_lbl &&= l10n("#{ed_lbl.capitalize}:")
|
37
|
+
mail_lbl = l10n("#{@i18n.get['email']}: ")
|
38
|
+
ret = <<~SUBMITTING
|
39
|
+
<clause id="_#{UUIDTools::UUID.random_create}" type="editors">
|
40
|
+
<table id="_#{UUIDTools::UUID.random_create}" unnumbered="true"><tbody>
|
41
|
+
SUBMITTING
|
42
|
+
ret += editor_table_entries(eds, ed_lbl, mail_lbl)
|
43
|
+
"#{ret}</tbody></table></clause>"
|
44
|
+
end
|
45
|
+
|
46
|
+
def editor_table_entries(eds, ed_lbl, mail_lbl)
|
47
|
+
eds.each_with_index.with_object([]) do |(n, i), m|
|
48
|
+
mail = ""
|
49
|
+
n[:email] and
|
50
|
+
mail = "#{mail_lbl}<link target='mailto:#{n[:email]}'>" \
|
51
|
+
"#{n[:email]}</link>"
|
52
|
+
aff = n[:affiliation].empty? ? "" : "<br/>#{n[:affiliation]}"
|
53
|
+
th = "<th>#{i.zero? ? ed_lbl : ''}</th>"
|
54
|
+
m << "<tr>#{th}<td>#{n[:name]}#{aff}</td><td>#{mail}</td></tr>"
|
55
|
+
end.join("\n")
|
56
|
+
end
|
57
|
+
|
58
|
+
def rearrange_clauses(docxml)
|
59
|
+
super
|
60
|
+
k = keywords(docxml) or return
|
61
|
+
if a = docxml.at(ns("//preface/abstract"))
|
62
|
+
a.next = k
|
63
|
+
elsif a = docxml.at(ns("//preface"))
|
64
|
+
a.children.first.previous = k
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
def keywords(_docxml)
|
69
|
+
kw = @meta.get[:keywords]
|
70
|
+
kw.nil? || kw.empty? and return
|
71
|
+
"<clause type='keyword'><title>#{@i18n.keywords}</title>" \
|
72
|
+
"<p>#{kw.join(', ')}.</p>"
|
73
|
+
end
|
74
|
+
|
75
|
+
include Init
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
@@ -3,6 +3,7 @@ require "roman-numerals"
|
|
3
3
|
require "isodoc"
|
4
4
|
require_relative "../../relaton/render/general"
|
5
5
|
require_relative "presentation_bibdata"
|
6
|
+
require_relative "presentation_preface"
|
6
7
|
|
7
8
|
module IsoDoc
|
8
9
|
module ITU
|
@@ -17,60 +18,6 @@ module IsoDoc
|
|
17
18
|
super
|
18
19
|
end
|
19
20
|
|
20
|
-
def insert_preface_sections(docxml)
|
21
|
-
x = insert_editors_clause(docxml) and
|
22
|
-
editors_insert_pt(docxml).next = x
|
23
|
-
end
|
24
|
-
|
25
|
-
def editors_insert_pt(docxml)
|
26
|
-
docxml.at(ns("//preface")) || docxml.at(ns("//sections"))
|
27
|
-
.add_previous_sibling("<preface> </preface>").first
|
28
|
-
ins = docxml.at(ns("//preface/acknolwedgements")) and return ins
|
29
|
-
docxml.at(ns("//preface")).children[-1]
|
30
|
-
end
|
31
|
-
|
32
|
-
def insert_editors_clause(doc)
|
33
|
-
ret = extract_editors(doc) or return
|
34
|
-
eds = ret[:names].each_with_object([]).with_index do |(_x, acc), i|
|
35
|
-
acc << { name: ret[:names][i], affiliation: ret[:affiliations][i],
|
36
|
-
email: ret[:emails][i] }
|
37
|
-
end
|
38
|
-
editors_clause(eds)
|
39
|
-
end
|
40
|
-
|
41
|
-
def extract_editors(doc)
|
42
|
-
e = doc.xpath(ns("//bibdata/contributor[role/@type = 'editor']/person"))
|
43
|
-
e.empty? and return
|
44
|
-
{ names: @meta.extract_person_names(e),
|
45
|
-
affiliations: @meta.extract_person_affiliations(e),
|
46
|
-
emails: e.reduce([]) { |ret, p| ret << p.at(ns("./email"))&.text } }
|
47
|
-
end
|
48
|
-
|
49
|
-
def editors_clause(eds)
|
50
|
-
ed_lbl = @i18n.inflect(@i18n.get["editor_full"],
|
51
|
-
number: eds.size > 1 ? "pl" : "sg")
|
52
|
-
ed_lbl &&= l10n("#{ed_lbl.capitalize}:")
|
53
|
-
mail_lbl = l10n("#{@i18n.get['email']}: ")
|
54
|
-
ret = <<~SUBMITTING
|
55
|
-
<clause id="_#{UUIDTools::UUID.random_create}" type="editors">
|
56
|
-
<table id="_#{UUIDTools::UUID.random_create}" unnumbered="true"><tbody>
|
57
|
-
SUBMITTING
|
58
|
-
ret += editor_table_entries(eds, ed_lbl, mail_lbl)
|
59
|
-
"#{ret}</tbody></table></clause>"
|
60
|
-
end
|
61
|
-
|
62
|
-
def editor_table_entries(eds, ed_lbl, mail_lbl)
|
63
|
-
eds.each_with_index.with_object([]) do |(n, i), m|
|
64
|
-
mail = ""
|
65
|
-
n[:email] and
|
66
|
-
mail = "#{mail_lbl}<link target='mailto:#{n[:email]}'>" \
|
67
|
-
"#{n[:email]}</link>"
|
68
|
-
aff = n[:affiliation].empty? ? "" : "<br/>#{n[:affiliation]}"
|
69
|
-
th = "<th>#{i.zero? ? ed_lbl : ''}</th>"
|
70
|
-
m << "<tr>#{th}<td>#{n[:name]}#{aff}</td><td>#{mail}</td></tr>"
|
71
|
-
end.join("\n")
|
72
|
-
end
|
73
|
-
|
74
21
|
def prefix_container(container, linkend, node, _target)
|
75
22
|
l10n("#{linkend} #{@i18n.get['in']} #{anchor_xref(node, container)}")
|
76
23
|
end
|
@@ -136,10 +83,9 @@ module IsoDoc
|
|
136
83
|
"resolution" or return super
|
137
84
|
%w(sections bibliography).include? elem.parent.name or return super
|
138
85
|
@suppressheadingnumbers || elem["unnumbered"] and return
|
139
|
-
|
140
86
|
t = elem.at(ns("./title")) and t["depth"] = "1"
|
141
87
|
lbl = @xrefs.anchor(elem["id"], :label, false) or return
|
142
|
-
elem.
|
88
|
+
elem.previous =
|
143
89
|
"<p keep-with-next='true' class='supertitle'>" \
|
144
90
|
"#{@i18n.get['section'].upcase} #{lbl}</p>"
|
145
91
|
end
|
@@ -147,7 +93,6 @@ module IsoDoc
|
|
147
93
|
def annex1(elem)
|
148
94
|
elem.at(ns("//bibdata/ext/doctype"))&.text == "resolution" or
|
149
95
|
return super
|
150
|
-
|
151
96
|
elem.elements.first.previous = annex1_supertitle(elem)
|
152
97
|
t = elem.at(ns("./title")) and
|
153
98
|
t.children = "<strong>#{to_xml(t.children)}</strong>"
|
@@ -184,7 +129,7 @@ module IsoDoc
|
|
184
129
|
!idents[:metanorma] && idents[:sdo] and ret = "[#{ret}]"
|
185
130
|
ret += datefn
|
186
131
|
ret.empty? and return ret
|
187
|
-
ret.gsub(
|
132
|
+
ret.gsub("-", "‑").gsub(/ /, " ")
|
188
133
|
end
|
189
134
|
|
190
135
|
def biblio_ref_entry_code(_ordinal, idents, _id, _standard, datefn, _bib)
|
@@ -192,7 +137,7 @@ module IsoDoc
|
|
192
137
|
!idents[:metanorma] && idents[:sdo] and ret = "[#{ret}]"
|
193
138
|
ret += datefn
|
194
139
|
ret.empty? and return ret
|
195
|
-
ret.gsub(
|
140
|
+
ret.gsub("-", "‑").gsub(/ /, " ")
|
196
141
|
end
|
197
142
|
|
198
143
|
def toc_title(docxml)
|
@@ -201,6 +146,64 @@ module IsoDoc
|
|
201
146
|
super
|
202
147
|
end
|
203
148
|
|
149
|
+
def middle_title(isoxml)
|
150
|
+
s = isoxml.at(ns("//sections")) or return
|
151
|
+
titfn = isoxml.at(ns("//note[@type = 'title-footnote']"))
|
152
|
+
if @meta.get[:doctype] == "Resolution"
|
153
|
+
middle_title_resolution(isoxml, s.children.first)
|
154
|
+
else
|
155
|
+
middle_title_recommendation(isoxml, s.children.first)
|
156
|
+
end
|
157
|
+
titfn and renumber_footnotes(isoxml)
|
158
|
+
end
|
159
|
+
|
160
|
+
def renumber_footnotes(isoxml)
|
161
|
+
(isoxml.xpath(ns("//fn")) - isoxml.xpath(ns("//table//fn | //figure//fn")))
|
162
|
+
.each_with_index do |fn, i|
|
163
|
+
fn["reference"] = (i + 1).to_s
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
def middle_title_resolution(isoxml, out)
|
168
|
+
res = isoxml.at(ns("//bibdata/title[@type = 'resolution']"))
|
169
|
+
out.previous =
|
170
|
+
"<p class='zzSTDTitle1' align='center'>#{res.children.to_xml}</p>"
|
171
|
+
t = @meta.get[:doctitle] and
|
172
|
+
out.previous = "<p class='zzSTDTitle2'>#{t}</p>"
|
173
|
+
middle_title_resolution_subtitle(isoxml, out)
|
174
|
+
end
|
175
|
+
|
176
|
+
def middle_title_resolution_subtitle(isoxml, out)
|
177
|
+
ret = "<p align='center' class='zzSTDTitle2'><em>("
|
178
|
+
d = isoxml.at(ns("//bibdata/title[@type = 'resolution-placedate']"))
|
179
|
+
ret += "#{d.children.to_xml.strip}</em>)"
|
180
|
+
ret += "#{title_footnotes(isoxml)}</p>"
|
181
|
+
out.previous = ret
|
182
|
+
end
|
183
|
+
|
184
|
+
def middle_title_recommendation(isoxml, out)
|
185
|
+
ret = ""
|
186
|
+
type = @meta.get[:doctype]
|
187
|
+
@meta.get[:unpublished] && @meta.get[:draft_new_doctype] and
|
188
|
+
type = @meta.get[:draft_new_doctype]
|
189
|
+
id = @meta.get[:docnumber] and
|
190
|
+
ret += "<<p class='zzSTDTitle1'>#{type} #{id}</p>"
|
191
|
+
t = @meta.get[:doctitle] and
|
192
|
+
ret += "<p class='zzSTDTitle2'>#{t}"
|
193
|
+
ret += "#{title_footnotes(isoxml)}</p>"
|
194
|
+
s = @meta.get[:docsubtitle] and ret += "<p class='zzSTDTitle3'>#{s}</p>"
|
195
|
+
out.previous = ret
|
196
|
+
end
|
197
|
+
|
198
|
+
def title_footnotes(isoxml)
|
199
|
+
ret = ""
|
200
|
+
isoxml.xpath(ns("//note[@type = 'title-footnote']"))
|
201
|
+
.each_with_index do |f, i|
|
202
|
+
ret += "<fn reference='H#{i}'>#{f.remove.children.to_xml}</fn>"
|
203
|
+
end
|
204
|
+
ret
|
205
|
+
end
|
206
|
+
|
204
207
|
include Init
|
205
208
|
end
|
206
209
|
end
|
@@ -21,38 +21,11 @@ module IsoDoc
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
-
def make_body2(body, docxml)
|
25
|
-
body.div class: "WordSection2" do |div2|
|
26
|
-
info docxml, div2
|
27
|
-
boilerplate docxml, div2
|
28
|
-
front docxml, div2
|
29
|
-
div2.p { |p| p << " " } # placeholder
|
30
|
-
end
|
31
|
-
section_break(body)
|
32
|
-
end
|
33
|
-
|
34
|
-
def front(isoxml, out)
|
35
|
-
if !isoxml.at(ns("//preface/abstract"))
|
36
|
-
keywords(isoxml, out)
|
37
|
-
end
|
38
|
-
super # do keyword with abstract
|
39
|
-
end
|
40
|
-
|
41
24
|
def abstract(clause, out)
|
42
25
|
out.div **attr_code(id: clause["id"], class: "Abstract") do |s|
|
43
26
|
clause_name(clause, "Summary", s, class: "AbstractTitle")
|
44
27
|
clause.elements.each { |e| parse(e, s) unless e.name == "title" }
|
45
28
|
end
|
46
|
-
keywords(nil, out)
|
47
|
-
end
|
48
|
-
|
49
|
-
def keywords(_docxml, out)
|
50
|
-
kw = @meta.get[:keywords]
|
51
|
-
kw.nil? || kw.empty? and return
|
52
|
-
out.div **attr_code(class: "Keyword") do |div|
|
53
|
-
clause_name(nil, "Keywords", div, class: "IntroTitle")
|
54
|
-
div.p "#{kw.join(', ')}."
|
55
|
-
end
|
56
29
|
end
|
57
30
|
|
58
31
|
def formula_parse1(node, out)
|