metanorma-itu 2.7.7 → 2.8.0

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.
@@ -703,7 +703,7 @@
703
703
  <xsl:when test="$cover_header_hide = 'false'">
704
704
  <fo:block-container margin-left="13mm">
705
705
  <xsl:call-template name="setWritingMode"/>
706
- <fo:block-container margin-left="0mm">
706
+ <fo:block-container xsl:use-attribute-sets="reset-margins-style">
707
707
 
708
708
  <fo:table width="185.5mm" table-layout="fixed" margin-top="11.5mm">
709
709
  <fo:table-column column-width="proportional-column-width(1)"/>
@@ -1244,7 +1244,7 @@
1244
1244
  </fo:block>
1245
1245
  </fo:block>
1246
1246
  <fo:block-container margin-left="10mm">
1247
- <fo:block-container margin-left="0mm">
1247
+ <fo:block-container xsl:use-attribute-sets="reset-margins-style">
1248
1248
 
1249
1249
  <fo:block font-size="20pt" font-weight="bold" space-before="30mm">
1250
1250
  <xsl:value-of select="$i18n_tsb"/>
@@ -2155,38 +2155,15 @@
2155
2155
  <xsl:otherwise>fo:block</xsl:otherwise>
2156
2156
  </xsl:choose>
2157
2157
  </xsl:variable>
2158
- <xsl:element name="{$element-name}">
2159
- <xsl:attribute name="margin-top">6pt</xsl:attribute>
2160
-
2161
- <xsl:call-template name="setKeepAttributes"/>
2162
2158
 
2163
- <xsl:if test="@class='supertitle'">
2164
- <xsl:attribute name="space-before">36pt</xsl:attribute>
2165
- <xsl:attribute name="margin-bottom">24pt</xsl:attribute>
2166
- <xsl:attribute name="margin-top">0pt</xsl:attribute>
2167
- <xsl:attribute name="font-size">14pt</xsl:attribute>
2159
+ <xsl:variable name="p_styles">
2160
+ <styles xsl:use-attribute-sets="p-style">
2161
+ <xsl:call-template name="refine_p-style"><xsl:with-param name="element-name" select="$element-name"/></xsl:call-template>
2162
+ </styles>
2163
+ </xsl:variable>
2168
2164
 
2169
- </xsl:if>
2170
- <xsl:attribute name="text-align">
2171
- <xsl:choose>
2172
- <xsl:when test="@class='supertitle'">center</xsl:when>
2173
- <!-- <xsl:when test="@align"><xsl:value-of select="@align"/></xsl:when> -->
2174
- <xsl:when test="@align"><xsl:call-template name="setAlignment"/></xsl:when>
2175
- <xsl:when test="ancestor::*[1][self::mn:td]/@align">
2176
- <!-- <xsl:value-of select="ancestor::*[1][local-name() = 'td']/@align"/> -->
2177
- <xsl:call-template name="setAlignment">
2178
- <xsl:with-param name="align" select="ancestor::*[1][self::mn:td]/@align"/>
2179
- </xsl:call-template>
2180
- </xsl:when>
2181
- <xsl:when test="ancestor::*[1][self::mn:th]/@align">
2182
- <!-- <xsl:value-of select="ancestor::*[1][local-name() = 'th']/@align"/> -->
2183
- <xsl:call-template name="setAlignment">
2184
- <xsl:with-param name="align" select="ancestor::*[1][self::mn:th]/@align"/>
2185
- </xsl:call-template>
2186
- </xsl:when>
2187
- <xsl:otherwise>justify</xsl:otherwise>
2188
- </xsl:choose>
2189
- </xsl:attribute>
2165
+ <xsl:element name="{$element-name}">
2166
+ <xsl:copy-of select="xalan:nodeset($p_styles)/styles/@*"/>
2190
2167
 
2191
2168
  <xsl:if test="not(preceding-sibling::*) and parent::mn:li and $doctype = 'service-publication'">
2192
2169
  <fo:inline padding-right="9mm">
@@ -2234,7 +2211,8 @@
2234
2211
  <!-- ====== -->
2235
2212
  <xsl:template match="mn:annex/mn:fmt-title">
2236
2213
  <xsl:variable name="doctype" select="ancestor::mn:metanorma/mn:bibdata/mn:ext/mn:doctype[not(@language) or @language = '']"/>
2237
- <fo:block font-size="14pt" font-weight="bold" text-align="center" margin-bottom="18pt" role="H1">
2214
+ <fo:block xsl:use-attribute-sets="annex-title-style">
2215
+ <xsl:call-template name="refine_annex-title-style"/>
2238
2216
  <fo:block>
2239
2217
  <xsl:apply-templates/>
2240
2218
  <xsl:apply-templates select="following-sibling::*[1][self::mn:variant-title][@type = 'sub']" mode="subtitle"/>
@@ -2262,36 +2240,13 @@
2262
2240
 
2263
2241
  <!-- Bibliography -->
2264
2242
  <xsl:template match="mn:references[not(@normative='true')]/mn:fmt-title">
2265
- <xsl:variable name="doctype" select="ancestor::mn:metanorma/mn:bibdata/mn:ext/mn:doctype[not(@language) or @language = '']"/>
2266
- <fo:block font-size="14pt" font-weight="bold" text-align="center" margin-bottom="18pt" role="H1">
2267
- <xsl:if test="$doctype = 'implementers-guide'">
2268
- <xsl:attribute name="text-align">left</xsl:attribute>
2269
- <xsl:attribute name="font-size">12pt</xsl:attribute>
2270
- <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
2271
- </xsl:if>
2243
+ <fo:block xsl:use-attribute-sets="references-non-normative-title-style">
2272
2244
  <xsl:apply-templates/>
2273
2245
  </fo:block>
2274
2246
  </xsl:template>
2275
2247
 
2276
2248
  <xsl:template match="mn:fmt-title" name="title">
2277
2249
 
2278
- <xsl:variable name="level">
2279
- <xsl:call-template name="getLevel"/>
2280
- </xsl:variable>
2281
-
2282
- <xsl:variable name="doctype" select="ancestor::mn:metanorma/mn:bibdata/mn:ext/mn:doctype[not(@language) or @language = '']"/>
2283
-
2284
- <xsl:variable name="font-size">
2285
- <xsl:choose>
2286
- <xsl:when test="$level = 1 and $doctype = 'resolution'">14pt</xsl:when>
2287
- <xsl:when test="$doctype = 'service-publication'">11pt</xsl:when>
2288
- <xsl:when test="$level &gt;= 2 and $doctype = 'resolution' and ../@inline-header = 'true'">11pt</xsl:when>
2289
- <xsl:when test="$level = 2">12pt</xsl:when>
2290
- <xsl:when test="$level &gt;= 3">12pt</xsl:when>
2291
- <xsl:otherwise>12pt</xsl:otherwise>
2292
- </xsl:choose>
2293
- </xsl:variable>
2294
-
2295
2250
  <xsl:variable name="element-name">
2296
2251
  <xsl:choose>
2297
2252
  <xsl:when test="../@inline-header = 'true'">fo:inline</xsl:when>
@@ -2299,49 +2254,13 @@
2299
2254
  </xsl:choose>
2300
2255
  </xsl:variable>
2301
2256
 
2302
- <xsl:variable name="space-before">
2303
- <xsl:choose>
2304
- <xsl:when test="$level = 1 and $doctype = 'service-publication'">12pt</xsl:when>
2305
- <xsl:when test="$level = '' or $level = 1">18pt</xsl:when>
2306
- <xsl:when test="$level = 2">12pt</xsl:when>
2307
- <xsl:otherwise>6pt</xsl:otherwise>
2308
- </xsl:choose>
2309
- </xsl:variable>
2310
-
2311
- <xsl:variable name="space-after">
2312
- <xsl:choose>
2313
- <xsl:when test="$level = 1 and $doctype = 'resolution'">24pt</xsl:when>
2314
- <xsl:when test="$level = 1 and $doctype = 'service-publication'">12pt</xsl:when>
2315
- <xsl:when test="$level = 2">6pt</xsl:when>
2316
- <xsl:otherwise>6pt</xsl:otherwise>
2317
- </xsl:choose>
2318
- </xsl:variable>
2319
-
2320
- <xsl:variable name="text-align">
2321
- <xsl:choose>
2322
- <xsl:when test="$level = 1 and $doctype = 'resolution'">center</xsl:when>
2323
- <xsl:when test="$lang = 'ar'">start</xsl:when>
2324
- <xsl:otherwise>left</xsl:otherwise>
2325
- </xsl:choose>
2257
+ <xsl:variable name="title_styles">
2258
+ <styles xsl:use-attribute-sets="title-style"><xsl:call-template name="refine_title-style"><xsl:with-param name="element-name" select="$element-name"/></xsl:call-template></styles>
2326
2259
  </xsl:variable>
2327
2260
 
2328
2261
  <xsl:element name="{$element-name}">
2329
- <xsl:attribute name="font-size"><xsl:value-of select="$font-size"/></xsl:attribute>
2330
- <xsl:attribute name="font-weight">bold</xsl:attribute>
2331
- <xsl:attribute name="text-align"><xsl:value-of select="$text-align"/></xsl:attribute>
2332
- <xsl:attribute name="space-before"><xsl:value-of select="$space-before"/></xsl:attribute>
2333
- <xsl:attribute name="space-after"><xsl:value-of select="$space-after"/></xsl:attribute>
2334
- <xsl:attribute name="keep-with-next">always</xsl:attribute>
2335
- <xsl:if test="$element-name = 'fo:inline'">
2336
- <xsl:attribute name="padding-right">
2337
- <xsl:choose>
2338
- <xsl:when test="$level = 2">9mm</xsl:when>
2339
- <xsl:when test="$level = 3">6.5mm</xsl:when>
2340
- <xsl:otherwise>4mm</xsl:otherwise>
2341
- </xsl:choose>
2342
- </xsl:attribute>
2343
- </xsl:if>
2344
- <xsl:attribute name="role">H<xsl:value-of select="$level"/></xsl:attribute>
2262
+ <xsl:copy-of select="xalan:nodeset($title_styles)/styles/@*"/>
2263
+
2345
2264
  <xsl:apply-templates/>
2346
2265
  <xsl:apply-templates select="following-sibling::*[1][self::mn:variant-title][@type = 'sub']" mode="subtitle"/>
2347
2266
  </xsl:element>
@@ -2601,7 +2520,7 @@
2601
2520
  </xsl:if>
2602
2521
  </xsl:if>
2603
2522
 
2604
- <fo:block-container margin-left="0mm" margin-right="0mm">
2523
+ <fo:block-container xsl:use-attribute-sets="reset-margins-style">
2605
2524
  <fo:block>
2606
2525
 
2607
2526
  <xsl:apply-templates select="node()[not(self::mn:note)]"/>
@@ -5069,6 +4988,10 @@
5069
4988
  </xsl:element>
5070
4989
  </xsl:template>
5071
4990
 
4991
+ <!-- show sourcecode's name 'before' or 'after' source code -->
4992
+ <xsl:variable name="sourcecode-name-position"><xsl:text>after</xsl:text>
4993
+ </xsl:variable>
4994
+
5072
4995
  <xsl:template match="mn:sourcecode" name="sourcecode">
5073
4996
 
5074
4997
  <xsl:variable name="sourcecode_attributes">
@@ -5092,7 +5015,12 @@
5092
5015
 
5093
5016
  <xsl:call-template name="refine_sourcecode-container-style"/>
5094
5017
 
5095
- <fo:block-container margin-left="0mm" role="SKIP">
5018
+ <fo:block-container margin-left="0mm" margin-right="0mm" role="SKIP">
5019
+
5020
+ <!-- <xsl:if test="$namespace = 'rsd'"> -->
5021
+ <xsl:if test="$sourcecode-name-position = 'before'">
5022
+ <xsl:apply-templates select="mn:fmt-name"/> <!-- show sourcecode's name BEFORE content -->
5023
+ </xsl:if>
5096
5024
 
5097
5025
  <fo:block xsl:use-attribute-sets="sourcecode-style">
5098
5026
 
@@ -5114,7 +5042,16 @@
5114
5042
  </fo:block>
5115
5043
 
5116
5044
  <xsl:apply-templates select="mn:dl"/> <!-- Key table -->
5117
- <xsl:apply-templates select="mn:fmt-name"/> <!-- show sourcecode's name AFTER content -->
5045
+
5046
+ <!-- <xsl:choose>
5047
+ <xsl:when test="$namespace = 'rsd'"></xsl:when>
5048
+ <xsl:otherwise>
5049
+ <xsl:apply-templates select="mn:fmt-name" /> --><!-- show sourcecode's name AFTER content -->
5050
+ <!-- </xsl:otherwise>
5051
+ </xsl:choose> -->
5052
+ <xsl:if test="$sourcecode-name-position = 'after'">
5053
+ <xsl:apply-templates select="mn:fmt-name"/> <!-- show sourcecode's name AFTER content -->
5054
+ </xsl:if>
5118
5055
 
5119
5056
  </fo:block-container>
5120
5057
  </fo:block-container>
@@ -10995,6 +10932,10 @@
10995
10932
  <!-- image -->
10996
10933
  <!-- ====== -->
10997
10934
 
10935
+ <!-- show figure's name 'before' or 'after' image -->
10936
+ <xsl:variable name="figure-name-position"><xsl:text>after</xsl:text>
10937
+ </xsl:variable>
10938
+
10998
10939
  <xsl:template match="mn:figure" name="figure">
10999
10940
  <xsl:variable name="isAdded" select="@added"/>
11000
10941
  <xsl:variable name="isDeleted" select="@deleted"/>
@@ -11007,6 +10948,10 @@
11007
10948
  <xsl:with-param name="isDeleted" select="$isDeleted"/>
11008
10949
  </xsl:call-template>
11009
10950
 
10951
+ <xsl:if test="$figure-name-position = 'before'"> <!-- show figure's name BEFORE image -->
10952
+ <xsl:apply-templates select="mn:fmt-name"/>
10953
+ </xsl:if>
10954
+
11010
10955
  <!-- Example: Dimensions in millimeters -->
11011
10956
  <xsl:apply-templates select="mn:note[@type = 'units']"/>
11012
10957
 
@@ -11027,7 +10972,16 @@
11027
10972
  <xsl:if test="normalize-space($show_figure_key_in_block_container) = 'true'">
11028
10973
  <xsl:call-template name="showFigureKey"/>
11029
10974
  </xsl:if>
11030
- <xsl:apply-templates select="mn:fmt-name"/> <!-- show figure's name AFTER image -->
10975
+
10976
+ <!-- <xsl:choose>
10977
+ <xsl:when test="$namespace = 'bsi' or $namespace = 'pas' or $namespace = 'rsd'"></xsl:when>
10978
+ <xsl:otherwise>
10979
+ <xsl:apply-templates select="mn:fmt-name" /> --> <!-- show figure's name AFTER image -->
10980
+ <!-- </xsl:otherwise>
10981
+ </xsl:choose> -->
10982
+ <xsl:if test="$figure-name-position = 'after'">
10983
+ <xsl:apply-templates select="mn:fmt-name"/> <!-- show figure's name AFTER image -->
10984
+ </xsl:if>
11031
10985
 
11032
10986
  </fo:block-container>
11033
10987
  </xsl:template>
@@ -13113,10 +13067,20 @@
13113
13067
  <!-- ================ -->
13114
13068
 
13115
13069
  <xsl:attribute-set name="references-non-normative-title-style">
13070
+ <xsl:attribute name="font-size">14pt</xsl:attribute>
13071
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
13072
+ <xsl:attribute name="text-align">center</xsl:attribute>
13073
+ <xsl:attribute name="margin-bottom">18pt</xsl:attribute>
13074
+ <xsl:attribute name="role">H1</xsl:attribute>
13116
13075
  </xsl:attribute-set>
13117
13076
 
13118
13077
  <xsl:template name="refine_references-non-normative-title-style">
13119
-
13078
+ <xsl:variable name="doctype" select="ancestor::mn:metanorma/mn:bibdata/mn:ext/mn:doctype[not(@language) or @language = '']"/>
13079
+ <xsl:if test="$doctype = 'implementers-guide'">
13080
+ <xsl:attribute name="text-align">left</xsl:attribute>
13081
+ <xsl:attribute name="font-size">12pt</xsl:attribute>
13082
+ <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
13083
+ </xsl:if>
13120
13084
  </xsl:template>
13121
13085
 
13122
13086
  <!-- bibitem in Normative References (references/@normative="true") -->
@@ -15232,7 +15196,12 @@
15232
15196
  <!-- ===================================== -->
15233
15197
 
15234
15198
  <xsl:attribute-set name="annex-title-style">
15235
- </xsl:attribute-set>
15199
+ <xsl:attribute name="font-size">14pt</xsl:attribute>
15200
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
15201
+ <xsl:attribute name="text-align">center</xsl:attribute>
15202
+ <xsl:attribute name="margin-bottom">18pt</xsl:attribute>
15203
+ <xsl:attribute name="role">H1</xsl:attribute>
15204
+ </xsl:attribute-set> <!-- annex-title-style -->
15236
15205
 
15237
15206
  <xsl:template name="refine_annex-title-style">
15238
15207
  </xsl:template>
@@ -15243,6 +15212,110 @@
15243
15212
  <xsl:template name="refine_p-zzSTDTitle1-style">
15244
15213
  </xsl:template>
15245
15214
 
15215
+ <xsl:attribute-set name="p-style">
15216
+ <xsl:attribute name="margin-top">6pt</xsl:attribute>
15217
+ </xsl:attribute-set> <!-- p-style -->
15218
+
15219
+ <xsl:template name="refine_p-style">
15220
+ <xsl:param name="element-name"/>
15221
+ <xsl:param name="margin"/>
15222
+ <xsl:call-template name="setKeepAttributes"/>
15223
+
15224
+ <xsl:if test="@class='supertitle'">
15225
+ <xsl:attribute name="space-before">36pt</xsl:attribute>
15226
+ <xsl:attribute name="margin-bottom">24pt</xsl:attribute>
15227
+ <xsl:attribute name="margin-top">0pt</xsl:attribute>
15228
+ <xsl:attribute name="font-size">14pt</xsl:attribute>
15229
+ </xsl:if>
15230
+ <xsl:attribute name="text-align">
15231
+ <xsl:choose>
15232
+ <xsl:when test="@class='supertitle'">center</xsl:when>
15233
+ <!-- <xsl:when test="@align"><xsl:value-of select="@align"/></xsl:when> -->
15234
+ <xsl:when test="@align"><xsl:call-template name="setAlignment"/></xsl:when>
15235
+ <xsl:when test="ancestor::*[1][self::mn:td]/@align">
15236
+ <!-- <xsl:value-of select="ancestor::*[1][local-name() = 'td']/@align"/> -->
15237
+ <xsl:call-template name="setAlignment">
15238
+ <xsl:with-param name="align" select="ancestor::*[1][self::mn:td]/@align"/>
15239
+ </xsl:call-template>
15240
+ </xsl:when>
15241
+ <xsl:when test="ancestor::*[1][self::mn:th]/@align">
15242
+ <!-- <xsl:value-of select="ancestor::*[1][local-name() = 'th']/@align"/> -->
15243
+ <xsl:call-template name="setAlignment">
15244
+ <xsl:with-param name="align" select="ancestor::*[1][self::mn:th]/@align"/>
15245
+ </xsl:call-template>
15246
+ </xsl:when>
15247
+ <xsl:otherwise>justify</xsl:otherwise>
15248
+ </xsl:choose>
15249
+ </xsl:attribute>
15250
+ <!-- $namespace = 'itu' -->
15251
+
15252
+ </xsl:template> <!-- refine_p-style -->
15253
+
15254
+ <xsl:attribute-set name="title-style">
15255
+ <!-- Note: font-size for level 1 title -->
15256
+ <xsl:attribute name="font-size">12pt</xsl:attribute>
15257
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
15258
+ <xsl:attribute name="text-align">left</xsl:attribute>
15259
+ <xsl:attribute name="space-before">18pt</xsl:attribute>
15260
+ <xsl:attribute name="space-after">6pt</xsl:attribute>
15261
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
15262
+ </xsl:attribute-set> <!-- title-style -->
15263
+
15264
+ <xsl:template name="refine_title-style">
15265
+ <xsl:param name="element-name"/>
15266
+ <xsl:variable name="level">
15267
+ <xsl:call-template name="getLevel"/>
15268
+ </xsl:variable>
15269
+ <xsl:variable name="doctype" select="ancestor::mn:metanorma/mn:bibdata/mn:ext/mn:doctype[not(@language) or @language = '']"/>
15270
+
15271
+ <xsl:if test="$level = 1">
15272
+ <xsl:if test="$doctype = 'resolution'">
15273
+ <xsl:attribute name="font-size">14pt</xsl:attribute>
15274
+ <xsl:attribute name="text-align">center</xsl:attribute>
15275
+ <xsl:attribute name="space-after">24pt</xsl:attribute>
15276
+ </xsl:if>
15277
+ <xsl:if test="$doctype = 'service-publication'">
15278
+ <xsl:attribute name="space-before">12pt</xsl:attribute>
15279
+ <xsl:attribute name="space-after">12pt</xsl:attribute>
15280
+ </xsl:if>
15281
+ </xsl:if>
15282
+
15283
+ <xsl:if test="$level = 2">
15284
+ <xsl:attribute name="space-before">12pt</xsl:attribute>
15285
+ <xsl:attribute name="space-after">6pt</xsl:attribute>
15286
+ </xsl:if>
15287
+
15288
+ <xsl:if test="$level &gt;= 2">
15289
+ <xsl:if test="$doctype = 'resolution' and ../@inline-header = 'true'">
15290
+ <xsl:attribute name="font-size">11pt</xsl:attribute>
15291
+ </xsl:if>
15292
+ </xsl:if>
15293
+
15294
+ <xsl:if test="$level &gt;= 3">
15295
+ <xsl:attribute name="space-before">6pt</xsl:attribute>
15296
+ </xsl:if>
15297
+
15298
+ <xsl:if test="$doctype = 'service-publication'">
15299
+ <xsl:attribute name="font-size">11pt</xsl:attribute>
15300
+ </xsl:if>
15301
+
15302
+ <xsl:if test="$lang = 'ar'">
15303
+ <xsl:attribute name="text-align">start</xsl:attribute>
15304
+ </xsl:if>
15305
+
15306
+ <xsl:if test="$element-name = 'fo:inline'">
15307
+ <xsl:attribute name="padding-right">
15308
+ <xsl:choose>
15309
+ <xsl:when test="$level = 2">9mm</xsl:when>
15310
+ <xsl:when test="$level = 3">6.5mm</xsl:when>
15311
+ <xsl:otherwise>4mm</xsl:otherwise>
15312
+ </xsl:choose>
15313
+ </xsl:attribute>
15314
+ </xsl:if>
15315
+ <!-- $namespace = 'itu' -->
15316
+ <xsl:attribute name="role">H<xsl:value-of select="$level"/></xsl:attribute>
15317
+ </xsl:template> <!-- refine_title-style -->
15318
+
15246
15319
  <xsl:template name="processPrefaceSectionsDefault">
15247
15320
  <xsl:for-each select="/*/mn:preface/*[not(self::mn:note or self::mn:admonition)]">
15248
15321
  <xsl:sort select="@displayorder" data-type="number"/>
@@ -15581,6 +15654,12 @@
15581
15654
  </xsl:choose>
15582
15655
  </xsl:template>
15583
15656
 
15657
+ <xsl:attribute-set name="reset-margins-style">
15658
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
15659
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
15660
+ <xsl:attribute name="role">SKIP</xsl:attribute>
15661
+ </xsl:attribute-set>
15662
+
15584
15663
  <xsl:attribute-set name="clause-style">
15585
15664
 
15586
15665
  </xsl:attribute-set>
@@ -16601,8 +16680,9 @@
16601
16680
 
16602
16681
  <xsl:template name="setTextAlignment">
16603
16682
  <xsl:param name="default">left</xsl:param>
16683
+ <xsl:param name="skip_default">false</xsl:param>
16604
16684
  <xsl:variable name="align" select="normalize-space(@align)"/>
16605
- <xsl:attribute name="text-align">
16685
+ <xsl:variable name="text_align">
16606
16686
  <xsl:choose>
16607
16687
  <xsl:when test="$lang = 'ar' and $align = 'left'">start</xsl:when>
16608
16688
  <xsl:when test="$lang = 'ar' and $align = 'right'">end</xsl:when>
@@ -16610,9 +16690,13 @@
16610
16690
  <xsl:when test="$align != '' and not($align = 'indent')"><xsl:value-of select="$align"/></xsl:when>
16611
16691
  <xsl:when test="ancestor::mn:td/@align"><xsl:value-of select="ancestor::mn:td/@align"/></xsl:when>
16612
16692
  <xsl:when test="ancestor::mn:th/@align"><xsl:value-of select="ancestor::mn:th/@align"/></xsl:when>
16693
+ <xsl:when test="$skip_default = 'true'"/>
16613
16694
  <xsl:otherwise><xsl:value-of select="$default"/></xsl:otherwise>
16614
16695
  </xsl:choose>
16615
- </xsl:attribute>
16696
+ </xsl:variable>
16697
+ <xsl:if test="normalize-space($text_align) != ''">
16698
+ <xsl:attribute name="text-align"><xsl:value-of select="$text_align"/></xsl:attribute>
16699
+ </xsl:if>
16616
16700
  <xsl:if test="$align = 'indent'">
16617
16701
  <xsl:attribute name="margin-left">7mm</xsl:attribute>
16618
16702
  </xsl:if>
@@ -16620,8 +16704,10 @@
16620
16704
 
16621
16705
  <xsl:template name="setBlockAttributes">
16622
16706
  <xsl:param name="text_align_default">left</xsl:param>
16707
+ <xsl:param name="skip_text_align_default">false</xsl:param>
16623
16708
  <xsl:call-template name="setTextAlignment">
16624
16709
  <xsl:with-param name="default" select="$text_align_default"/>
16710
+ <xsl:with-param name="skip_default" select="$skip_text_align_default"/>
16625
16711
  </xsl:call-template>
16626
16712
  <xsl:call-template name="setKeepAttributes"/>
16627
16713
  <xsl:if test="node()[1][self::mn:span][contains(@style, 'line-height')]">
@@ -84,15 +84,17 @@ module IsoDoc
84
84
 
85
85
  def norm_ref_entry_code(_ordinal, idents, _ids, _standard, datefn, _bib)
86
86
  ret = (idents[:metanorma] || idents[:ordinal] || idents[:sdo]).to_s
87
- ret.empty? and return ret
88
- /^\[.+\]$/.match?(ret) or ret = "[#{ret}]"
87
+ ret.empty? and return ""
88
+ ret = ret.sub(/^\[(.+)\]$/, "\\1")
89
+ ret = "[#{esc ret}]"
89
90
  ret += datefn
90
91
  ret.gsub("-", "&#x2011;").gsub(/ /, "&#xa0;")
91
92
  end
92
93
 
93
94
  def biblio_ref_entry_code(_ordinal, idents, _id, _standard, datefn, _bib)
94
95
  ret = (idents[:metanorma] || idents[:ordinal] || idents[:sdo]).to_s
95
- /^\[.+\]$/.match?(ret) or ret = "[#{ret}]"
96
+ ret = ret.sub(/^\[(.+)\]$/, "\\1")
97
+ ret = "[#{esc ret}]"
96
98
  ret += datefn
97
99
  ret.empty? and return ret
98
100
  ret.gsub("-", "&#x2011;").gsub(/ /, "&#xa0;")
@@ -152,3 +152,5 @@ module Metanorma
152
152
  end
153
153
  end
154
154
  end
155
+
156
+ require_relative "log"
@@ -0,0 +1,47 @@
1
+ module Metanorma
2
+ module Itu
3
+ class Converter
4
+ ITU_LOG_MESSAGES = {
5
+ # rubocop:disable Naming/VariableNumber
6
+ "ITU_1": { category: "Document Attributes",
7
+ error: "%s is not a recognised document type",
8
+ severity: 2 },
9
+ "ITU_2": { category: "Document Attributes",
10
+ error: "%s is not a recognised status",
11
+ severity: 2 },
12
+ "ITU_3": { category: "Document Attributes",
13
+ error: "Title includes series name %s",
14
+ severity: 2 },
15
+ "ITU_4": { category: "Style",
16
+ error: "Requirement possibly in preface: %s",
17
+ severity: 2 },
18
+ "ITU_6": { category: "Document Attributes",
19
+ error: "Recommendation Status %s inconsistent with AAP",
20
+ severity: 2 },
21
+ "ITU_7": { category: "Document Attributes",
22
+ error: "Recommendation Status %s inconsistent with TAP",
23
+ severity: 2 },
24
+ "ITU_8": { category: "Style",
25
+ error: "%s does not match ITU document identifier conventions",
26
+ severity: 2 },
27
+ "ITU_9": { category: "Style",
28
+ error: "Unnumbered clause out of place",
29
+ severity: 2 },
30
+ "ITU_10": { category: "Style",
31
+ error: "No Summary has been provided",
32
+ severity: 2 },
33
+ "ITU_11": { category: "Style",
34
+ error: "No Keywords have been provided",
35
+ severity: 2 },
36
+ "ITU_12": { category: "Style",
37
+ error: "(terms) %s: %s",
38
+ severity: 2 },
39
+ }.freeze
40
+ # rubocop:enable Naming/VariableNumber
41
+
42
+ def log_messages
43
+ super.merge(ITU_LOG_MESSAGES)
44
+ end
45
+ end
46
+ end
47
+ end
@@ -12,16 +12,14 @@ module Metanorma
12
12
  focus-group implementers-guide technical-paper technical-report
13
13
  joint-itu-iso-iec service-publication
14
14
  contribution).include? @doctype or
15
- @log.add("Document Attributes", nil,
16
- "#{@doctype} is not a recognised document type")
15
+ @log.add("ITU_1", nil, params: [@doctype])
17
16
  end
18
17
 
19
18
  def stage_validate(xmldoc)
20
19
  stage = xmldoc&.at("//bibdata/status/stage")&.text
21
20
  %w(in-force superseded in-force-prepublished withdrawn
22
21
  draft).include? stage or
23
- @log.add("Document Attributes", nil,
24
- "#{stage} is not a recognised status")
22
+ @log.add("ITU_2", nil, params: [stage])
25
23
  end
26
24
 
27
25
  def content_validate(doc)
@@ -41,8 +39,7 @@ module Metanorma
41
39
  xmldoc.xpath("//bibdata/series/title").each do |s|
42
40
  series = s.text.sub(/^[A-Z]: /, "")
43
41
  t.downcase.include?(series.downcase) and
44
- @log.add("Document Attributes", nil,
45
- "Title includes series name #{series}")
42
+ @log.add("ITU_3", nil, params: [series])
46
43
  end
47
44
  end
48
45
 
@@ -61,8 +58,7 @@ module Metanorma
61
58
  xmldoc.xpath("//preface/*").each do |c|
62
59
  extract_text(c).split(/\.\s+/).each do |t|
63
60
  /\b(shall|must)\b/i.match(t) and
64
- @log.add("Style", c,
65
- "Requirement possibly in preface: #{t.strip}")
61
+ @log.add("ITU_4", c, params: [t.strip])
66
62
  end
67
63
  end
68
64
  end
@@ -71,35 +67,33 @@ module Metanorma
71
67
  # Supplanted by rendering
72
68
  def numbers_validate(xmldoc); end
73
69
 
74
- def style_two_regex_not_prev(node, text, regex, regex_prev, warning)
75
- text.nil? and return
76
- arr = text.split(/\W+/)
77
- arr.each_index do |i|
78
- m_prev = i.zero? ? nil : regex_prev.match(arr[i - 1])
79
- if !regex.match?(arr[i]) && m_prev.nil?
80
- @log.add("Style", node, "#{warning}: #{m[:num]}")
81
- end
82
- end
83
- end
70
+ # def style_two_regex_not_prev(node, text, regex, regex_prev, warning)
71
+ # text.nil? and return
72
+ # arr = text.split(/\W+/)
73
+ # arr.each_index do |i|
74
+ # m_prev = i.zero? ? nil : regex_prev.match(arr[i - 1])
75
+ # if !regex.match?(arr[i]) && m_prev.nil?
76
+ # @log.add("Style", node, "#{warning}: #{m[:num]}")
77
+ # # ID = ITU_5
78
+ # end
79
+ # end
80
+ # end
84
81
 
85
82
  def approval_validate(xmldoc)
86
83
  s = xmldoc.at("//bibdata/ext/recommendationstatus/approvalstage") or
87
84
  return
88
85
  process = s["process"]
89
86
  (process == "aap") && %w(determined in-force).include?(s.text) and
90
- @log.add("Document Attributes", nil,
91
- "Recommendation Status #{s.text} inconsistent with AAP")
87
+ @log.add("ITU_6", nil, params: [s.text])
92
88
  (process == "tap") && !%w(determined in-force).include?(s.text) and
93
- @log.add("Document Attributes", nil,
94
- "Recommendation Status #{s.text} inconsistent with TAP")
89
+ @log.add("ITU_7", nil, params: [s.text])
95
90
  end
96
91
 
97
92
  def itu_identifier_validate(xmldoc)
98
93
  xmldoc.xpath("//bibdata/docidentifier[@type = 'ITU']").each do |x|
99
94
  /^SG \d+/.match?(x.text) ||
100
95
  /^ITU-[RTD] [AD-VX-Z]\.\d+(\.\d+)?$/.match?(x.text) or
101
- @log.add("Style", nil, "#{x.text} does not match ITU document " \
102
- "identifier conventions")
96
+ @log.add("ITU_8", nil, params: [x.text])
103
97
  end
104
98
  end
105
99
 
@@ -114,16 +108,16 @@ module Metanorma
114
108
  next if (@doctype == "resolution") && (c.parent.name == "sections") &&
115
109
  !c.at("./preceding-sibling::clause")
116
110
 
117
- @log.add("Style", c, "Unnumbered clause out of place")
111
+ @log.add("ITU_9", c)
118
112
  end
119
113
  end
120
114
 
121
115
  # Editing Guidelines 7.2, 7.3
122
116
  def section_check(xmldoc)
123
117
  xmldoc.at("//bibdata/abstract") or
124
- @log.add("Style", nil, "No Summary has been provided")
118
+ @log.add("ITU_10", nil)
125
119
  xmldoc.at("//bibdata/keyword") or
126
- @log.add("Style", nil, "No Keywords have been provided")
120
+ @log.add("ITU_11", nil)
127
121
  end
128
122
 
129
123
  def termdef_style(xmldoc)
@@ -139,7 +133,7 @@ module Metanorma
139
133
  end
140
134
 
141
135
  def termdef_warn(text, regex, node, term, msg)
142
- regex.match(text) && @log.add("Style", node, "#{term}: #{msg}")
136
+ regex.match(text) && @log.add("ITU_12", node, params: [term, msg])
143
137
  end
144
138
  end
145
139
  end
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Itu
3
- VERSION = "2.7.7".freeze
3
+ VERSION = "2.8.0".freeze
4
4
  end
5
5
  end
@@ -1,3 +1,3 @@
1
1
  template:
2
2
  # skip authoritative identifier, it is inserted in front of formattedref within metanorma
3
- standard: "<em>{{ title }}</em> ,_{{ edition | capitalize_first }} . {{ extent }}."
3
+ standard: "<em>{{ title }}</em> ,_{{ edition | capitalize_first }} $$$ {{ extent }}"