metanorma-itu 2.5.4 → 2.5.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/lib/isodoc/itu/base_convert.rb +1 -1
  3. data/lib/isodoc/itu/cleanup.rb +1 -1
  4. data/lib/isodoc/itu/html_convert.rb +1 -1
  5. data/lib/isodoc/itu/i18n.rb +1 -1
  6. data/lib/isodoc/itu/init.rb +2 -2
  7. data/lib/isodoc/itu/itu.implementers-guide.xsl +138 -52
  8. data/lib/isodoc/itu/itu.in-force.xsl +138 -52
  9. data/lib/isodoc/itu/itu.recommendation-annex.xsl +138 -52
  10. data/lib/isodoc/itu/itu.recommendation-supplement.xsl +138 -52
  11. data/lib/isodoc/itu/itu.recommendation.xsl +138 -52
  12. data/lib/isodoc/itu/itu.resolution.xsl +138 -52
  13. data/lib/isodoc/itu/itu.service-publication.xsl +138 -52
  14. data/lib/isodoc/itu/itu.technical-paper.xsl +138 -52
  15. data/lib/isodoc/itu/itu.technical-report.xsl +138 -52
  16. data/lib/isodoc/itu/metadata.rb +2 -2
  17. data/lib/isodoc/itu/metadata_date.rb +1 -1
  18. data/lib/isodoc/itu/pdf_convert.rb +1 -1
  19. data/lib/isodoc/itu/presentation_bibdata.rb +1 -1
  20. data/lib/isodoc/itu/presentation_contribution.rb +1 -1
  21. data/lib/isodoc/itu/presentation_preface.rb +1 -1
  22. data/lib/isodoc/itu/presentation_ref.rb +1 -1
  23. data/lib/isodoc/itu/presentation_xml_convert.rb +1 -1
  24. data/lib/isodoc/itu/ref.rb +1 -1
  25. data/lib/isodoc/itu/terms.rb +1 -1
  26. data/lib/isodoc/itu/word_cleanup.rb +1 -1
  27. data/lib/isodoc/itu/word_convert.rb +1 -1
  28. data/lib/isodoc/itu/xref.rb +1 -1
  29. data/lib/isodoc/itu/xref_section.rb +4 -4
  30. data/lib/isodoc/itu.rb +1 -1
  31. data/lib/metanorma/itu/biblio-standoc.rng +13 -0
  32. data/lib/metanorma/itu/biblio.rng +19 -12
  33. data/lib/metanorma/itu/cleanup.rb +1 -17
  34. data/lib/metanorma/itu/cleanup_section.rb +1 -1
  35. data/lib/metanorma/itu/converter.rb +6 -6
  36. data/lib/metanorma/itu/front.rb +2 -18
  37. data/lib/metanorma/itu/front_id.rb +1 -1
  38. data/lib/metanorma/itu/processor.rb +6 -6
  39. data/lib/metanorma/itu/relaton-itu.rng +1 -0
  40. data/lib/metanorma/itu/validate.rb +1 -1
  41. data/lib/metanorma/itu/version.rb +2 -2
  42. data/lib/metanorma/itu.rb +1 -1
  43. data/lib/metanorma-itu.rb +1 -1
  44. data/lib/relaton/render/general.rb +2 -2
  45. data/lib/relaton/render/parse.rb +1 -1
  46. data/metanorma-itu.gemspec +1 -1
  47. metadata +2 -2
@@ -6131,7 +6131,8 @@
6131
6131
  </xsl:choose>
6132
6132
  </xsl:variable>
6133
6133
  <xsl:variable name="current_fn_number_text">
6134
- <xsl:value-of select="$current_fn_number"/>
6134
+
6135
+ <xsl:value-of select="$current_fn_number"/>
6135
6136
 
6136
6137
  </xsl:variable>
6137
6138
 
@@ -6149,10 +6150,14 @@
6149
6150
  <xsl:variable name="fn_styles">
6150
6151
  <xsl:choose>
6151
6152
  <xsl:when test="ancestor::*[local-name() = 'bibitem']">
6152
- <fn_styles xsl:use-attribute-sets="bibitem-note-fn-style"/>
6153
+ <fn_styles xsl:use-attribute-sets="bibitem-note-fn-style">
6154
+
6155
+ </fn_styles>
6153
6156
  </xsl:when>
6154
6157
  <xsl:otherwise>
6155
- <fn_styles xsl:use-attribute-sets="fn-num-style"/>
6158
+ <fn_styles xsl:use-attribute-sets="fn-num-style">
6159
+
6160
+ </fn_styles>
6156
6161
  </xsl:otherwise>
6157
6162
  </xsl:choose>
6158
6163
  </xsl:variable>
@@ -6167,8 +6172,10 @@
6167
6172
 
6168
6173
  <xsl:call-template name="insert_basic_link">
6169
6174
  <xsl:with-param name="element">
6170
- <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}" role="Lbl">
6171
- <xsl:copy-of select="$current_fn_number_text"/>
6175
+ <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}"> <!-- note: role="Lbl" removed in https://github.com/metanorma/mn2pdf/issues/291 -->
6176
+ <fo:inline role="Lbl"> <!-- need for https://github.com/metanorma/metanorma-iso/issues/1003 -->
6177
+ <xsl:copy-of select="$current_fn_number_text"/>
6178
+ </fo:inline>
6172
6179
  </fo:basic-link>
6173
6180
  </xsl:with-param>
6174
6181
  </xsl:call-template>
@@ -6455,7 +6462,7 @@
6455
6462
 
6456
6463
  <xsl:call-template name="refine_fn-reference-style"/>
6457
6464
 
6458
- <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="{@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
6465
+ <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="footnote {@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
6459
6466
  <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> <!-- for footnotes in tables -->
6460
6467
  <xsl:attribute name="internal-destination">
6461
6468
  <xsl:value-of select="concat(@reference, '_', ancestor::*[local-name()='table'][1]/@id)"/>
@@ -7499,9 +7506,19 @@
7499
7506
  </fo:inline>
7500
7507
  </xsl:template>
7501
7508
 
7502
- <xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
7509
+ <xsl:template match="text()[ancestor::*[local-name()='smallcap']]" name="smallcaps">
7510
+ <xsl:param name="txt"/>
7503
7511
  <!-- <xsl:variable name="text" select="normalize-space(.)"/> --> <!-- https://github.com/metanorma/metanorma-iso/issues/1115 -->
7504
- <xsl:variable name="text" select="."/>
7512
+ <xsl:variable name="text">
7513
+ <xsl:choose>
7514
+ <xsl:when test="$txt != ''">
7515
+ <xsl:value-of select="$txt"/>
7516
+ </xsl:when>
7517
+ <xsl:otherwise>
7518
+ <xsl:value-of select="."/>
7519
+ </xsl:otherwise>
7520
+ </xsl:choose>
7521
+ </xsl:variable>
7505
7522
  <xsl:variable name="ratio_">
7506
7523
  0.75
7507
7524
  </xsl:variable>
@@ -8947,9 +8964,12 @@
8947
8964
  <xsl:apply-templates/>
8948
8965
  </xsl:when>
8949
8966
  <xsl:otherwise>
8967
+ <xsl:variable name="alt_text">
8968
+ <xsl:call-template name="getAltText"/>
8969
+ </xsl:variable>
8950
8970
  <xsl:call-template name="insert_basic_link">
8951
8971
  <xsl:with-param name="element">
8952
- <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
8972
+ <fo:basic-link external-destination="{$target}" fox:alt-text="{$alt_text}">
8953
8973
  <xsl:if test="$isLinkToEmbeddedFile = 'true'">
8954
8974
  <xsl:attribute name="role">Annot</xsl:attribute>
8955
8975
  </xsl:if>
@@ -8976,6 +8996,14 @@
8976
8996
  </fo:inline>
8977
8997
  </xsl:template> <!-- link -->
8978
8998
 
8999
+ <xsl:template name="getAltText">
9000
+ <xsl:choose>
9001
+ <xsl:when test="normalize-space(.) = ''"><xsl:value-of select="@target"/></xsl:when>
9002
+ <xsl:otherwise><xsl:value-of select="normalize-space(translate(normalize-space(), ' —', ' -'))"/></xsl:otherwise>
9003
+ <!-- <xsl:otherwise><xsl:value-of select="@target"/></xsl:otherwise> -->
9004
+ </xsl:choose>
9005
+ </xsl:template>
9006
+
8979
9007
  <!-- ======================== -->
8980
9008
  <!-- Appendix processing -->
8981
9009
  <!-- ======================== -->
@@ -9006,7 +9034,7 @@
9006
9034
  <xsl:template match="*[local-name() = 'callout']">
9007
9035
  <xsl:choose>
9008
9036
  <xsl:when test="normalize-space(@target) = ''">&lt;<xsl:apply-templates/>&gt;</xsl:when>
9009
- <xsl:otherwise><fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link></xsl:otherwise>
9037
+ <xsl:otherwise><fo:basic-link internal-destination="{@target}" fox:alt-text="{normalize-space()}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link></xsl:otherwise>
9010
9038
  </xsl:choose>
9011
9039
  </xsl:template>
9012
9040
 
@@ -9035,10 +9063,14 @@
9035
9063
  <xsl:template match="*[local-name() = 'xref']">
9036
9064
  <xsl:call-template name="insert_basic_link">
9037
9065
  <xsl:with-param name="element">
9038
- <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
9066
+ <xsl:variable name="alt_text">
9067
+ <xsl:call-template name="getAltText"/>
9068
+ </xsl:variable>
9069
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{$alt_text}" xsl:use-attribute-sets="xref-style">
9039
9070
  <xsl:if test="string-length(normalize-space()) &lt; 30 and not(contains(normalize-space(), 'http://')) and not(contains(normalize-space(), 'https://')) and not(ancestor::*[local-name() = 'table' or local-name() = 'dl'])">
9040
9071
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
9041
9072
  </xsl:if>
9073
+
9042
9074
  <xsl:if test="parent::*[local-name() = 'add']">
9043
9075
  <xsl:call-template name="append_add-style"/>
9044
9076
  </xsl:if>
@@ -9147,44 +9179,44 @@
9147
9179
 
9148
9180
  <xsl:template match="*[local-name() = 'note']" name="note">
9149
9181
 
9150
- <fo:block-container id="{@id}" xsl:use-attribute-sets="note-style" role="SKIP">
9182
+ <fo:block-container id="{@id}" xsl:use-attribute-sets="note-style" role="SKIP">
9151
9183
 
9152
- <xsl:call-template name="setBlockSpanAll"/>
9184
+ <xsl:call-template name="setBlockSpanAll"/>
9153
9185
 
9154
- <xsl:call-template name="refine_note-style"/>
9186
+ <xsl:call-template name="refine_note-style"/>
9155
9187
 
9156
- <fo:block-container margin-left="0mm" margin-right="0mm" role="SKIP">
9188
+ <fo:block-container margin-left="0mm" margin-right="0mm" role="SKIP">
9157
9189
 
9158
- <fo:block>
9190
+ <fo:block>
9159
9191
 
9160
- <xsl:call-template name="refine_note_block_style"/>
9192
+ <xsl:call-template name="refine_note_block_style"/>
9161
9193
 
9162
- <fo:inline xsl:use-attribute-sets="note-name-style" role="SKIP">
9194
+ <fo:inline xsl:use-attribute-sets="note-name-style" role="SKIP">
9163
9195
 
9164
- <xsl:call-template name="refine_note-name-style"/>
9196
+ <xsl:call-template name="refine_note-name-style"/>
9165
9197
 
9166
- <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
9167
- <!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
9168
- <xsl:if test="*[not(local-name()='name')][1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
9169
- <xsl:call-template name="append_add-style"/>
9170
- </xsl:if>
9198
+ <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
9199
+ <!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
9200
+ <xsl:if test="*[not(local-name()='name')][1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
9201
+ <xsl:call-template name="append_add-style"/>
9202
+ </xsl:if>
9171
9203
 
9172
- <!-- if note contains only one element and first and last childs are `add` ace-tag, then move start ace-tag before NOTE's name-->
9173
- <xsl:if test="count(*[not(local-name() = 'name')]) = 1 and *[not(local-name() = 'name')]/node()[last()][local-name() = 'add'][starts-with(text(), $ace_tag)]">
9174
- <xsl:apply-templates select="*[not(local-name() = 'name')]/node()[1][local-name() = 'add'][starts-with(text(), $ace_tag)]">
9175
- <xsl:with-param name="skip">false</xsl:with-param>
9176
- </xsl:apply-templates>
9177
- </xsl:if>
9204
+ <!-- if note contains only one element and first and last childs are `add` ace-tag, then move start ace-tag before NOTE's name-->
9205
+ <xsl:if test="count(*[not(local-name() = 'name')]) = 1 and *[not(local-name() = 'name')]/node()[last()][local-name() = 'add'][starts-with(text(), $ace_tag)]">
9206
+ <xsl:apply-templates select="*[not(local-name() = 'name')]/node()[1][local-name() = 'add'][starts-with(text(), $ace_tag)]">
9207
+ <xsl:with-param name="skip">false</xsl:with-param>
9208
+ </xsl:apply-templates>
9209
+ </xsl:if>
9178
9210
 
9179
- <xsl:apply-templates select="*[local-name() = 'name']"/>
9211
+ <xsl:apply-templates select="*[local-name() = 'name']"/>
9180
9212
 
9181
- </fo:inline>
9213
+ </fo:inline>
9182
9214
 
9183
- <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
9184
- </fo:block>
9215
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
9216
+ </fo:block>
9185
9217
 
9186
- </fo:block-container>
9187
- </fo:block-container>
9218
+ </fo:block-container>
9219
+ </fo:block-container>
9188
9220
 
9189
9221
  </xsl:template>
9190
9222
 
@@ -11523,12 +11555,14 @@
11523
11555
 
11524
11556
  <xsl:when test="contains(normalize-space($fo_element), 'list')">
11525
11557
 
11526
- <xsl:variable name="provisional_distance_between_starts">
11558
+ <xsl:variable name="provisional_distance_between_starts_">
11527
11559
  7
11528
11560
  </xsl:variable>
11529
- <xsl:variable name="indent">
11561
+ <xsl:variable name="provisional_distance_between_starts" select="normalize-space($provisional_distance_between_starts_)"/>
11562
+ <xsl:variable name="indent_">
11530
11563
  0
11531
11564
  </xsl:variable>
11565
+ <xsl:variable name="indent" select="normalize-space($indent_)"/>
11532
11566
 
11533
11567
  <fo:list-block provisional-distance-between-starts="{$provisional_distance_between_starts}mm">
11534
11568
  <fo:list-item>
@@ -11592,6 +11626,7 @@
11592
11626
  </xsl:when>
11593
11627
  <xsl:when test="contains(normalize-space($fo_element), 'block')">
11594
11628
  <fo:block xsl:use-attribute-sets="example-name-style">
11629
+
11595
11630
  <xsl:apply-templates/>
11596
11631
  </fo:block>
11597
11632
  </xsl:when>
@@ -11607,6 +11642,7 @@
11607
11642
 
11608
11643
  <xsl:template match="*[local-name() = 'table']/*[local-name() = 'example']/*[local-name() = 'name']">
11609
11644
  <fo:inline xsl:use-attribute-sets="example-name-style">
11645
+
11610
11646
  <xsl:apply-templates/>
11611
11647
  </fo:inline>
11612
11648
  </xsl:template>
@@ -11978,12 +12014,14 @@
11978
12014
 
11979
12015
  <xsl:if test="parent::*[local-name() = 'term'] and not(preceding-sibling::*[local-name() = 'preferred'])"> <!-- if first preffered in term, then display term's name -->
11980
12016
  <fo:block xsl:use-attribute-sets="term-name-style" role="SKIP">
12017
+
11981
12018
  <xsl:apply-templates select="ancestor::*[local-name() = 'term'][1]/*[local-name() = 'name']"/>
11982
12019
  </fo:block>
11983
12020
  </xsl:if>
11984
12021
 
11985
12022
  <fo:block xsl:use-attribute-sets="preferred-term-style" role="SKIP">
11986
12023
  <xsl:call-template name="setStyle_preferred"/>
12024
+
11987
12025
  <xsl:apply-templates/>
11988
12026
  </fo:block>
11989
12027
  </fo:block>
@@ -12260,14 +12298,17 @@
12260
12298
  </xsl:when>
12261
12299
  <xsl:when test="local-name(..) = 'ol' and @label"> <!-- for ordered lists 'ol', and if there is @label, for instance label="1.1.2" -->
12262
12300
 
12263
- <xsl:variable name="label">
12301
+ <xsl:variable name="type" select="../@type"/>
12264
12302
 
12265
- <xsl:variable name="type" select="../@type"/>
12303
+ <xsl:variable name="label">
12266
12304
 
12267
12305
  <xsl:variable name="style_prefix_">
12268
12306
  <xsl:if test="$type = 'roman'">
12269
12307
  <!-- Example: (i) -->
12270
12308
  </xsl:if>
12309
+ <xsl:if test="$type = 'alphabet'">
12310
+
12311
+ </xsl:if>
12271
12312
  </xsl:variable>
12272
12313
  <xsl:variable name="style_prefix" select="normalize-space($style_prefix_)"/>
12273
12314
 
@@ -12293,13 +12334,15 @@
12293
12334
  <xsl:if test="$style_prefix != '' and not(starts-with(@label, $style_prefix))">
12294
12335
  <xsl:value-of select="$style_prefix"/>
12295
12336
  </xsl:if>
12337
+
12296
12338
  <xsl:value-of select="@label"/>
12339
+
12297
12340
  <xsl:if test="not(java:endsWith(java:java.lang.String.new(@label),$style_suffix))">
12298
12341
  <xsl:value-of select="$style_suffix"/>
12299
12342
  </xsl:if>
12300
12343
  </xsl:variable>
12301
12344
 
12302
- <xsl:value-of select="normalize-space($label)"/>
12345
+ <xsl:value-of select="normalize-space($label)"/>
12303
12346
 
12304
12347
  </xsl:when>
12305
12348
  <xsl:otherwise> <!-- for ordered lists 'ol' -->
@@ -14525,7 +14568,8 @@
14525
14568
  <xsl:variable name="description" select="normalize-space($bibitem_attachment/*[local-name() = 'formattedref'])"/>
14526
14569
  <xsl:variable name="filename" select="java:org.metanorma.fop.Util.getFilenameFromPath(@name)"/>
14527
14570
  <!-- Todo: need update -->
14528
- <xsl:variable name="afrelationship" select="normalize-space($bibitem_attachment//*[local-name() = 'span'][@class = 'pdf-AFRelationship'])"/>
14571
+ <xsl:variable name="afrelationship" select="normalize-space($bibitem_attachment//*[local-name() = 'classification'][@type = 'pdf-AFRelationship'])"/>
14572
+ <xsl:variable name="volatile" select="normalize-space($bibitem_attachment//*[local-name() = 'classification'][@type = 'pdf-volatile'])"/>
14529
14573
 
14530
14574
  <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" filename="{$filename}" link-as-file-annotation="true">
14531
14575
  <xsl:attribute name="src">
@@ -14546,6 +14590,9 @@
14546
14590
  <xsl:if test="$afrelationship != ''">
14547
14591
  <xsl:attribute name="afrelationship"><xsl:value-of select="$afrelationship"/></xsl:attribute>
14548
14592
  </xsl:if>
14593
+ <xsl:if test="$volatile != ''">
14594
+ <xsl:attribute name="volatile"><xsl:value-of select="$volatile"/></xsl:attribute>
14595
+ </xsl:if>
14549
14596
  </pdf:embedded-file>
14550
14597
  </xsl:for-each>
14551
14598
  <!-- references to external attachments (no binary-encoded within the Metanorma XML file) -->
@@ -14556,14 +14603,18 @@
14556
14603
  <xsl:variable name="url" select="concat('url(file:///',$basepath, $attachment_path, ')')"/>
14557
14604
  <xsl:variable name="description" select="normalize-space(*[local-name() = 'formattedref'])"/>
14558
14605
  <!-- Todo: need update -->
14559
- <xsl:variable name="afrelationship" select="normalize-space(.//*[local-name() = 'span'][@class = 'pdf-AFRelationship'])"/>
14606
+ <xsl:variable name="afrelationship" select="normalize-space(.//*[local-name() = 'classification'][@type = 'pdf-AFRelationship'])"/>
14607
+ <xsl:variable name="volatile" select="normalize-space(.//*[local-name() = 'classification'][@type = 'pdf-volatile'])"/>
14560
14608
  <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{$attachment_name}" link-as-file-annotation="true">
14561
14609
  <xsl:if test="$description != ''">
14562
14610
  <xsl:attribute name="description"><xsl:value-of select="$description"/></xsl:attribute>
14563
14611
  </xsl:if>
14564
14612
  <xsl:if test="$afrelationship != ''">
14565
- <xsl:attribute name="afrelationship"><xsl:value-of select="$afrelationship"/></xsl:attribute>
14566
- </xsl:if>
14613
+ <xsl:attribute name="afrelationship"><xsl:value-of select="$afrelationship"/></xsl:attribute>
14614
+ </xsl:if>
14615
+ <xsl:if test="$volatile != ''">
14616
+ <xsl:attribute name="volatile"><xsl:value-of select="$volatile"/></xsl:attribute>
14617
+ </xsl:if>
14567
14618
  </pdf:embedded-file>
14568
14619
  </xsl:for-each>
14569
14620
  </xsl:if>
@@ -14610,10 +14661,31 @@
14610
14661
  <xsl:value-of select="$level_total - 2"/>
14611
14662
  </xsl:when>
14612
14663
  <xsl:when test="ancestor::*[local-name() = 'sections'] and self::*[local-name() = 'title']">
14613
- <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][2]/*[local-name() = 'title']/@depth)"/>
14664
+ <!-- determine 'depth' depends on upper clause with title/@depth -->
14665
+ <!-- <xsl:message>title=<xsl:value-of select="."/></xsl:message> -->
14666
+ <xsl:variable name="clause_with_depth_depth" select="ancestor::*[local-name() = 'clause'][*[local-name() = 'title']/@depth][1]/*[local-name() = 'title']/@depth"/>
14667
+ <!-- <xsl:message>clause_with_depth_depth=<xsl:value-of select="$clause_with_depth_depth"/></xsl:message> -->
14668
+ <xsl:variable name="clause_with_depth_level" select="count(ancestor::*[local-name() = 'clause'][*[local-name() = 'title']/@depth][1]/ancestor::*)"/>
14669
+ <!-- <xsl:message>clause_with_depth_level=<xsl:value-of select="$clause_with_depth_level"/></xsl:message> -->
14670
+ <xsl:variable name="curr_level" select="count(ancestor::*) - 1"/>
14671
+ <!-- <xsl:message>curr_level=<xsl:value-of select="$curr_level"/></xsl:message> -->
14672
+ <!-- <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][2]/*[local-name() = 'title']/@depth)"/> -->
14673
+ <xsl:variable name="curr_clause_depth" select="number($clause_with_depth_depth) + (number($curr_level) - number($clause_with_depth_level)) "/>
14674
+ <!-- <xsl:message>curr_clause_depth=<xsl:value-of select="$curr_clause_depth"/></xsl:message> -->
14614
14675
  <xsl:choose>
14615
- <xsl:when test="string(number($upper_clause_depth)) != 'NaN'">
14616
- <xsl:value-of select="number($upper_clause_depth + 1)"/>
14676
+ <xsl:when test="string(number($curr_clause_depth)) != 'NaN'">
14677
+ <xsl:value-of select="number($curr_clause_depth)"/>
14678
+ </xsl:when>
14679
+ <xsl:otherwise>
14680
+ <xsl:value-of select="$level_total - 2"/>
14681
+ </xsl:otherwise>
14682
+ </xsl:choose>
14683
+ </xsl:when>
14684
+ <xsl:when test="ancestor::*[local-name() = 'sections'] and self::*[local-name() = 'name'] and parent::*[local-name() = 'term']">
14685
+ <xsl:variable name="upper_terms_depth" select="normalize-space(ancestor::*[local-name() = 'terms'][1]/*[local-name() = 'title']/@depth)"/>
14686
+ <xsl:choose>
14687
+ <xsl:when test="string(number($upper_terms_depth)) != 'NaN'">
14688
+ <xsl:value-of select="number($upper_terms_depth + 1)"/>
14617
14689
  </xsl:when>
14618
14690
  <xsl:otherwise>
14619
14691
  <xsl:value-of select="$level_total - 2"/>
@@ -14621,7 +14693,7 @@
14621
14693
  </xsl:choose>
14622
14694
  </xsl:when>
14623
14695
  <xsl:when test="ancestor::*[local-name() = 'sections']">
14624
- <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][1]/*[local-name() = 'title']/@depth)"/>
14696
+ <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause' or local-name() = 'terms'][1]/*[local-name() = 'title']/@depth)"/>
14625
14697
  <xsl:choose>
14626
14698
  <xsl:when test="string(number($upper_clause_depth)) != 'NaN'">
14627
14699
  <xsl:value-of select="number($upper_clause_depth + 1)"/>
@@ -14938,9 +15010,10 @@
14938
15010
  <xsl:template name="insertBackgroundPageImage">
14939
15011
  <xsl:param name="number">1</xsl:param>
14940
15012
  <xsl:param name="name">coverpage-image</xsl:param>
15013
+ <xsl:param name="suffix"/>
14941
15014
  <xsl:variable name="num" select="number($number)"/>
14942
15015
  <!-- background image -->
14943
- <fo:block-container absolute-position="fixed" left="0mm" top="0mm" font-size="0" id="__internal_layout__coverpage_{$name}_{$number}_{generate-id()}">
15016
+ <fo:block-container absolute-position="fixed" left="0mm" top="0mm" font-size="0" id="__internal_layout__coverpage{$suffix}_{$name}_{$number}_{generate-id()}">
14944
15017
  <fo:block>
14945
15018
  <xsl:for-each select="/*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = $name][1]/*[local-name() = 'value']/*[local-name() = 'image'][$num]">
14946
15019
  <xsl:choose>
@@ -15006,16 +15079,29 @@
15006
15079
 
15007
15080
  <!-- END: insert cover page image -->
15008
15081
 
15082
+ <xsl:variable name="regex_ja_spec">[\uFF08\uFF09]</xsl:variable>
15009
15083
  <xsl:template name="insertVerticalChar">
15010
15084
  <xsl:param name="str"/>
15085
+ <xsl:param name="writing-mode">lr-tb</xsl:param>
15086
+ <xsl:param name="reference-orientation">90</xsl:param>
15011
15087
  <xsl:if test="string-length($str) &gt; 0">
15012
- <fo:inline-container writing-mode="lr-tb" text-align="center" alignment-baseline="central" reference-orientation="90" width="1em" margin="0" padding="0" text-indent="0mm" last-line-end-indent="0mm" start-indent="0mm" end-indent="0mm">
15088
+ <fo:inline-container text-align="center" alignment-baseline="central" width="1em" margin="0" padding="0" text-indent="0mm" last-line-end-indent="0mm" start-indent="0mm" end-indent="0mm">
15089
+ <xsl:if test="normalize-space($writing-mode) != ''">
15090
+ <xsl:attribute name="writing-mode"><xsl:value-of select="$writing-mode"/></xsl:attribute>
15091
+ <xsl:attribute name="reference-orientation">90</xsl:attribute>
15092
+ </xsl:if>
15093
+ <xsl:variable name="char" select="substring($str,1,1)"/>
15094
+ <xsl:if test="normalize-space(java:matches(java:java.lang.String.new($char), concat('(', $regex_ja_spec, '{1,})'))) = 'true'">
15095
+ <xsl:attribute name="reference-orientation">0</xsl:attribute>
15096
+ </xsl:if>
15013
15097
  <fo:block-container width="1em">
15014
- <fo:block line-height="1em"><xsl:value-of select="substring($str,1,1)"/></fo:block>
15098
+ <fo:block line-height="1em"><xsl:value-of select="$char"/></fo:block>
15015
15099
  </fo:block-container>
15016
15100
  </fo:inline-container>
15017
15101
  <xsl:call-template name="insertVerticalChar">
15018
15102
  <xsl:with-param name="str" select="substring($str, 2)"/>
15103
+ <xsl:with-param name="writing-mode" select="$writing-mode"/>
15104
+ <xsl:with-param name="reference-orientation" select="$reference-orientation"/>
15019
15105
  </xsl:call-template>
15020
15106
  </xsl:if>
15021
15107
  </xsl:template>
@@ -2,7 +2,7 @@ require "twitter_cldr"
2
2
  require_relative "metadata_date"
3
3
 
4
4
  module IsoDoc
5
- module ITU
5
+ module Itu
6
6
  class Metadata < IsoDoc::Metadata
7
7
  def initialize(lang, script, locale, labels)
8
8
  super
@@ -12,7 +12,7 @@ module IsoDoc
12
12
  set(:logo_word, fileloc(n))
13
13
  set(:logo_sp, fileloc("logo-sp.png"))
14
14
  set(:logo_small, fileloc("logo-small.png"))
15
- @isodoc = IsoDoc::ITU::HtmlConvert.new({})
15
+ @isodoc = IsoDoc::Itu::HtmlConvert.new({})
16
16
  end
17
17
 
18
18
  def fileloc(file)
@@ -1,5 +1,5 @@
1
1
  module IsoDoc
2
- module ITU
2
+ module Itu
3
3
  class Metadata < IsoDoc::Metadata
4
4
  def monthyr(isodate)
5
5
  m = /(?<yr>\d\d\d\d)-(?<mo>\d\d)/.match isodate
@@ -2,7 +2,7 @@ require "isodoc"
2
2
  require "fileutils"
3
3
 
4
4
  module IsoDoc
5
- module ITU
5
+ module Itu
6
6
  # A {Converter} implementation that generates PDF HTML output, and a
7
7
  # document schema encapsulation of the document for validation
8
8
  class PdfConvert < IsoDoc::XslfoPdfConvert
@@ -1,5 +1,5 @@
1
1
  module IsoDoc
2
- module ITU
2
+ module Itu
3
3
  class PresentationXMLConvert < IsoDoc::PresentationXMLConvert
4
4
  def bibdata_i18n(bib)
5
5
  super
@@ -1,5 +1,5 @@
1
1
  module IsoDoc
2
- module ITU
2
+ module Itu
3
3
  class PresentationXMLConvert < IsoDoc::PresentationXMLConvert
4
4
  def contribution_table_insert_pt(docxml)
5
5
  docxml.at(ns("//preface")) || docxml.at(ns("//sections"))
@@ -1,5 +1,5 @@
1
1
  module IsoDoc
2
- module ITU
2
+ module Itu
3
3
  class PresentationXMLConvert < IsoDoc::PresentationXMLConvert
4
4
  def insert_preface_sections(docxml)
5
5
  if @doctype == "contribution"
@@ -6,7 +6,7 @@ require_relative "presentation_bibdata"
6
6
  require_relative "presentation_preface"
7
7
 
8
8
  module IsoDoc
9
- module ITU
9
+ module Itu
10
10
  class PresentationXMLConvert < IsoDoc::PresentationXMLConvert
11
11
  def bibrender_formattedref(formattedref, _xml)
12
12
  formattedref << "." unless /\.$/.match?(formattedref.text)
@@ -19,7 +19,7 @@ module Nokogiri
19
19
  end
20
20
 
21
21
  module IsoDoc
22
- module ITU
22
+ module Itu
23
23
  class PresentationXMLConvert < IsoDoc::PresentationXMLConvert
24
24
  def initialize(options)
25
25
  @hierarchical_assets = options[:hierarchicalassets]
@@ -3,7 +3,7 @@ require_relative "metadata"
3
3
  require "fileutils"
4
4
 
5
5
  module IsoDoc
6
- module ITU
6
+ module Itu
7
7
  module BaseConvert
8
8
  def nonstd_bibitem(list, bibitem, _ordinal, biblio)
9
9
  list.tr **attr_code(iso_bibitem_entry_attrs(bibitem, biblio)) do |ref|
@@ -1,5 +1,5 @@
1
1
  module IsoDoc
2
- module ITU
2
+ module Itu
3
3
  module BaseConvert
4
4
  def termdef_parse1(node, div, defn, source)
5
5
  div.p **{ class: "TermNum", id: node["id"] } do |p|
@@ -1,5 +1,5 @@
1
1
  module IsoDoc
2
- module ITU
2
+ module Itu
3
3
  class WordConvert < IsoDoc::WordConvert
4
4
  def word_preface_cleanup(docxml)
5
5
  docxml.xpath("//h1[@class = 'AbstractTitle'] | "\
@@ -4,7 +4,7 @@ require_relative "word_cleanup"
4
4
  require "fileutils"
5
5
 
6
6
  module IsoDoc
7
- module ITU
7
+ module Itu
8
8
  class WordConvert < IsoDoc::WordConvert
9
9
  def initialize(options)
10
10
  @libdir = File.dirname(__FILE__)
@@ -3,7 +3,7 @@ require "fileutils"
3
3
  require_relative "xref_section"
4
4
 
5
5
  module IsoDoc
6
- module ITU
6
+ module Itu
7
7
  class Counter < IsoDoc::XrefGen::Counter
8
8
  def print
9
9
  ret = super or return nil
@@ -1,5 +1,5 @@
1
1
  module IsoDoc
2
- module ITU
2
+ module Itu
3
3
  class Xref < IsoDoc::Xref
4
4
  def clause_order_annex(docxml)
5
5
  if docxml.at(ns("//bibdata/ext/structuredidentifier/annexid"))
@@ -64,7 +64,7 @@ module IsoDoc
64
64
  { label: num, elem: @labels["annex_subclause"],
65
65
  xref: @doctype == "resolution" ? num : l10n("#{@labels['annex_subclause']} #{num}"),
66
66
  level: level, type: "clause" }
67
- i = Counter.new(0, prefix: "#{num}.")
67
+ i = Counter.new(0, prefix: num)
68
68
  clause.xpath(ns("./clause | ./references | ./terms | ./definitions"))
69
69
  .each do |c|
70
70
  annex_names1(c, i.increment(c).print, level + 1)
@@ -92,7 +92,7 @@ module IsoDoc
92
92
  @anchors[clause["id"]] =
93
93
  { label: num.print, xref: l10n("#{lbl} #{num.print}"),
94
94
  level: lvl, type: "clause", elem: lbl }
95
- i = Counter.new(0, prefix: "#{num.print}.")
95
+ i = Counter.new(0, prefix: num.print)
96
96
  clause.xpath(ns(SUBCLAUSES)).each do |c|
97
97
  section_names1(c, i.increment(c).print, lvl + 1)
98
98
  end
@@ -105,7 +105,7 @@ module IsoDoc
105
105
  { label: num, level: level,
106
106
  elem: @doctype == "resolution" ? "" : @labels["clause"],
107
107
  xref: x }
108
- i = Counter.new(0, prefix: "#{num}.")
108
+ i = Counter.new(0, prefix: num)
109
109
  clause.xpath(ns(SUBCLAUSES)).each do |c|
110
110
  section_names1(c, i.increment(c).print, level + 1)
111
111
  end
data/lib/isodoc/itu.rb CHANGED
@@ -6,6 +6,6 @@ require "isodoc/itu/word_convert"
6
6
  require "isodoc/itu/presentation_xml_convert"
7
7
 
8
8
  module IsoDoc
9
- module ITU
9
+ module Itu
10
10
  end
11
11
  end
@@ -72,6 +72,9 @@ standards defining organization, and that is rendered in a distinct manner</a:do
72
72
  from other documents in the same doctype</a:documentation>
73
73
  </ref>
74
74
  </optional>
75
+ <ref name="flavor">
76
+ <a:documentation>Flavour of Metanorma used to process this document</a:documentation>
77
+ </ref>
75
78
  <optional>
76
79
  <ref name="editorialgroup">
77
80
  <a:documentation>Groups associated with the production of the standards document, typically within
@@ -113,6 +116,16 @@ a standards definition organization</a:documentation>
113
116
  <define name="DocumentSubtype">
114
117
  <text/>
115
118
  </define>
119
+ <define name="flavor">
120
+ <element name="flavor">
121
+ <ref name="MetanormaFlavor"/>
122
+ </element>
123
+ </define>
124
+ <define name="MetanormaFlavor">
125
+ <a:documentation>This is in fact an enum, as of this writing: standoc iso generic ietf ieee itu nist ogc csa cc iho ribose jis iec bsi bipm plateau.
126
+ However we prefer not to hardcode it, given ongoing extension.</a:documentation>
127
+ <text/>
128
+ </define>
116
129
  <define name="editorialgroup">
117
130
  <a:documentation>A group associated with the production of the standards document, typically within
118
131
  a standards definition organization</a:documentation>