metanorma-cc 1.8.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: 8ca9d11e9a1712f3e8b12ff30290c84a576ddaf07da9345dfe2db4bed5fc6a97
4
- data.tar.gz: e7cfe501e34131655a6f6d6af1fa7281bdadf83cddd4360c7d69ee0c8ab592ac
3
+ metadata.gz: a13c3b9103cb6e5549dfb198916febc6ee0145b699b64f316a8396bc31000b94
4
+ data.tar.gz: 36f66bbe98c4101a13ec38a4d42b91420da8f90c01fb6fc1ec5dab0950bc87eb
5
5
  SHA512:
6
- metadata.gz: c0b42e16d5b0a2ed8c8fc9d363c6382a2c37cff259a581be0cd06a77f97999a5697de53917d1b9ced4fea904498d3ebb5e17bb8de34f5048c82f513909862a31
7
- data.tar.gz: 83dad53d5276c70a3e5cd1eb67134e035b91f84f2b2a390bf6c38843f09c4f8e14914013d70cbe021e21506ffef5367617fd5e927da32dfa1a5e8b06ce55e4f4
6
+ metadata.gz: 64d050b1f7e1387e99302baa92716dffd59a6e23363190a6d1065bbd2e223e33be46ded2716cf46b9b7e921575d14bbca73d467661ed575b7df2d181b1b9ba7c
7
+ data.tar.gz: 89e4fa2b0c5f6bb5994ccbde444225e1325f8304ceb41b5255b2259a379825d37d111727b993b7ca79854768d9225f0d66f9662f048a1d128ad5999ee6fb7987
@@ -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
@@ -1,3 +1,8 @@
1
1
  .DS_Store
2
2
 
3
3
  .rubocop-https--*
4
+
5
+ /.rspec_status
6
+ /Gemfile.devel
7
+ /Gemfile.lock
8
+ /coverage/
data/bin/console CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require "bundler/setup"
4
- require "asciidoctor/csd"
4
+ require "metanorma/cc"
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.
@@ -510,30 +510,7 @@
510
510
 
511
511
  <xsl:template match="csd:bibitem">
512
512
  <fo:block id="{@id}" margin-bottom="6pt"> <!-- 12 pt -->
513
- <xsl:if test=".//csd:fn">
514
- <xsl:attribute name="line-height-shift-adjustment">disregard-shifts</xsl:attribute>
515
- </xsl:if>
516
- <!-- csd:docidentifier -->
517
- <xsl:if test="csd:docidentifier">
518
- <xsl:choose>
519
- <xsl:when test="csd:docidentifier/@type = 'metanorma'"/>
520
- <xsl:otherwise>
521
- <xsl:value-of select="csd:docidentifier"/>
522
- </xsl:otherwise>
523
- </xsl:choose>
524
- </xsl:if>
525
- <xsl:apply-templates select="csd:note"/>
526
- <xsl:if test="csd:docidentifier">, </xsl:if>
527
- <fo:inline font-style="italic">
528
- <xsl:choose>
529
- <xsl:when test="csd:title[@type = 'main' and @language = 'en']">
530
- <xsl:value-of select="csd:title[@type = 'main' and @language = 'en']"/>
531
- </xsl:when>
532
- <xsl:otherwise>
533
- <xsl:value-of select="csd:title"/>
534
- </xsl:otherwise>
535
- </xsl:choose>
536
- </fo:inline>
513
+ <xsl:call-template name="processBibitem"/>
537
514
  </fo:block>
538
515
  </xsl:template>
539
516
 
@@ -654,39 +631,24 @@
654
631
  <fo:list-item-label end-indent="label-end()">
655
632
  <fo:block>
656
633
  <fo:inline id="{@id}">
657
- <xsl:number format="[1]"/>
634
+ <xsl:value-of select="*[local-name()='docidentifier'][@type = 'metanorma-ordinal']"/>
635
+ <xsl:if test="not(*[local-name()='docidentifier'][@type = 'metanorma-ordinal'])">
636
+ <xsl:number format="[1]"/>
637
+ </xsl:if>
658
638
  </fo:inline>
659
639
  </fo:block>
660
640
  </fo:list-item-label>
661
641
  <fo:list-item-body start-indent="body-start()">
662
642
  <fo:block>
663
- <xsl:if test="csd:docidentifier">
664
- <xsl:choose>
665
- <xsl:when test="csd:docidentifier/@type = 'metanorma'"/>
666
- <xsl:otherwise><fo:inline><xsl:value-of select="csd:docidentifier"/><xsl:apply-templates select="csd:note"/>, </fo:inline></xsl:otherwise>
667
- </xsl:choose>
668
-
669
- </xsl:if>
670
- <xsl:choose>
671
- <xsl:when test="csd:title[@type = 'main' and @language = 'en']">
672
- <xsl:apply-templates select="csd:title[@type = 'main' and @language = 'en']"/>
673
- </xsl:when>
674
- <xsl:otherwise>
675
- <xsl:apply-templates select="csd:title"/>
676
- </xsl:otherwise>
677
- </xsl:choose>
678
- <xsl:apply-templates select="csd:formattedref"/>
643
+ <xsl:call-template name="processBibitem"/>
679
644
  </fo:block>
680
645
  </fo:list-item-body>
681
646
  </fo:list-item>
682
647
  </fo:list-block>
683
648
  </xsl:template>
684
649
 
685
- <!-- <xsl:template match="csd:references[@id = '_bibliography']/csd:bibitem" mode="contents"/> -->
686
- <xsl:template match="csd:references[not(@normative='true')]/csd:bibitem" mode="contents"/>
687
-
688
650
  <!-- <xsl:template match="csd:references[@id = '_bibliography']/csd:bibitem/csd:title"> -->
689
- <xsl:template match="csd:references[not(@normative='true')]/csd:bibitem/csd:title">
651
+ <xsl:template match="csd:references/csd:bibitem/csd:title">
690
652
  <fo:inline font-style="italic">
691
653
  <xsl:apply-templates/>
692
654
  </fo:inline>
@@ -796,13 +758,6 @@
796
758
 
797
759
  <xsl:variable name="titles" select="xalan:nodeset($titles_)"/><xsl:variable name="titles_">
798
760
 
799
- <title-annex lang="en">Annex </title-annex>
800
- <title-annex lang="fr">Annexe </title-annex>
801
-
802
- <title-annex lang="zh">Annex </title-annex>
803
-
804
-
805
-
806
761
  <title-edition lang="en">
807
762
 
808
763
  <xsl:text>Edition </xsl:text>
@@ -816,7 +771,8 @@
816
771
 
817
772
  </title-edition>
818
773
 
819
-
774
+
775
+ <!-- These titles of Table of contents renders different than determined in localized-strings -->
820
776
  <title-toc lang="en">
821
777
 
822
778
  <xsl:text>Contents</xsl:text>
@@ -828,21 +784,11 @@
828
784
 
829
785
  <xsl:text>Sommaire</xsl:text>
830
786
 
831
-
832
- </title-toc>
787
+ </title-toc>
833
788
 
834
789
  <title-toc lang="zh">Contents</title-toc>
835
790
 
836
791
 
837
-
838
- <title-page lang="en">Page</title-page>
839
- <title-page lang="fr">Page</title-page>
840
-
841
- <title-key lang="en">Key</title-key>
842
- <title-key lang="fr">Légende</title-key>
843
-
844
- <title-where lang="en">where</title-where>
845
- <title-where lang="fr">où</title-where>
846
792
 
847
793
  <title-descriptors lang="en">Descriptors</title-descriptors>
848
794
 
@@ -865,25 +811,6 @@
865
811
 
866
812
  </title-subpart>
867
813
 
868
- <title-modified lang="en">modified</title-modified>
869
- <title-modified lang="fr">modifiée</title-modified>
870
-
871
- <title-modified lang="zh">modified</title-modified>
872
-
873
-
874
-
875
- <title-source lang="en">
876
-
877
- <xsl:text>SOURCE</xsl:text>
878
-
879
-
880
- </title-source>
881
-
882
- <title-keywords lang="en">Keywords</title-keywords>
883
-
884
- <title-deprecated lang="en">DEPRECATED</title-deprecated>
885
- <title-deprecated lang="fr">DEPRECATED</title-deprecated>
886
-
887
814
  <title-list-tables lang="en">List of Tables</title-list-tables>
888
815
 
889
816
  <title-list-figures lang="en">List of Figures</title-list-figures>
@@ -892,37 +819,8 @@
892
819
 
893
820
  <title-list-recommendations lang="en">List of Recommendations</title-list-recommendations>
894
821
 
895
- <title-acknowledgements lang="en">Acknowledgements</title-acknowledgements>
896
-
897
- <title-abstract lang="en">Abstract</title-abstract>
898
-
899
822
  <title-summary lang="en">Summary</title-summary>
900
823
 
901
- <title-in lang="en">in </title-in>
902
-
903
- <title-partly-supercedes lang="en">Partly Supercedes </title-partly-supercedes>
904
- <title-partly-supercedes lang="zh">部分代替 </title-partly-supercedes>
905
-
906
- <title-completion-date lang="en">Completion date for this manuscript</title-completion-date>
907
- <title-completion-date lang="zh">本稿完成日期</title-completion-date>
908
-
909
- <title-issuance-date lang="en">Issuance Date: #</title-issuance-date>
910
- <title-issuance-date lang="zh"># 发布</title-issuance-date>
911
-
912
- <title-implementation-date lang="en">Implementation Date: #</title-implementation-date>
913
- <title-implementation-date lang="zh"># 实施</title-implementation-date>
914
-
915
- <title-obligation-normative lang="en">normative</title-obligation-normative>
916
- <title-obligation-normative lang="zh">规范性附录</title-obligation-normative>
917
-
918
- <title-caution lang="en">CAUTION</title-caution>
919
- <title-caution lang="zh">注意</title-caution>
920
-
921
- <title-warning lang="en">WARNING</title-warning>
922
- <title-warning lang="zh">警告</title-warning>
923
-
924
- <title-amendment lang="en">AMENDMENT</title-amendment>
925
-
926
824
  <title-continued lang="en">(continued)</title-continued>
927
825
  <title-continued lang="fr">(continué)</title-continued>
928
826
 
@@ -1034,18 +932,20 @@
1034
932
 
1035
933
 
1036
934
 
935
+
1037
936
  </xsl:attribute-set><xsl:attribute-set name="example-body-style">
1038
937
 
1039
938
 
1040
939
  <xsl:attribute name="margin-left">12.5mm</xsl:attribute>
1041
940
 
1042
941
 
942
+
1043
943
  </xsl:attribute-set><xsl:attribute-set name="example-name-style">
944
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
1044
945
 
1045
946
 
1046
947
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
1047
948
  <xsl:attribute name="font-weight">bold</xsl:attribute>
1048
- <xsl:attribute name="keep-with-next">always</xsl:attribute>
1049
949
 
1050
950
 
1051
951
 
@@ -1079,6 +979,7 @@
1079
979
 
1080
980
 
1081
981
 
982
+
1082
983
  </xsl:attribute-set><xsl:attribute-set name="termexample-name-style">
1083
984
 
1084
985
  <xsl:attribute name="padding-right">10mm</xsl:attribute>
@@ -1425,7 +1326,7 @@
1425
1326
 
1426
1327
 
1427
1328
 
1428
- </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">
1329
+ </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">
1429
1330
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
1430
1331
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
1431
1332
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
@@ -2695,12 +2596,9 @@
2695
2596
  <fo:block margin-bottom="12pt" text-align="left">
2696
2597
 
2697
2598
  <xsl:variable name="title-where">
2698
-
2699
-
2700
- <xsl:call-template name="getTitle">
2701
- <xsl:with-param name="name" select="'title-where'"/>
2702
- </xsl:call-template>
2703
-
2599
+ <xsl:call-template name="getLocalizedString">
2600
+ <xsl:with-param name="key">where</xsl:with-param>
2601
+ </xsl:call-template>
2704
2602
  </xsl:variable>
2705
2603
  <xsl:value-of select="$title-where"/><xsl:text> </xsl:text>
2706
2604
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
@@ -2716,12 +2614,9 @@
2716
2614
 
2717
2615
 
2718
2616
  <xsl:variable name="title-where">
2719
-
2720
-
2721
- <xsl:call-template name="getTitle">
2722
- <xsl:with-param name="name" select="'title-where'"/>
2723
- </xsl:call-template>
2724
-
2617
+ <xsl:call-template name="getLocalizedString">
2618
+ <xsl:with-param name="key">where</xsl:with-param>
2619
+ </xsl:call-template>
2725
2620
  </xsl:variable>
2726
2621
  <xsl:value-of select="$title-where"/>
2727
2622
  </fo:block>
@@ -2733,12 +2628,9 @@
2733
2628
 
2734
2629
 
2735
2630
  <xsl:variable name="title-key">
2736
-
2737
-
2738
- <xsl:call-template name="getTitle">
2739
- <xsl:with-param name="name" select="'title-key'"/>
2740
- </xsl:call-template>
2741
-
2631
+ <xsl:call-template name="getLocalizedString">
2632
+ <xsl:with-param name="key">key</xsl:with-param>
2633
+ </xsl:call-template>
2742
2634
  </xsl:variable>
2743
2635
  <xsl:value-of select="$title-key"/>
2744
2636
  </fo:block>
@@ -3068,6 +2960,15 @@
3068
2960
  </fo:inline>
3069
2961
  </xsl:template><xsl:template match="*[local-name()='add']">
3070
2962
  <xsl:choose>
2963
+ <xsl:when test="starts-with(., $ace_tag)"> <!-- examples: ace-tag_A1_start, ace-tag_A2_end, C1_start, AC_start -->
2964
+ <fo:inline>
2965
+ <xsl:call-template name="insertTag">
2966
+ <xsl:with-param name="type" select="substring-after(substring-after(., $ace_tag), '_')"/> <!-- start or end -->
2967
+ <xsl:with-param name="kind" select="substring(substring-before(substring-after(., $ace_tag), '_'), 1, 1)"/> <!-- A or C -->
2968
+ <xsl:with-param name="value" select="substring(substring-before(substring-after(., $ace_tag), '_'), 2)"/> <!-- 1, 2, C -->
2969
+ </xsl:call-template>
2970
+ </fo:inline>
2971
+ </xsl:when>
3071
2972
  <xsl:when test="@amendment">
3072
2973
  <fo:inline>
3073
2974
  <xsl:call-template name="insertTag">
@@ -3102,7 +3003,6 @@
3102
3003
  </fo:inline>
3103
3004
  </xsl:otherwise>
3104
3005
  </xsl:choose>
3105
-
3106
3006
  </xsl:template><xsl:template name="insertTag">
3107
3007
  <xsl:param name="type"/>
3108
3008
  <xsl:param name="kind"/>
@@ -3118,14 +3018,14 @@
3118
3018
  <xsl:attribute name="scaling">uniform</xsl:attribute>
3119
3019
  <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
3120
3020
  <g>
3121
- <xsl:if test="$type = 'closing'">
3021
+ <xsl:if test="$type = 'closing' or $type = 'end'">
3122
3022
  <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
3123
3023
  </xsl:if>
3124
3024
  <polyline points="0,0 {$maxwidth},0 {$maxwidth + 30},40 {$maxwidth},80 0,80 " stroke="black" stroke-width="5" fill="white"/>
3125
3025
  <line x1="0" y1="0" x2="0" y2="80" stroke="black" stroke-width="20"/>
3126
3026
  </g>
3127
3027
  <text font-family="Arial" x="15" y="57" font-size="40pt">
3128
- <xsl:if test="$type = 'closing'">
3028
+ <xsl:if test="$type = 'closing' or $type = 'end'">
3129
3029
  <xsl:attribute name="x">25</xsl:attribute>
3130
3030
  </xsl:if>
3131
3031
  <xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan>
@@ -3618,9 +3518,9 @@
3618
3518
  <fo:inline role="H{$level}"><xsl:apply-templates/></fo:inline>
3619
3519
  </xsl:template><xsl:template match="*[local-name()='appendix']//*[local-name()='example']" priority="2">
3620
3520
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-example-style">
3621
- <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
3521
+ <xsl:apply-templates select="*[local-name()='name']"/>
3622
3522
  </fo:block>
3623
- <xsl:apply-templates/>
3523
+ <xsl:apply-templates select="node()[not(local-name()='name')]"/>
3624
3524
  </xsl:template><xsl:template match="*[local-name() = 'callout']">
3625
3525
  <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link>
3626
3526
  </xsl:template><xsl:template match="*[local-name() = 'annotation']">
@@ -4213,11 +4113,58 @@
4213
4113
  <xsl:value-of select="."/>
4214
4114
  </xsl:template><xsl:template match="node()" mode="contents">
4215
4115
  <xsl:apply-templates mode="contents"/>
4116
+ </xsl:template><xsl:template match="*[local-name() = 'p'][@type = 'floating-title']" priority="2" mode="contents">
4117
+ <xsl:variable name="level">
4118
+ <xsl:call-template name="getLevel">
4119
+ <xsl:with-param name="depth" select="@depth"/>
4120
+ </xsl:call-template>
4121
+ </xsl:variable>
4122
+
4123
+ <xsl:variable name="section">
4124
+ <xsl:value-of select="*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
4125
+ </xsl:variable>
4126
+
4127
+ <xsl:variable name="type">floating-title</xsl:variable>
4128
+
4129
+ <xsl:variable name="display">
4130
+ <xsl:choose>
4131
+ <xsl:when test="normalize-space(@id) = ''">false</xsl:when>
4132
+ <xsl:when test="$level &lt;= $toc_level">true</xsl:when>
4133
+ <xsl:otherwise>false</xsl:otherwise>
4134
+ </xsl:choose>
4135
+ </xsl:variable>
4136
+
4137
+ <xsl:variable name="skip">false</xsl:variable>
4138
+
4139
+ <xsl:if test="$skip = 'false'">
4140
+
4141
+ <xsl:variable name="title">
4142
+ <xsl:choose>
4143
+ <xsl:when test="*[local-name() = 'tab']">
4144
+ <xsl:copy-of select="*[local-name() = 'tab'][1]/following-sibling::node()"/>
4145
+ </xsl:when>
4146
+ <xsl:otherwise>
4147
+ <xsl:copy-of select="node()"/>
4148
+ </xsl:otherwise>
4149
+ </xsl:choose>
4150
+ </xsl:variable>
4151
+
4152
+ <xsl:variable name="root">
4153
+ <xsl:if test="ancestor-or-self::*[local-name() = 'preface']">preface</xsl:if>
4154
+ <xsl:if test="ancestor-or-self::*[local-name() = 'annex']">annex</xsl:if>
4155
+ </xsl:variable>
4156
+
4157
+ <item id="{@id}" level="{$level}" section="{$section}" type="{$type}" root="{$root}" display="{$display}">
4158
+ <title>
4159
+ <xsl:apply-templates select="xalan:nodeset($title)" mode="contents_item"/>
4160
+ </title>
4161
+ </item>
4162
+ </xsl:if>
4216
4163
  </xsl:template><xsl:template match="node()" mode="bookmarks">
4217
4164
  <xsl:apply-templates mode="bookmarks"/>
4218
4165
  </xsl:template><xsl:template match="*[local-name() = 'title' or local-name() = 'name']//*[local-name() = 'stem']" mode="contents">
4219
4166
  <xsl:apply-templates select="."/>
4220
- </xsl:template><xsl:template match="*[local-name() = 'references'][@hidden='true']" mode="contents" priority="3"/><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
4167
+ </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">
4221
4168
  <xsl:apply-templates mode="bookmarks"/>
4222
4169
  </xsl:template><xsl:template name="addBookmarks">
4223
4170
  <xsl:param name="contents"/>
@@ -4388,7 +4335,10 @@
4388
4335
  </fo:block>
4389
4336
  </xsl:if>
4390
4337
  </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">
4391
- <xsl:apply-templates mode="contents_item"/>
4338
+ <xsl:param name="mode">bookmarks</xsl:param>
4339
+ <xsl:apply-templates mode="contents_item">
4340
+ <xsl:with-param name="mode" select="$mode"/>
4341
+ </xsl:apply-templates>
4392
4342
  <!-- <xsl:text> </xsl:text> -->
4393
4343
  </xsl:template><xsl:template name="getSection">
4394
4344
  <xsl:value-of select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
@@ -4461,6 +4411,18 @@
4461
4411
  <xsl:copy-of select="."/>
4462
4412
  </xsl:template><xsl:template match="*[local-name() = 'br']" mode="contents_item">
4463
4413
  <xsl:text> </xsl:text>
4414
+ </xsl:template><xsl:template match="*[local-name() = 'name']" mode="contents_item">
4415
+ <xsl:param name="mode">bookmarks</xsl:param>
4416
+ <xsl:apply-templates mode="contents_item">
4417
+ <xsl:with-param name="mode" select="$mode"/>
4418
+ </xsl:apply-templates>
4419
+ </xsl:template><xsl:template match="*[local-name() = 'add'][starts-with(text(), $ace_tag)]" mode="contents_item">
4420
+ <xsl:param name="mode">bookmarks</xsl:param>
4421
+ <xsl:if test="$mode = 'contents'">
4422
+ <xsl:copy>
4423
+ <xsl:apply-templates mode="contents_item"/>
4424
+ </xsl:copy>
4425
+ </xsl:if>
4464
4426
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
4465
4427
 
4466
4428
  <fo:block-container margin-left="0mm">
@@ -4797,42 +4759,48 @@
4797
4759
  <fo:block id="{@id}" xsl:use-attribute-sets="example-style">
4798
4760
 
4799
4761
 
4800
- <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
4801
-
4802
- <xsl:variable name="element">
4762
+ <xsl:variable name="fo_element">
4763
+ <xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl']">block</xsl:if>
4803
4764
  block
4804
4765
 
4805
- <xsl:if test=".//*[local-name() = 'table']">block</xsl:if>
4766
+
4806
4767
  </xsl:variable>
4807
4768
 
4769
+ <!-- display 'EXAMPLE' -->
4770
+ <xsl:apply-templates select="*[local-name()='name']">
4771
+ <xsl:with-param name="fo_element" select="$fo_element"/>
4772
+ </xsl:apply-templates>
4773
+
4808
4774
  <xsl:choose>
4809
- <xsl:when test="contains(normalize-space($element), 'block')">
4810
- <fo:block xsl:use-attribute-sets="example-body-style">
4811
- <xsl:apply-templates/>
4812
- </fo:block>
4775
+ <xsl:when test="contains(normalize-space($fo_element), 'block')">
4776
+ <fo:block-container xsl:use-attribute-sets="example-body-style">
4777
+ <fo:block-container margin-left="0mm" margin-right="0mm">
4778
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]">
4779
+ <xsl:with-param name="fo_element" select="$fo_element"/>
4780
+ </xsl:apply-templates>
4781
+ </fo:block-container>
4782
+ </fo:block-container>
4813
4783
  </xsl:when>
4814
4784
  <xsl:otherwise>
4815
4785
  <fo:inline>
4816
- <xsl:apply-templates/>
4786
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]">
4787
+ <xsl:with-param name="fo_element" select="$fo_element"/>
4788
+ </xsl:apply-templates>
4817
4789
  </fo:inline>
4818
4790
  </xsl:otherwise>
4819
4791
  </xsl:choose>
4820
4792
 
4821
4793
  </fo:block>
4822
- </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']" mode="presentation">
4823
-
4824
- <xsl:variable name="element">
4825
- block
4826
-
4827
- <xsl:if test="following-sibling::*[1][local-name() = 'table']">block</xsl:if>
4828
- </xsl:variable>
4794
+ </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']">
4795
+ <xsl:param name="fo_element">block</xsl:param>
4796
+
4829
4797
  <xsl:choose>
4830
4798
  <xsl:when test="ancestor::*[local-name() = 'appendix']">
4831
4799
  <fo:inline>
4832
4800
  <xsl:apply-templates/>
4833
4801
  </fo:inline>
4834
4802
  </xsl:when>
4835
- <xsl:when test="contains(normalize-space($element), 'block')">
4803
+ <xsl:when test="contains(normalize-space($fo_element), 'block')">
4836
4804
  <fo:block xsl:use-attribute-sets="example-name-style">
4837
4805
  <xsl:apply-templates/>
4838
4806
  </fo:block>
@@ -4845,14 +4813,15 @@
4845
4813
  </xsl:choose>
4846
4814
 
4847
4815
  </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'p']">
4816
+ <xsl:param name="fo_element">block</xsl:param>
4817
+
4848
4818
  <xsl:variable name="num"><xsl:number/></xsl:variable>
4849
4819
  <xsl:variable name="element">
4850
- block
4851
-
4852
4820
 
4821
+ <xsl:value-of select="$fo_element"/>
4853
4822
  </xsl:variable>
4854
4823
  <xsl:choose>
4855
- <xsl:when test="normalize-space($element) = 'block'">
4824
+ <xsl:when test="starts-with(normalize-space($element), 'block')">
4856
4825
  <fo:block xsl:use-attribute-sets="example-p-style">
4857
4826
 
4858
4827
  <xsl:apply-templates/>
@@ -4920,12 +4889,9 @@
4920
4889
  </fo:basic-link>
4921
4890
  </xsl:template><xsl:template match="*[local-name() = 'modification']">
4922
4891
  <xsl:variable name="title-modified">
4923
-
4924
-
4925
- <xsl:call-template name="getTitle">
4926
- <xsl:with-param name="name" select="'title-modified'"/>
4927
- </xsl:call-template>
4928
-
4892
+ <xsl:call-template name="getLocalizedString">
4893
+ <xsl:with-param name="key">modified</xsl:with-param>
4894
+ </xsl:call-template>
4929
4895
  </xsl:variable>
4930
4896
 
4931
4897
  <xsl:variable name="text"><xsl:apply-templates/></xsl:variable>
@@ -5118,12 +5084,9 @@
5118
5084
  </fo:block>
5119
5085
  </xsl:template><xsl:template match="*[local-name() = 'deprecates']">
5120
5086
  <xsl:variable name="title-deprecated">
5121
-
5122
-
5123
- <xsl:call-template name="getTitle">
5124
- <xsl:with-param name="name" select="'title-deprecated'"/>
5125
- </xsl:call-template>
5126
-
5087
+ <xsl:call-template name="getLocalizedString">
5088
+ <xsl:with-param name="key">deprecated</xsl:with-param>
5089
+ </xsl:call-template>
5127
5090
  </xsl:variable>
5128
5091
  <fo:block xsl:use-attribute-sets="deprecates-style">
5129
5092
  <xsl:value-of select="$title-deprecated"/>: <xsl:apply-templates/>
@@ -5132,6 +5095,8 @@
5132
5095
  <xsl:if test="*[local-name() = 'strong']">
5133
5096
  <xsl:attribute name="font-weight">normal</xsl:attribute>
5134
5097
  </xsl:if>
5098
+ </xsl:template><xsl:template match="*[local-name() = 'preferred']/text()[contains(., ';')] | *[local-name() = 'preferred']/*[local-name() = 'strong']/text()[contains(., ';')]">
5099
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.), ';', $linebreak)"/>
5135
5100
  </xsl:template><xsl:template match="*[local-name() = 'definition']">
5136
5101
  <fo:block xsl:use-attribute-sets="definition-style">
5137
5102
  <xsl:apply-templates/>
@@ -5457,16 +5422,54 @@
5457
5422
 
5458
5423
 
5459
5424
 
5460
-
5425
+
5426
+
5427
+
5428
+
5429
+
5430
+ <!-- start CSD bibtem processing -->
5431
+ <xsl:if test=".//csd:fn">
5432
+ <xsl:attribute name="line-height-shift-adjustment">disregard-shifts</xsl:attribute>
5433
+ </xsl:if>
5434
+ <xsl:variable name="docidentifier">
5435
+ <xsl:choose>
5436
+ <xsl:when test="*[local-name() = 'docidentifier']/@type = 'metanorma'"/>
5437
+ <xsl:otherwise><xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma-ordinal')]"/></xsl:otherwise>
5438
+ </xsl:choose>
5439
+ </xsl:variable>
5440
+ <xsl:value-of select="$docidentifier"/>
5441
+ <xsl:apply-templates select="csd:note"/>
5442
+ <xsl:if test="normalize-space($docidentifier) != ''">, </xsl:if>
5443
+ <xsl:choose>
5444
+ <xsl:when test="csd:title[@type = 'main' and @language = 'en']">
5445
+ <xsl:apply-templates select="csd:title[@type = 'main' and @language = 'en']"/>
5446
+ </xsl:when>
5447
+ <xsl:otherwise>
5448
+ <xsl:apply-templates select="csd:title"/>
5449
+ </xsl:otherwise>
5450
+ </xsl:choose>
5451
+ <xsl:apply-templates select="csd:formattedref"/>
5452
+ <!-- end CSD bibtem processing -->
5453
+
5454
+
5461
5455
 
5462
5456
 
5463
5457
 
5464
5458
 
5465
5459
 
5460
+
5461
+
5462
+
5463
+
5464
+ <!-- end MPFD bibitem processing -->
5465
+
5466
+ <!-- start M3D bibitem processing -->
5467
+
5466
5468
 
5469
+
5467
5470
 
5468
5471
  </xsl:template><xsl:template name="processBibitemDocId">
5469
- <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')]"/>
5472
+ <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')]"/>
5470
5473
  <xsl:choose>
5471
5474
  <xsl:when test="normalize-space($_doc_ident) != ''">
5472
5475
  <!-- <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"/>
@@ -5480,7 +5483,7 @@
5480
5483
  <xsl:if test="$type != ''">
5481
5484
  <xsl:value-of select="$type"/><xsl:text> </xsl:text>
5482
5485
  </xsl:if> -->
5483
- <xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]"/>
5486
+ <xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma') and not(@type = 'metanorma-ordinal')]"/>
5484
5487
  </xsl:otherwise>
5485
5488
  </xsl:choose>
5486
5489
  </xsl:template><xsl:template name="processPersonalAuthor">
@@ -5586,8 +5589,12 @@
5586
5589
  <fo:block> </fo:block>
5587
5590
  </fo:block-container>
5588
5591
  </xsl:template><xsl:variable name="toc_level">
5592
+ <!-- https://www.metanorma.org/author/ref/document-attributes/ -->
5593
+ <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:-->
5594
+ <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 -->
5589
5595
  <xsl:choose>
5590
- <xsl:when test="1 = 2"/> <!-- to do https://github.com/metanorma/mn-native-pdf/issues/337: if there is value in xml -->
5596
+ <xsl:when test="$htmltoclevels != ''"><xsl:value-of select="number($htmltoclevels)"/></xsl:when> <!-- if there is value in xml -->
5597
+ <xsl:when test="$toclevels != ''"><xsl:value-of select="number($toclevels)"/></xsl:when> <!-- if there is value in xml -->
5591
5598
  <xsl:otherwise><!-- default value -->
5592
5599
 
5593
5600
 
@@ -5689,7 +5696,7 @@
5689
5696
  </td>
5690
5697
  </xsl:for-each>
5691
5698
  <td>333</td> <!-- page number, just for fill -->
5692
- </xsl:template><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']"/><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
5699
+ </xsl:template><xsl:template match="*[local-name() = 'variant-title']"/><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
5693
5700
  <fo:inline padding-right="5mm"> </fo:inline>
5694
5701
  <fo:inline><xsl:apply-templates/></fo:inline>
5695
5702
  </xsl:template><xsl:template match="*[local-name() = 'blacksquare']" name="blacksquare">
@@ -6061,9 +6068,15 @@
6061
6068
  </xsl:template><xsl:template name="getLocalizedString">
6062
6069
  <xsl:param name="key"/>
6063
6070
  <xsl:param name="formatted">false</xsl:param>
6071
+ <xsl:param name="lang"/>
6064
6072
 
6065
6073
  <xsl:variable name="curr_lang">
6066
- <xsl:call-template name="getLang"/>
6074
+ <xsl:choose>
6075
+ <xsl:when test="$lang != ''"><xsl:value-of select="$lang"/></xsl:when>
6076
+ <xsl:otherwise>
6077
+ <xsl:call-template name="getLang"/>
6078
+ </xsl:otherwise>
6079
+ </xsl:choose>
6067
6080
  </xsl:variable>
6068
6081
 
6069
6082
  <xsl:variable name="data_value">
File without changes
File without changes
File without changes
File without changes
@@ -3,13 +3,13 @@ require "isodoc/cc/html_convert"
3
3
  require "isodoc/cc/word_convert"
4
4
  require "isodoc/cc/presentation_xml_convert"
5
5
  require "metanorma/cc"
6
- require "asciidoctor/standoc/converter"
7
- require "asciidoctor/generic/converter"
6
+ require "metanorma/standoc/converter"
7
+ require "metanorma/generic/converter"
8
8
  require_relative "validate_section"
9
9
 
10
- module Asciidoctor
10
+ module Metanorma
11
11
  module CC
12
- class Converter < Asciidoctor::Generic::Converter
12
+ class Converter < Metanorma::Generic::Converter
13
13
  XML_ROOT_TAG = "csd-standard".freeze
14
14
  XML_NAMESPACE = "https://www.metanorma.org/ns/csd".freeze
15
15
 
File without changes
File without changes
@@ -1,9 +1,9 @@
1
1
  require "nokogiri"
2
2
  require "metanorma-generic"
3
3
 
4
- module Asciidoctor
4
+ module Metanorma
5
5
  module CC
6
- class Converter < Asciidoctor::Generic::Converter
6
+ class Converter < Metanorma::Generic::Converter
7
7
  def section_validate(doc)
8
8
  advisory = doc.root.at("//bibdata/ext[doctype = 'advisory']")
9
9
  symbols_validate(doc.root) unless advisory
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module CC
3
- VERSION = "1.8.5".freeze
3
+ VERSION = "2.0.0".freeze
4
4
  end
5
5
  end
data/lib/metanorma-cc.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  require "asciidoctor" unless defined? Asciidoctor::Converter
2
- require_relative "asciidoctor/cc/converter"
2
+ require_relative "metanorma/cc/converter"
3
3
  require_relative "isodoc/cc/html_convert"
4
4
  require_relative "isodoc/cc/word_convert"
5
5
  require_relative "isodoc/cc/pdf_convert"
data/metanorma-cc.gemspec CHANGED
@@ -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: csd-standard
6
6
  html_bodyfont: '"Source Sans Pro",sans-serif'
7
7
  html_headerfont: '"Source Sans Pro",sans-serif'
8
8
  html_monospacefont: '"Source Code Pro",monospace'
9
- validate_rng_file: lib/asciidoctor/cc/cc.rng
9
+ validate_rng_file: lib/metanorma/cc/cc.rng
10
10
  htmlcoverpage: lib/isodoc/cc/html/html_cc_titlepage.html
11
11
  htmlintropage: lib/isodoc/cc/html/html_cc_intro.html
12
12
  htmlstylesheet: lib/isodoc/cc/html/htmlstyle.scss
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-cc
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.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
@@ -190,15 +190,6 @@ files:
190
190
  - bin/setup
191
191
  - docs/navigation.adoc
192
192
  - docs/quickstart.adoc
193
- - lib/asciidoctor/cc.rb
194
- - lib/asciidoctor/cc/basicdoc.rng
195
- - lib/asciidoctor/cc/biblio.rng
196
- - lib/asciidoctor/cc/boilerplate.xml
197
- - lib/asciidoctor/cc/cc.rng
198
- - lib/asciidoctor/cc/converter.rb
199
- - lib/asciidoctor/cc/isodoc.rng
200
- - lib/asciidoctor/cc/reqt.rng
201
- - lib/asciidoctor/cc/validate_section.rb
202
193
  - lib/isodoc/cc/base_convert.rb
203
194
  - lib/isodoc/cc/cc.standard.xsl
204
195
  - lib/isodoc/cc/html/_coverpage.css
@@ -228,7 +219,15 @@ files:
228
219
  - lib/isodoc/cc/xref.rb
229
220
  - lib/metanorma-cc.rb
230
221
  - lib/metanorma/cc.rb
222
+ - lib/metanorma/cc/basicdoc.rng
223
+ - lib/metanorma/cc/biblio.rng
224
+ - lib/metanorma/cc/boilerplate.xml
225
+ - lib/metanorma/cc/cc.rng
226
+ - lib/metanorma/cc/converter.rb
227
+ - lib/metanorma/cc/isodoc.rng
231
228
  - lib/metanorma/cc/processor.rb
229
+ - lib/metanorma/cc/reqt.rng
230
+ - lib/metanorma/cc/validate_section.rb
232
231
  - lib/metanorma/cc/version.rb
233
232
  - metanorma-cc.gemspec
234
233
  - metanorma.yml
@@ -1,5 +0,0 @@
1
- module Asciidoctor
2
- module CC
3
- # Your code goes here...
4
- end
5
- end