metanorma-csa 1.9.5 → 2.0.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 37d3298cbb694f395c6d67468590131ee9d24a46fd1f77c5469a9eb066e8cbd4
4
- data.tar.gz: 2fb5f6aa1b8154b25be5fe200686cae552c75992640885be121267ee2de27b19
3
+ metadata.gz: 1823fac74c1082a8842d6ae0c1dc75bae45c729a1cb6e5a120f54066835593a8
4
+ data.tar.gz: 175e8dd9c390ece8085dc3f14cdef90cd5e3ff81f223570cdcb83a017cc2ad40
5
5
  SHA512:
6
- metadata.gz: 82a604704af383a648fa2deb3cb99e0144fd793b84e91810a4c4742eeb58f6f00511b2c30144dbae2f8165f7160f2140a78db292a625751b8267aaa2a616e8b5
7
- data.tar.gz: e651db08a2b49fad657d925df1dd4775fedc4b5f5af1383f714939453a9dd10d504db668221f652c5b9d8c75a38b13ccbb47199b4be6617a42f4591a2ec90bfb
6
+ metadata.gz: 07257f56eff8961f381ad29bc629648eae2f2ab245206642249fe5cce342dd7289da0cfb1a907409b40c69d0f4dfc600a91aa229aece8060c0bb349cfba54776
7
+ data.tar.gz: 795de1a97d2ce5acaacbedcd17fc374cdabe68a413eb86cf9457b757736fc72f024c6567097af4d7a47ae00461ea04245657b2fcb178bee63de1dd220bcc0ff0
@@ -9,35 +9,7 @@ on:
9
9
  pull_request:
10
10
 
11
11
  jobs:
12
- rake:
13
- name: Test on Ruby ${{ matrix.ruby }} ${{ matrix.os }}
14
- runs-on: ${{ matrix.os }}
15
- continue-on-error: ${{ matrix.experimental }}
16
- strategy:
17
- fail-fast: false
18
- matrix:
19
- ruby: [ '3.0', '2.7', '2.6', '2.5' ]
20
- os: [ ubuntu-latest, windows-latest, macos-latest ]
21
- experimental: [ false ]
22
- steps:
23
- - uses: actions/checkout@v2
24
- with:
25
- submodules: true
26
-
27
- - uses: ruby/setup-ruby@v1
28
- with:
29
- ruby-version: ${{ matrix.ruby }}
30
- bundler-cache: true
31
-
32
- - run: bundle exec rake
33
-
34
- tests-passed:
35
- needs: rake
36
- runs-on: ubuntu-latest
37
- steps:
38
- - uses: peter-evans/repository-dispatch@v1
39
- with:
40
- token: ${{ secrets.METANORMA_CI_PAT_TOKEN || secrets.GITHUB_TOKEN }}
41
- repository: ${{ github.repository }}
42
- event-type: tests-passed
43
- client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}"}'
12
+ notify:
13
+ uses: metanorma/metanorma-build-scripts/.github/workflows/mn-processor-rake.yml@main
14
+ secrets:
15
+ pat_token: ${{ secrets.METANORMA_CI_PAT_TOKEN }}
data/.gitignore CHANGED
@@ -8,3 +8,6 @@
8
8
  /test.*
9
9
 
10
10
  .rubocop-https--*
11
+
12
+ /Gemfile.devel
13
+ /Gemfile.lock
data/bin/console CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require 'bundler/setup'
4
- require 'asciidoctor/csa'
4
+ require 'metanorma-csa'
5
5
 
6
6
  # You can add fixtures and/or initialization code here to make experimenting
7
7
  # with your gem easier. You can also use a different console, if you like.
@@ -142,12 +142,11 @@
142
142
 
143
143
  <fo:block break-after="page"/>
144
144
 
145
- <xsl:variable name="title-acknowledgements">
146
- <xsl:call-template name="getTitle">
147
- <xsl:with-param name="name" select="'title-acknowledgements'"/>
145
+ <fo:block font-size="26pt" margin-bottom="18pt" role="H1">
146
+ <xsl:call-template name="getLocalizedString">
147
+ <xsl:with-param name="key">acknowledgements</xsl:with-param>
148
148
  </xsl:call-template>
149
- </xsl:variable>
150
- <fo:block font-size="26pt" margin-bottom="18pt" role="H1"><xsl:value-of select="$title-acknowledgements"/></fo:block>
149
+ </fo:block>
151
150
 
152
151
  <xsl:variable name="persons">
153
152
  <xsl:for-each select="/csa:csa-standard/csa:bibdata/csa:contributor[csa:person]">
@@ -537,46 +536,7 @@
537
536
 
538
537
  <xsl:template match="csa:bibitem">
539
538
  <fo:block id="{@id}" margin-bottom="12pt" start-indent="12mm" text-indent="-12mm" line-height="145%">
540
- <xsl:if test=".//csa:fn">
541
- <xsl:attribute name="line-height-shift-adjustment">disregard-shifts</xsl:attribute>
542
- </xsl:if>
543
- <xsl:choose>
544
- <xsl:when test="csa:formattedref">
545
- <xsl:apply-templates select="csa:formattedref"/>
546
- </xsl:when>
547
- <xsl:otherwise>
548
- <xsl:for-each select="csa:contributor[csa:role/@type='publisher']/csa:organization/csa:name">
549
- <xsl:apply-templates/>
550
- <xsl:if test="position() != last()">, </xsl:if>
551
- <xsl:if test="position() = last()">: </xsl:if>
552
- </xsl:for-each>
553
- <!-- csa:docidentifier -->
554
- <!-- <xsl:if test="csa:docidentifier">
555
- <xsl:value-of select="csa:docidentifier/@type"/><xsl:text> </xsl:text>
556
- <xsl:value-of select="csa:docidentifier"/>
557
- </xsl:if> -->
558
- <xsl:value-of select="csa:docidentifier"/>
559
- <xsl:apply-templates select="csa:note"/>
560
- <xsl:if test="csa:docidentifier">, </xsl:if>
561
- <fo:inline font-style="italic">
562
- <xsl:choose>
563
- <xsl:when test="csa:title[@type = 'main' and @language = 'en']">
564
- <xsl:value-of select="csa:title[@type = 'main' and @language = 'en']"/><xsl:text>. </xsl:text>
565
- </xsl:when>
566
- <xsl:otherwise>
567
- <xsl:value-of select="csa:title"/><xsl:text>. </xsl:text>
568
- </xsl:otherwise>
569
- </xsl:choose>
570
- </fo:inline>
571
- <xsl:for-each select="csa:contributor[csa:role/@type='publisher']/csa:organization/csa:name">
572
- <xsl:apply-templates/>
573
- <xsl:if test="position() != last()">, </xsl:if>
574
- </xsl:for-each>
575
- <xsl:if test="csa:date[@type='published']/csa:on">
576
- <xsl:text>(</xsl:text><xsl:value-of select="csa:date[@type='published']/csa:on"/><xsl:text>)</xsl:text>
577
- </xsl:if>
578
- </xsl:otherwise>
579
- </xsl:choose>
539
+ <xsl:call-template name="processBibitem"/>
580
540
  </fo:block>
581
541
  </xsl:template>
582
542
 
@@ -739,7 +699,10 @@
739
699
  <xsl:template match="csa:references[not(@normative='true')]/csa:bibitem">
740
700
  <fo:block margin-bottom="12pt" line-height="145%">
741
701
  <fo:inline id="{@id}">
742
- <xsl:number format="[1]"/>
702
+ <xsl:value-of select="csa:docidentifier[@type = 'metanorma-ordinal']"/>
703
+ <xsl:if test="not(csa:docidentifier[@type = 'metanorma-ordinal'])">
704
+ <xsl:number format="[1]"/>
705
+ </xsl:if>
743
706
  </fo:inline>
744
707
 
745
708
  <xsl:if test="not(csa:formattedref)">
@@ -759,13 +722,13 @@
759
722
 
760
723
  </xsl:if>
761
724
 
762
- <xsl:if test="csa:docidentifier">
725
+ <xsl:if test="csa:docidentifier[not(@type = 'metanorma-ordinal')]">
763
726
  <xsl:choose>
764
727
  <xsl:when test="csa:docidentifier/@type = 'ISO' and csa:formattedref"/>
765
728
  <xsl:when test="csa:docidentifier/@type = 'OGC' and csa:formattedref"/>
766
729
  <xsl:otherwise><fo:inline>
767
730
  <!-- <xsl:if test="csa:docidentifier/@type = 'OGC'">OGC </xsl:if> -->
768
- <xsl:value-of select="csa:docidentifier"/><xsl:apply-templates select="csa:note"/>, </fo:inline></xsl:otherwise>
731
+ <xsl:value-of select="csa:docidentifier[not(@type = 'metanorma-ordinal')]"/><xsl:apply-templates select="csa:note"/>, </fo:inline></xsl:otherwise>
769
732
  </xsl:choose>
770
733
  </xsl:if>
771
734
 
@@ -798,8 +761,6 @@
798
761
  </fo:block>
799
762
  </xsl:template>
800
763
 
801
- <!-- <xsl:template match="csa:references[@id = '_bibliography']/csa:bibitem" mode="contents"/> [position() &gt; 1] -->
802
- <xsl:template match="csa:references[not(@normative='true')]/csa:bibitem" mode="contents"/>
803
764
 
804
765
  <!-- <xsl:template match="csa:references[@id = '_bibliography']/csa:bibitem/csa:title"> [position() &gt; 1]-->
805
766
  <xsl:template match="csa:references[not(@normative='true')]/csa:bibitem/csa:title">
@@ -880,13 +841,6 @@
880
841
 
881
842
  <xsl:variable name="titles" select="xalan:nodeset($titles_)"/><xsl:variable name="titles_">
882
843
 
883
- <title-annex lang="en">Annex </title-annex>
884
- <title-annex lang="fr">Annexe </title-annex>
885
-
886
- <title-annex lang="zh">Annex </title-annex>
887
-
888
-
889
-
890
844
  <title-edition lang="en">
891
845
 
892
846
 
@@ -900,7 +854,8 @@
900
854
 
901
855
  </title-edition>
902
856
 
903
-
857
+
858
+ <!-- These titles of Table of contents renders different than determined in localized-strings -->
904
859
  <title-toc lang="en">
905
860
 
906
861
 
@@ -912,21 +867,11 @@
912
867
 
913
868
  <xsl:text>Sommaire</xsl:text>
914
869
 
915
-
916
- </title-toc>
870
+ </title-toc>
917
871
 
918
872
  <title-toc lang="zh">Contents</title-toc>
919
873
 
920
874
 
921
-
922
- <title-page lang="en">Page</title-page>
923
- <title-page lang="fr">Page</title-page>
924
-
925
- <title-key lang="en">Key</title-key>
926
- <title-key lang="fr">Légende</title-key>
927
-
928
- <title-where lang="en">where</title-where>
929
- <title-where lang="fr">où</title-where>
930
875
 
931
876
  <title-descriptors lang="en">Descriptors</title-descriptors>
932
877
 
@@ -949,25 +894,6 @@
949
894
 
950
895
  </title-subpart>
951
896
 
952
- <title-modified lang="en">modified</title-modified>
953
- <title-modified lang="fr">modifiée</title-modified>
954
-
955
- <title-modified lang="zh">modified</title-modified>
956
-
957
-
958
-
959
- <title-source lang="en">
960
-
961
- <xsl:text>SOURCE</xsl:text>
962
-
963
-
964
- </title-source>
965
-
966
- <title-keywords lang="en">Keywords</title-keywords>
967
-
968
- <title-deprecated lang="en">DEPRECATED</title-deprecated>
969
- <title-deprecated lang="fr">DEPRECATED</title-deprecated>
970
-
971
897
  <title-list-tables lang="en">List of Tables</title-list-tables>
972
898
 
973
899
  <title-list-figures lang="en">List of Figures</title-list-figures>
@@ -976,37 +902,8 @@
976
902
 
977
903
  <title-list-recommendations lang="en">List of Recommendations</title-list-recommendations>
978
904
 
979
- <title-acknowledgements lang="en">Acknowledgements</title-acknowledgements>
980
-
981
- <title-abstract lang="en">Abstract</title-abstract>
982
-
983
905
  <title-summary lang="en">Summary</title-summary>
984
906
 
985
- <title-in lang="en">in </title-in>
986
-
987
- <title-partly-supercedes lang="en">Partly Supercedes </title-partly-supercedes>
988
- <title-partly-supercedes lang="zh">部分代替 </title-partly-supercedes>
989
-
990
- <title-completion-date lang="en">Completion date for this manuscript</title-completion-date>
991
- <title-completion-date lang="zh">本稿完成日期</title-completion-date>
992
-
993
- <title-issuance-date lang="en">Issuance Date: #</title-issuance-date>
994
- <title-issuance-date lang="zh"># 发布</title-issuance-date>
995
-
996
- <title-implementation-date lang="en">Implementation Date: #</title-implementation-date>
997
- <title-implementation-date lang="zh"># 实施</title-implementation-date>
998
-
999
- <title-obligation-normative lang="en">normative</title-obligation-normative>
1000
- <title-obligation-normative lang="zh">规范性附录</title-obligation-normative>
1001
-
1002
- <title-caution lang="en">CAUTION</title-caution>
1003
- <title-caution lang="zh">注意</title-caution>
1004
-
1005
- <title-warning lang="en">WARNING</title-warning>
1006
- <title-warning lang="zh">警告</title-warning>
1007
-
1008
- <title-amendment lang="en">AMENDMENT</title-amendment>
1009
-
1010
907
  <title-continued lang="en">(continued)</title-continued>
1011
908
  <title-continued lang="fr">(continué)</title-continued>
1012
909
 
@@ -1119,6 +1016,7 @@
1119
1016
 
1120
1017
 
1121
1018
 
1019
+
1122
1020
  </xsl:attribute-set><xsl:attribute-set name="example-body-style">
1123
1021
 
1124
1022
  <xsl:attribute name="margin-left">12.5mm</xsl:attribute>
@@ -1126,12 +1024,13 @@
1126
1024
 
1127
1025
 
1128
1026
 
1027
+
1129
1028
  </xsl:attribute-set><xsl:attribute-set name="example-name-style">
1029
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
1130
1030
 
1131
1031
  <xsl:attribute name="margin-top">12pt</xsl:attribute>
1132
1032
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
1133
1033
  <xsl:attribute name="font-weight">bold</xsl:attribute>
1134
- <xsl:attribute name="keep-with-next">always</xsl:attribute>
1135
1034
 
1136
1035
 
1137
1036
 
@@ -1166,6 +1065,7 @@
1166
1065
 
1167
1066
 
1168
1067
 
1068
+
1169
1069
  </xsl:attribute-set><xsl:attribute-set name="termexample-name-style">
1170
1070
 
1171
1071
  <xsl:attribute name="padding-right">10mm</xsl:attribute>
@@ -1512,7 +1412,7 @@
1512
1412
 
1513
1413
 
1514
1414
 
1515
- </xsl:attribute-set><xsl:variable name="border-block-added">2.5pt solid rgb(0, 176, 80)</xsl:variable><xsl:variable name="border-block-deleted">2.5pt solid rgb(255, 0, 0)</xsl:variable><xsl:template name="OLD_processPrefaceSectionsDefault_Contents">
1415
+ </xsl:attribute-set><xsl:variable name="border-block-added">2.5pt solid rgb(0, 176, 80)</xsl:variable><xsl:variable name="border-block-deleted">2.5pt solid rgb(255, 0, 0)</xsl:variable><xsl:variable name="ace_tag">ace-tag_</xsl:variable><xsl:template name="OLD_processPrefaceSectionsDefault_Contents">
1516
1416
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
1517
1417
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
1518
1418
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
@@ -2776,12 +2676,9 @@
2776
2676
  <fo:block margin-bottom="12pt" text-align="left">
2777
2677
 
2778
2678
  <xsl:variable name="title-where">
2779
-
2780
-
2781
- <xsl:call-template name="getTitle">
2782
- <xsl:with-param name="name" select="'title-where'"/>
2783
- </xsl:call-template>
2784
-
2679
+ <xsl:call-template name="getLocalizedString">
2680
+ <xsl:with-param name="key">where</xsl:with-param>
2681
+ </xsl:call-template>
2785
2682
  </xsl:variable>
2786
2683
  <xsl:value-of select="$title-where"/><xsl:text> </xsl:text>
2787
2684
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
@@ -2797,12 +2694,9 @@
2797
2694
 
2798
2695
 
2799
2696
  <xsl:variable name="title-where">
2800
-
2801
-
2802
- <xsl:call-template name="getTitle">
2803
- <xsl:with-param name="name" select="'title-where'"/>
2804
- </xsl:call-template>
2805
-
2697
+ <xsl:call-template name="getLocalizedString">
2698
+ <xsl:with-param name="key">where</xsl:with-param>
2699
+ </xsl:call-template>
2806
2700
  </xsl:variable>
2807
2701
  <xsl:value-of select="$title-where"/>
2808
2702
  </fo:block>
@@ -2814,12 +2708,9 @@
2814
2708
 
2815
2709
 
2816
2710
  <xsl:variable name="title-key">
2817
-
2818
-
2819
- <xsl:call-template name="getTitle">
2820
- <xsl:with-param name="name" select="'title-key'"/>
2821
- </xsl:call-template>
2822
-
2711
+ <xsl:call-template name="getLocalizedString">
2712
+ <xsl:with-param name="key">key</xsl:with-param>
2713
+ </xsl:call-template>
2823
2714
  </xsl:variable>
2824
2715
  <xsl:value-of select="$title-key"/>
2825
2716
  </fo:block>
@@ -3147,6 +3038,15 @@
3147
3038
  </fo:inline>
3148
3039
  </xsl:template><xsl:template match="*[local-name()='add']">
3149
3040
  <xsl:choose>
3041
+ <xsl:when test="starts-with(., $ace_tag)"> <!-- examples: ace-tag_A1_start, ace-tag_A2_end, C1_start, AC_start -->
3042
+ <fo:inline>
3043
+ <xsl:call-template name="insertTag">
3044
+ <xsl:with-param name="type" select="substring-after(substring-after(., $ace_tag), '_')"/> <!-- start or end -->
3045
+ <xsl:with-param name="kind" select="substring(substring-before(substring-after(., $ace_tag), '_'), 1, 1)"/> <!-- A or C -->
3046
+ <xsl:with-param name="value" select="substring(substring-before(substring-after(., $ace_tag), '_'), 2)"/> <!-- 1, 2, C -->
3047
+ </xsl:call-template>
3048
+ </fo:inline>
3049
+ </xsl:when>
3150
3050
  <xsl:when test="@amendment">
3151
3051
  <fo:inline>
3152
3052
  <xsl:call-template name="insertTag">
@@ -3181,7 +3081,6 @@
3181
3081
  </fo:inline>
3182
3082
  </xsl:otherwise>
3183
3083
  </xsl:choose>
3184
-
3185
3084
  </xsl:template><xsl:template name="insertTag">
3186
3085
  <xsl:param name="type"/>
3187
3086
  <xsl:param name="kind"/>
@@ -3197,14 +3096,14 @@
3197
3096
  <xsl:attribute name="scaling">uniform</xsl:attribute>
3198
3097
  <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
3199
3098
  <g>
3200
- <xsl:if test="$type = 'closing'">
3099
+ <xsl:if test="$type = 'closing' or $type = 'end'">
3201
3100
  <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
3202
3101
  </xsl:if>
3203
3102
  <polyline points="0,0 {$maxwidth},0 {$maxwidth + 30},40 {$maxwidth},80 0,80 " stroke="black" stroke-width="5" fill="white"/>
3204
3103
  <line x1="0" y1="0" x2="0" y2="80" stroke="black" stroke-width="20"/>
3205
3104
  </g>
3206
3105
  <text font-family="Arial" x="15" y="57" font-size="40pt">
3207
- <xsl:if test="$type = 'closing'">
3106
+ <xsl:if test="$type = 'closing' or $type = 'end'">
3208
3107
  <xsl:attribute name="x">25</xsl:attribute>
3209
3108
  </xsl:if>
3210
3109
  <xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan>
@@ -3697,9 +3596,9 @@
3697
3596
  <fo:inline role="H{$level}"><xsl:apply-templates/></fo:inline>
3698
3597
  </xsl:template><xsl:template match="*[local-name()='appendix']//*[local-name()='example']" priority="2">
3699
3598
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-example-style">
3700
- <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
3599
+ <xsl:apply-templates select="*[local-name()='name']"/>
3701
3600
  </fo:block>
3702
- <xsl:apply-templates/>
3601
+ <xsl:apply-templates select="node()[not(local-name()='name')]"/>
3703
3602
  </xsl:template><xsl:template match="*[local-name() = 'callout']">
3704
3603
  <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link>
3705
3604
  </xsl:template><xsl:template match="*[local-name() = 'annotation']">
@@ -4296,11 +4195,58 @@
4296
4195
  <xsl:value-of select="."/>
4297
4196
  </xsl:template><xsl:template match="node()" mode="contents">
4298
4197
  <xsl:apply-templates mode="contents"/>
4198
+ </xsl:template><xsl:template match="*[local-name() = 'p'][@type = 'floating-title']" priority="2" mode="contents">
4199
+ <xsl:variable name="level">
4200
+ <xsl:call-template name="getLevel">
4201
+ <xsl:with-param name="depth" select="@depth"/>
4202
+ </xsl:call-template>
4203
+ </xsl:variable>
4204
+
4205
+ <xsl:variable name="section">
4206
+ <xsl:value-of select="*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
4207
+ </xsl:variable>
4208
+
4209
+ <xsl:variable name="type">floating-title</xsl:variable>
4210
+
4211
+ <xsl:variable name="display">
4212
+ <xsl:choose>
4213
+ <xsl:when test="normalize-space(@id) = ''">false</xsl:when>
4214
+ <xsl:when test="$level &lt;= $toc_level">true</xsl:when>
4215
+ <xsl:otherwise>false</xsl:otherwise>
4216
+ </xsl:choose>
4217
+ </xsl:variable>
4218
+
4219
+ <xsl:variable name="skip">false</xsl:variable>
4220
+
4221
+ <xsl:if test="$skip = 'false'">
4222
+
4223
+ <xsl:variable name="title">
4224
+ <xsl:choose>
4225
+ <xsl:when test="*[local-name() = 'tab']">
4226
+ <xsl:copy-of select="*[local-name() = 'tab'][1]/following-sibling::node()"/>
4227
+ </xsl:when>
4228
+ <xsl:otherwise>
4229
+ <xsl:copy-of select="node()"/>
4230
+ </xsl:otherwise>
4231
+ </xsl:choose>
4232
+ </xsl:variable>
4233
+
4234
+ <xsl:variable name="root">
4235
+ <xsl:if test="ancestor-or-self::*[local-name() = 'preface']">preface</xsl:if>
4236
+ <xsl:if test="ancestor-or-self::*[local-name() = 'annex']">annex</xsl:if>
4237
+ </xsl:variable>
4238
+
4239
+ <item id="{@id}" level="{$level}" section="{$section}" type="{$type}" root="{$root}" display="{$display}">
4240
+ <title>
4241
+ <xsl:apply-templates select="xalan:nodeset($title)" mode="contents_item"/>
4242
+ </title>
4243
+ </item>
4244
+ </xsl:if>
4299
4245
  </xsl:template><xsl:template match="node()" mode="bookmarks">
4300
4246
  <xsl:apply-templates mode="bookmarks"/>
4301
4247
  </xsl:template><xsl:template match="*[local-name() = 'title' or local-name() = 'name']//*[local-name() = 'stem']" mode="contents">
4302
4248
  <xsl:apply-templates select="."/>
4303
- </xsl:template><xsl:template match="*[local-name() = 'references'][@hidden='true']" mode="contents" priority="3"/><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
4249
+ </xsl:template><xsl:template match="*[local-name() = 'references'][@hidden='true']" mode="contents" priority="3"/><xsl:template match="*[local-name() = 'references']/*[local-name() = 'bibitem']" mode="contents"/><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
4304
4250
  <xsl:apply-templates mode="bookmarks"/>
4305
4251
  </xsl:template><xsl:template name="addBookmarks">
4306
4252
  <xsl:param name="contents"/>
@@ -4471,7 +4417,10 @@
4471
4417
  </fo:block>
4472
4418
  </xsl:if>
4473
4419
  </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'fn']" priority="2"/><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note']"/><xsl:template match="*[local-name() = 'title']" mode="contents_item">
4474
- <xsl:apply-templates mode="contents_item"/>
4420
+ <xsl:param name="mode">bookmarks</xsl:param>
4421
+ <xsl:apply-templates mode="contents_item">
4422
+ <xsl:with-param name="mode" select="$mode"/>
4423
+ </xsl:apply-templates>
4475
4424
  <!-- <xsl:text> </xsl:text> -->
4476
4425
  </xsl:template><xsl:template name="getSection">
4477
4426
  <xsl:value-of select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
@@ -4544,6 +4493,18 @@
4544
4493
  <xsl:copy-of select="."/>
4545
4494
  </xsl:template><xsl:template match="*[local-name() = 'br']" mode="contents_item">
4546
4495
  <xsl:text> </xsl:text>
4496
+ </xsl:template><xsl:template match="*[local-name() = 'name']" mode="contents_item">
4497
+ <xsl:param name="mode">bookmarks</xsl:param>
4498
+ <xsl:apply-templates mode="contents_item">
4499
+ <xsl:with-param name="mode" select="$mode"/>
4500
+ </xsl:apply-templates>
4501
+ </xsl:template><xsl:template match="*[local-name() = 'add'][starts-with(text(), $ace_tag)]" mode="contents_item">
4502
+ <xsl:param name="mode">bookmarks</xsl:param>
4503
+ <xsl:if test="$mode = 'contents'">
4504
+ <xsl:copy>
4505
+ <xsl:apply-templates mode="contents_item"/>
4506
+ </xsl:copy>
4507
+ </xsl:if>
4547
4508
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
4548
4509
 
4549
4510
  <fo:block-container margin-left="0mm">
@@ -4880,42 +4841,48 @@
4880
4841
  <fo:block id="{@id}" xsl:use-attribute-sets="example-style">
4881
4842
 
4882
4843
 
4883
- <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
4884
-
4885
- <xsl:variable name="element">
4844
+ <xsl:variable name="fo_element">
4845
+ <xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl']">block</xsl:if>
4886
4846
  block
4887
4847
 
4888
- <xsl:if test=".//*[local-name() = 'table']">block</xsl:if>
4848
+
4889
4849
  </xsl:variable>
4890
4850
 
4851
+ <!-- display 'EXAMPLE' -->
4852
+ <xsl:apply-templates select="*[local-name()='name']">
4853
+ <xsl:with-param name="fo_element" select="$fo_element"/>
4854
+ </xsl:apply-templates>
4855
+
4891
4856
  <xsl:choose>
4892
- <xsl:when test="contains(normalize-space($element), 'block')">
4893
- <fo:block xsl:use-attribute-sets="example-body-style">
4894
- <xsl:apply-templates/>
4895
- </fo:block>
4857
+ <xsl:when test="contains(normalize-space($fo_element), 'block')">
4858
+ <fo:block-container xsl:use-attribute-sets="example-body-style">
4859
+ <fo:block-container margin-left="0mm" margin-right="0mm">
4860
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]">
4861
+ <xsl:with-param name="fo_element" select="$fo_element"/>
4862
+ </xsl:apply-templates>
4863
+ </fo:block-container>
4864
+ </fo:block-container>
4896
4865
  </xsl:when>
4897
4866
  <xsl:otherwise>
4898
4867
  <fo:inline>
4899
- <xsl:apply-templates/>
4868
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]">
4869
+ <xsl:with-param name="fo_element" select="$fo_element"/>
4870
+ </xsl:apply-templates>
4900
4871
  </fo:inline>
4901
4872
  </xsl:otherwise>
4902
4873
  </xsl:choose>
4903
4874
 
4904
4875
  </fo:block>
4905
- </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']" mode="presentation">
4906
-
4907
- <xsl:variable name="element">
4908
- block
4909
-
4910
- <xsl:if test="following-sibling::*[1][local-name() = 'table']">block</xsl:if>
4911
- </xsl:variable>
4876
+ </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']">
4877
+ <xsl:param name="fo_element">block</xsl:param>
4878
+
4912
4879
  <xsl:choose>
4913
4880
  <xsl:when test="ancestor::*[local-name() = 'appendix']">
4914
4881
  <fo:inline>
4915
4882
  <xsl:apply-templates/>
4916
4883
  </fo:inline>
4917
4884
  </xsl:when>
4918
- <xsl:when test="contains(normalize-space($element), 'block')">
4885
+ <xsl:when test="contains(normalize-space($fo_element), 'block')">
4919
4886
  <fo:block xsl:use-attribute-sets="example-name-style">
4920
4887
  <xsl:apply-templates/>
4921
4888
  </fo:block>
@@ -4928,14 +4895,15 @@
4928
4895
  </xsl:choose>
4929
4896
 
4930
4897
  </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'p']">
4898
+ <xsl:param name="fo_element">block</xsl:param>
4899
+
4931
4900
  <xsl:variable name="num"><xsl:number/></xsl:variable>
4932
4901
  <xsl:variable name="element">
4933
- block
4934
-
4935
4902
 
4903
+ <xsl:value-of select="$fo_element"/>
4936
4904
  </xsl:variable>
4937
4905
  <xsl:choose>
4938
- <xsl:when test="normalize-space($element) = 'block'">
4906
+ <xsl:when test="starts-with(normalize-space($element), 'block')">
4939
4907
  <fo:block xsl:use-attribute-sets="example-p-style">
4940
4908
 
4941
4909
  <xsl:apply-templates/>
@@ -5003,12 +4971,9 @@
5003
4971
  </fo:basic-link>
5004
4972
  </xsl:template><xsl:template match="*[local-name() = 'modification']">
5005
4973
  <xsl:variable name="title-modified">
5006
-
5007
-
5008
- <xsl:call-template name="getTitle">
5009
- <xsl:with-param name="name" select="'title-modified'"/>
5010
- </xsl:call-template>
5011
-
4974
+ <xsl:call-template name="getLocalizedString">
4975
+ <xsl:with-param name="key">modified</xsl:with-param>
4976
+ </xsl:call-template>
5012
4977
  </xsl:variable>
5013
4978
 
5014
4979
  <xsl:variable name="text"><xsl:apply-templates/></xsl:variable>
@@ -5192,12 +5157,9 @@
5192
5157
  </fo:block>
5193
5158
  </xsl:template><xsl:template match="*[local-name() = 'deprecates']">
5194
5159
  <xsl:variable name="title-deprecated">
5195
-
5196
- <xsl:call-template name="getLocalizedString">
5197
- <xsl:with-param name="key">deprecated</xsl:with-param>
5198
- </xsl:call-template>
5199
-
5200
-
5160
+ <xsl:call-template name="getLocalizedString">
5161
+ <xsl:with-param name="key">deprecated</xsl:with-param>
5162
+ </xsl:call-template>
5201
5163
  </xsl:variable>
5202
5164
  <fo:block xsl:use-attribute-sets="deprecates-style">
5203
5165
  <xsl:value-of select="$title-deprecated"/>: <xsl:apply-templates/>
@@ -5206,6 +5168,8 @@
5206
5168
  <xsl:if test="*[local-name() = 'strong']">
5207
5169
  <xsl:attribute name="font-weight">normal</xsl:attribute>
5208
5170
  </xsl:if>
5171
+ </xsl:template><xsl:template match="*[local-name() = 'preferred']/text()[contains(., ';')] | *[local-name() = 'preferred']/*[local-name() = 'strong']/text()[contains(., ';')]">
5172
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.), ';', $linebreak)"/>
5209
5173
  </xsl:template><xsl:template match="*[local-name() = 'definition']">
5210
5174
  <fo:block xsl:use-attribute-sets="definition-style">
5211
5175
  <xsl:apply-templates/>
@@ -5533,16 +5497,73 @@
5533
5497
 
5534
5498
 
5535
5499
 
5536
-
5500
+
5501
+
5502
+
5503
+ <!-- start CSA bibtem processing -->
5504
+ <xsl:if test=".//csa:fn">
5505
+ <xsl:attribute name="line-height-shift-adjustment">disregard-shifts</xsl:attribute>
5506
+ </xsl:if>
5507
+ <xsl:choose>
5508
+ <xsl:when test="csa:formattedref">
5509
+ <xsl:apply-templates select="csa:formattedref"/>
5510
+ </xsl:when>
5511
+ <xsl:otherwise>
5512
+ <xsl:for-each select="csa:contributor[csa:role/@type='publisher']/csa:organization/csa:name">
5513
+ <xsl:apply-templates/>
5514
+ <xsl:if test="position() != last()">, </xsl:if>
5515
+ <xsl:if test="position() = last()">: </xsl:if>
5516
+ </xsl:for-each>
5517
+ <!-- csa:docidentifier -->
5518
+ <!-- <xsl:if test="csa:docidentifier">
5519
+ <xsl:value-of select="csa:docidentifier/@type"/><xsl:text> </xsl:text>
5520
+ <xsl:value-of select="csa:docidentifier"/>
5521
+ </xsl:if> -->
5522
+ <xsl:value-of select="csa:docidentifier[not(@type = 'metanorma-ordinal')]"/>
5523
+ <xsl:apply-templates select="csa:note"/>
5524
+ <xsl:if test="csa:docidentifier[not(@type = 'metanorma-ordinal')]">, </xsl:if>
5525
+ <fo:inline font-style="italic">
5526
+ <xsl:choose>
5527
+ <xsl:when test="csa:title[@type = 'main' and @language = 'en']">
5528
+ <xsl:value-of select="csa:title[@type = 'main' and @language = 'en']"/><xsl:text>. </xsl:text>
5529
+ </xsl:when>
5530
+ <xsl:otherwise>
5531
+ <xsl:value-of select="csa:title"/><xsl:text>. </xsl:text>
5532
+ </xsl:otherwise>
5533
+ </xsl:choose>
5534
+ </fo:inline>
5535
+ <xsl:for-each select="csa:contributor[csa:role/@type='publisher']/csa:organization/csa:name">
5536
+ <xsl:apply-templates/>
5537
+ <xsl:if test="position() != last()">, </xsl:if>
5538
+ </xsl:for-each>
5539
+ <xsl:if test="csa:date[@type='published']/csa:on">
5540
+ <xsl:text>(</xsl:text><xsl:value-of select="csa:date[@type='published']/csa:on"/><xsl:text>)</xsl:text>
5541
+ </xsl:if>
5542
+ </xsl:otherwise>
5543
+ </xsl:choose>
5544
+ <!-- end CSA bibtem processing -->
5545
+
5546
+
5547
+
5548
+
5537
5549
 
5538
5550
 
5539
5551
 
5540
5552
 
5541
5553
 
5554
+
5555
+
5556
+
5557
+
5558
+ <!-- end MPFD bibitem processing -->
5559
+
5560
+ <!-- start M3D bibitem processing -->
5542
5561
 
5543
5562
 
5563
+
5564
+
5544
5565
  </xsl:template><xsl:template name="processBibitemDocId">
5545
- <xsl:variable name="_doc_ident" select="*[local-name() = 'docidentifier'][not(@type = 'DOI' or @type = 'metanorma' or @type = 'ISSN' or @type = 'ISBN' or @type = 'rfc-anchor')]"/>
5566
+ <xsl:variable name="_doc_ident" select="*[local-name() = 'docidentifier'][not(@type = 'DOI' or @type = 'metanorma' or @type = 'metanorma-ordinal' or @type = 'ISSN' or @type = 'ISBN' or @type = 'rfc-anchor')]"/>
5546
5567
  <xsl:choose>
5547
5568
  <xsl:when test="normalize-space($_doc_ident) != ''">
5548
5569
  <!-- <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'DOI' or @type = 'metanorma' or @type = 'ISSN' or @type = 'ISBN' or @type = 'rfc-anchor')]/@type"/>
@@ -5556,7 +5577,7 @@
5556
5577
  <xsl:if test="$type != ''">
5557
5578
  <xsl:value-of select="$type"/><xsl:text> </xsl:text>
5558
5579
  </xsl:if> -->
5559
- <xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]"/>
5580
+ <xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma') and not(@type = 'metanorma-ordinal')]"/>
5560
5581
  </xsl:otherwise>
5561
5582
  </xsl:choose>
5562
5583
  </xsl:template><xsl:template name="processPersonalAuthor">
@@ -5662,8 +5683,12 @@
5662
5683
  <fo:block> </fo:block>
5663
5684
  </fo:block-container>
5664
5685
  </xsl:template><xsl:variable name="toc_level">
5686
+ <!-- https://www.metanorma.org/author/ref/document-attributes/ -->
5687
+ <xsl:variable name="htmltoclevels" select="normalize-space(//*[local-name() = 'misc-container']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name']/text() = 'HTML TOC Heading Levels']/*[local-name() = 'value'])"/> <!-- :htmltoclevels Number of table of contents levels to render in HTML/PDF output; used to override :toclevels:-->
5688
+ <xsl:variable name="toclevels" select="normalize-space(//*[local-name() = 'misc-container']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name']/text() = 'TOC Heading Levels']/*[local-name() = 'value'])"/> <!-- Number of table of contents levels to render -->
5665
5689
  <xsl:choose>
5666
- <xsl:when test="1 = 2"/> <!-- to do https://github.com/metanorma/mn-native-pdf/issues/337: if there is value in xml -->
5690
+ <xsl:when test="$htmltoclevels != ''"><xsl:value-of select="number($htmltoclevels)"/></xsl:when> <!-- if there is value in xml -->
5691
+ <xsl:when test="$toclevels != ''"><xsl:value-of select="number($toclevels)"/></xsl:when> <!-- if there is value in xml -->
5667
5692
  <xsl:otherwise><!-- default value -->
5668
5693
 
5669
5694
 
@@ -5765,7 +5790,7 @@
5765
5790
  </td>
5766
5791
  </xsl:for-each>
5767
5792
  <td>333</td> <!-- page number, just for fill -->
5768
- </xsl:template><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']"/><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
5793
+ </xsl:template><xsl:template match="*[local-name() = 'variant-title']"/><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
5769
5794
  <fo:inline padding-right="5mm"> </fo:inline>
5770
5795
  <fo:inline><xsl:apply-templates/></fo:inline>
5771
5796
  </xsl:template><xsl:template match="*[local-name() = 'blacksquare']" name="blacksquare">
@@ -6137,9 +6162,15 @@
6137
6162
  </xsl:template><xsl:template name="getLocalizedString">
6138
6163
  <xsl:param name="key"/>
6139
6164
  <xsl:param name="formatted">false</xsl:param>
6165
+ <xsl:param name="lang"/>
6140
6166
 
6141
6167
  <xsl:variable name="curr_lang">
6142
- <xsl:call-template name="getLang"/>
6168
+ <xsl:choose>
6169
+ <xsl:when test="$lang != ''"><xsl:value-of select="$lang"/></xsl:when>
6170
+ <xsl:otherwise>
6171
+ <xsl:call-template name="getLang"/>
6172
+ </xsl:otherwise>
6173
+ </xsl:choose>
6143
6174
  </xsl:variable>
6144
6175
 
6145
6176
  <xsl:variable name="data_value">
File without changes
File without changes
File without changes
@@ -9,9 +9,9 @@ require "isodoc/csa/presentation_xml_convert"
9
9
  require "metanorma/csa"
10
10
  require "fileutils"
11
11
 
12
- module Asciidoctor
12
+ module Metanorma
13
13
  module Csa
14
- class Converter < ::Asciidoctor::Generic::Converter
14
+ class Converter < ::Metanorma::Generic::Converter
15
15
  XML_ROOT_TAG = "csa-standard"
16
16
  XML_NAMESPACE = "https://www.metanorma.org/ns/csa"
17
17
 
File without changes
File without changes
File without changes
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Csa
3
- VERSION = "1.9.5".freeze
3
+ VERSION = "2.0.0".freeze
4
4
  end
5
5
  end
data/lib/metanorma-csa.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  require 'asciidoctor' unless defined? Asciidoctor::Converter
2
- require_relative 'asciidoctor/csa/converter'
2
+ require_relative 'metanorma/csa/converter'
3
3
  require_relative 'isodoc/csa/html_convert'
4
4
  require_relative 'isodoc/csa/pdf_convert'
5
5
  require_relative 'isodoc/csa/word_convert'
@@ -28,7 +28,7 @@ Gem::Specification.new do |spec|
28
28
  spec.require_paths = ["lib"]
29
29
  spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
30
30
 
31
- spec.add_dependency "metanorma-generic", "~> 1.11.0"
31
+ spec.add_dependency "metanorma-generic", "~> 2.0.0"
32
32
 
33
33
  spec.add_development_dependency "debug"
34
34
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
data/metanorma.yml CHANGED
@@ -6,7 +6,7 @@ xml_root_tag: csa-standard
6
6
  html_bodyfont: 'Lato,"Source Sans Pro",sans-serif'
7
7
  html_headerfont: 'Lato,"Source Sans Pro",sans-serif'
8
8
  html_monospacefont: '"Source Code Pro",monospace'
9
- validate_rng_file: lib/asciidoctor/csa/csa.rng
9
+ validate_rng_file: lib/metanorma/csa/csa.rng
10
10
  htmlcoverpage: lib/isodoc/csa/html/html_csa_titlepage.html
11
11
  htmlintropage: lib/isodoc/csa/html/html_csa_intro.html
12
12
  htmlstylesheet: lib/isodoc/csa/html/htmlstyle.scss
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-csa
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.5
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-12-27 00:00:00.000000000 Z
11
+ date: 2022-01-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-generic
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.11.0
19
+ version: 2.0.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 1.11.0
26
+ version: 2.0.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: debug
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -188,14 +188,6 @@ files:
188
188
  - bin/console
189
189
  - bin/rspec
190
190
  - bin/setup
191
- - lib/asciidoctor/csa.rb
192
- - lib/asciidoctor/csa/basicdoc.rng
193
- - lib/asciidoctor/csa/biblio.rng
194
- - lib/asciidoctor/csa/boilerplate.xml
195
- - lib/asciidoctor/csa/converter.rb
196
- - lib/asciidoctor/csa/csa.rng
197
- - lib/asciidoctor/csa/isodoc.rng
198
- - lib/asciidoctor/csa/reqt.rng
199
191
  - lib/isodoc/csa/base_convert.rb
200
192
  - lib/isodoc/csa/csa.standard.xsl
201
193
  - lib/isodoc/csa/html/csa-logo-white.png
@@ -225,7 +217,14 @@ files:
225
217
  - lib/isodoc/csa/xref.rb
226
218
  - lib/metanorma-csa.rb
227
219
  - lib/metanorma/csa.rb
220
+ - lib/metanorma/csa/basicdoc.rng
221
+ - lib/metanorma/csa/biblio.rng
222
+ - lib/metanorma/csa/boilerplate.xml
223
+ - lib/metanorma/csa/converter.rb
224
+ - lib/metanorma/csa/csa.rng
225
+ - lib/metanorma/csa/isodoc.rng
228
226
  - lib/metanorma/csa/processor.rb
227
+ - lib/metanorma/csa/reqt.rng
229
228
  - lib/metanorma/csa/version.rb
230
229
  - metanorma-csa.gemspec
231
230
  - metanorma.yml
@@ -1,5 +0,0 @@
1
- module Asciidoctor
2
- module Csa
3
- # Your code goes here...
4
- end
5
- end