metanorma-ieee 1.0.14 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/isodoc/ieee/base_convert.rb +11 -6
- data/lib/isodoc/ieee/html/htmlstyle.css +15 -11
- data/lib/isodoc/ieee/html/htmlstyle.scss +8 -8
- data/lib/isodoc/ieee/html/wordstyle.css +15 -15
- data/lib/isodoc/ieee/html/wordstyle.scss +15 -15
- data/lib/isodoc/ieee/ieee.amendment.xsl +123 -80
- data/lib/isodoc/ieee/ieee.standard.xsl +123 -80
- data/lib/isodoc/ieee/presentation_bibdata.rb +100 -0
- data/lib/isodoc/ieee/presentation_xml_convert.rb +21 -99
- data/lib/isodoc/ieee/word_convert.rb +14 -13
- data/lib/metanorma/ieee/isodoc.rng +26 -4
- data/lib/metanorma/ieee/term_lookup_cleanup.rb +2 -1
- data/lib/metanorma/ieee/version.rb +1 -1
- data/metanorma-ieee.gemspec +1 -1
- metadata +5 -4
@@ -1061,23 +1061,22 @@
|
|
1061
1061
|
<fo:flow flow-name="xsl-region-body">
|
1062
1062
|
<!-- debugpage=<xsl:copy-of select="."/> -->
|
1063
1063
|
|
1064
|
-
<xsl:if test="position() = 1">
|
1065
|
-
|
1064
|
+
<!-- <xsl:if test="position() = 1">
|
1065
|
+
|
1066
1066
|
<xsl:choose>
|
1067
1067
|
<xsl:when test="$current_template = 'draft'">
|
1068
1068
|
<fo:block font-family="Arial" font-size="23pt" font-weight="bold" margin-top="70pt" margin-bottom="48pt">
|
1069
|
-
|
1069
|
+
|
1070
1070
|
<xsl:if test="contains('amendment corrigendum erratum', $subdoctype) and $subdoctype != ''">
|
1071
1071
|
<xsl:attribute name="font-size">24pt</xsl:attribute>
|
1072
1072
|
</xsl:if>
|
1073
|
-
|
1073
|
+
|
1074
1074
|
<xsl:copy-of select="$title_prefix"/>
|
1075
1075
|
<xsl:copy-of select="$title"/>
|
1076
|
-
|
1077
|
-
<!-- <xsl:copy-of select="$draft_title_part"/> -->
|
1076
|
+
|
1078
1077
|
</fo:block>
|
1079
1078
|
</xsl:when>
|
1080
|
-
|
1079
|
+
|
1081
1080
|
<xsl:when test="$current_template = 'standard'">
|
1082
1081
|
<fo:block font-family="Arial" font-weight="bold" margin-top="13mm" space-after="12pt">
|
1083
1082
|
<fo:block font-weight="bold" space-before="13mm">
|
@@ -1085,30 +1084,21 @@
|
|
1085
1084
|
</fo:block>
|
1086
1085
|
</fo:block>
|
1087
1086
|
</xsl:when>
|
1087
|
+
|
1088
|
+
<xsl:otherwise> --><!-- $current_template = 'whitepaper' or $current_template = 'icap-whitepaper' or $current_template = 'industry-connection-report' -->
|
1088
1089
|
|
1089
|
-
|
1090
|
-
|
1091
|
-
<xsl:attribute name="font-family">Calibri Light</xsl:attribute>
|
1090
|
+
<!-- <xsl:attribute name="font-family">Calibri Light</xsl:attribute>
|
1092
1091
|
<xsl:attribute name="font-size">12pt</xsl:attribute>
|
1093
|
-
|
1092
|
+
|
1094
1093
|
<fo:block font-family="Arial Black" font-size="20pt" margin-top="18pt">
|
1095
1094
|
<xsl:copy-of select="$title"/>
|
1096
|
-
<!-- <xsl:copy-of select="$draft_title_part"/> -->
|
1097
1095
|
</fo:block>
|
1098
1096
|
<xsl:call-template name="addBlueBox"/>
|
1099
|
-
|
1100
|
-
<fo:instream-foreign-object content-width="57mm" content-height="3mm" scaling="non-uniform" fox:alt-text="Image Box">
|
1101
|
-
<xsl:call-template name="insertImageBoxSVG">
|
1102
|
-
<xsl:with-param name="color"><xsl:value-of select="$color_blue"/></xsl:with-param>
|
1103
|
-
</xsl:call-template>
|
1104
|
-
</fo:instream-foreign-object>
|
1105
|
-
</fo:block>
|
1106
|
-
<fo:block margin-top="12pt" margin-bottom="12pt"> </fo:block> -->
|
1107
|
-
<fo:block margin-bottom="12pt"> </fo:block>
|
1097
|
+
<fo:block margin-bottom="12pt"> </fo:block>
|
1108
1098
|
</xsl:otherwise>
|
1109
1099
|
</xsl:choose>
|
1110
|
-
|
1111
|
-
</xsl:if>
|
1100
|
+
|
1101
|
+
</xsl:if> -->
|
1112
1102
|
|
1113
1103
|
<xsl:apply-templates select="*" mode="page"/>
|
1114
1104
|
<xsl:if test="position() = last()"><fo:block id="lastBlockMain"/></xsl:if>
|
@@ -1736,6 +1726,32 @@
|
|
1736
1726
|
</xsl:choose>
|
1737
1727
|
</xsl:template>
|
1738
1728
|
|
1729
|
+
<xsl:template match="ieee:p[@class = 'zzSTDTitle1']" priority="4">
|
1730
|
+
<xsl:choose>
|
1731
|
+
<xsl:when test="$current_template = 'draft'">
|
1732
|
+
<fo:block font-family="Arial" font-size="23pt" font-weight="bold" margin-top="70pt" margin-bottom="48pt">
|
1733
|
+
<xsl:if test="contains('amendment corrigendum erratum', $subdoctype) and $subdoctype != ''">
|
1734
|
+
<xsl:attribute name="font-size">24pt</xsl:attribute>
|
1735
|
+
</xsl:if>
|
1736
|
+
<xsl:apply-templates/>
|
1737
|
+
</fo:block>
|
1738
|
+
</xsl:when>
|
1739
|
+
<xsl:when test="$current_template = 'standard'">
|
1740
|
+
<fo:block font-family="Arial" font-weight="bold" margin-top="13mm" space-after="12pt">
|
1741
|
+
<xsl:apply-templates/>
|
1742
|
+
</fo:block>
|
1743
|
+
</xsl:when>
|
1744
|
+
<xsl:otherwise> <!-- $current_template = 'whitepaper' or $current_template = 'icap-whitepaper' or $current_template = 'industry-connection-report' -->
|
1745
|
+
|
1746
|
+
<fo:block font-family="Arial Black" font-size="20pt" margin-top="18pt">
|
1747
|
+
<xsl:apply-templates/>
|
1748
|
+
</fo:block>
|
1749
|
+
<xsl:call-template name="addBlueBox"/>
|
1750
|
+
<fo:block margin-bottom="12pt"> </fo:block>
|
1751
|
+
</xsl:otherwise>
|
1752
|
+
</xsl:choose>
|
1753
|
+
</xsl:template>
|
1754
|
+
|
1739
1755
|
<xsl:template match="node()">
|
1740
1756
|
<xsl:apply-templates/>
|
1741
1757
|
</xsl:template>
|
@@ -3881,21 +3897,32 @@
|
|
3881
3897
|
<xsl:variable name="titles_">
|
3882
3898
|
|
3883
3899
|
<!-- These titles of Table of contents renders different than determined in localized-strings -->
|
3884
|
-
<title-toc lang="en">
|
3885
|
-
|
3900
|
+
<!-- <title-toc lang="en">
|
3901
|
+
<xsl:if test="$namespace = 'csd' or $namespace = 'ieee' or $namespace = 'iho' or $namespace = 'mpfd' or $namespace = 'ogc' or $namespace = 'unece-rec'">
|
3886
3902
|
<xsl:text>Contents</xsl:text>
|
3887
|
-
|
3888
|
-
|
3889
|
-
|
3903
|
+
</xsl:if>
|
3904
|
+
<xsl:if test="$namespace = 'csa' or $namespace = 'm3d' or $namespace = 'nist-sp' or $namespace = 'ogc-white-paper'">
|
3905
|
+
<xsl:text>Table of Contents</xsl:text>
|
3906
|
+
</xsl:if>
|
3907
|
+
<xsl:if test="$namespace = 'gb'">
|
3908
|
+
<xsl:text>Table of contents</xsl:text>
|
3909
|
+
</xsl:if>
|
3910
|
+
</title-toc> -->
|
3911
|
+
<title-toc lang="en">Table of contents</title-toc>
|
3912
|
+
<!-- <title-toc lang="fr">
|
3890
3913
|
<xsl:text>Sommaire</xsl:text>
|
3891
|
-
</title-toc>
|
3892
|
-
<title-toc lang="zh">
|
3893
|
-
|
3914
|
+
</title-toc> -->
|
3915
|
+
<!-- <title-toc lang="zh">
|
3916
|
+
<xsl:choose>
|
3917
|
+
<xsl:when test="$namespace = 'gb'">
|
3918
|
+
<xsl:text>目次</xsl:text>
|
3919
|
+
</xsl:when>
|
3920
|
+
<xsl:otherwise>
|
3894
3921
|
<xsl:text>Contents</xsl:text>
|
3895
|
-
|
3896
|
-
|
3897
|
-
|
3898
|
-
<title-
|
3922
|
+
</xsl:otherwise>
|
3923
|
+
</xsl:choose>
|
3924
|
+
</title-toc> -->
|
3925
|
+
<title-toc lang="zh">目次</title-toc>
|
3899
3926
|
|
3900
3927
|
<title-part lang="en">
|
3901
3928
|
|
@@ -3911,20 +3938,6 @@
|
|
3911
3938
|
<title-subpart lang="en">Sub-part #</title-subpart>
|
3912
3939
|
<title-subpart lang="fr">Partie de sub #</title-subpart>
|
3913
3940
|
|
3914
|
-
<title-list-tables lang="en">List of Tables</title-list-tables>
|
3915
|
-
|
3916
|
-
<title-list-figures lang="en">List of Figures</title-list-figures>
|
3917
|
-
|
3918
|
-
<title-table-figures lang="en">Table of Figures</title-table-figures>
|
3919
|
-
|
3920
|
-
<title-list-recommendations lang="en">List of Recommendations</title-list-recommendations>
|
3921
|
-
|
3922
|
-
<title-summary lang="en">Summary</title-summary>
|
3923
|
-
|
3924
|
-
<title-continued lang="ru">(продолжение)</title-continued>
|
3925
|
-
<title-continued lang="en">(continued)</title-continued>
|
3926
|
-
<title-continued lang="fr">(continué)</title-continued>
|
3927
|
-
|
3928
3941
|
</xsl:variable>
|
3929
3942
|
<xsl:variable name="titles" select="xalan:nodeset($titles_)"/>
|
3930
3943
|
|
@@ -3932,8 +3945,8 @@
|
|
3932
3945
|
<xsl:variable name="toc_table_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']"/>
|
3933
3946
|
<xsl:value-of select="$toc_table_title"/>
|
3934
3947
|
<xsl:if test="normalize-space($toc_table_title) = ''">
|
3935
|
-
<xsl:call-template name="
|
3936
|
-
<xsl:with-param name="
|
3948
|
+
<xsl:call-template name="getLocalizedString">
|
3949
|
+
<xsl:with-param name="key">toc_tables</xsl:with-param>
|
3937
3950
|
</xsl:call-template>
|
3938
3951
|
</xsl:if>
|
3939
3952
|
</xsl:variable>
|
@@ -3942,8 +3955,8 @@
|
|
3942
3955
|
<xsl:variable name="toc_figure_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']"/>
|
3943
3956
|
<xsl:value-of select="$toc_figure_title"/>
|
3944
3957
|
<xsl:if test="normalize-space($toc_figure_title) = ''">
|
3945
|
-
<xsl:call-template name="
|
3946
|
-
<xsl:with-param name="
|
3958
|
+
<xsl:call-template name="getLocalizedString">
|
3959
|
+
<xsl:with-param name="key">toc_figures</xsl:with-param>
|
3947
3960
|
</xsl:call-template>
|
3948
3961
|
</xsl:if>
|
3949
3962
|
</xsl:variable>
|
@@ -3952,8 +3965,8 @@
|
|
3952
3965
|
<xsl:variable name="toc_requirement_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='requirement']/*[local-name() = 'title']"/>
|
3953
3966
|
<xsl:value-of select="$toc_requirement_title"/>
|
3954
3967
|
<xsl:if test="normalize-space($toc_requirement_title) = ''">
|
3955
|
-
<xsl:call-template name="
|
3956
|
-
<xsl:with-param name="
|
3968
|
+
<xsl:call-template name="getLocalizedString">
|
3969
|
+
<xsl:with-param name="key">toc_recommendations</xsl:with-param>
|
3957
3970
|
</xsl:call-template>
|
3958
3971
|
</xsl:if>
|
3959
3972
|
</xsl:variable>
|
@@ -6434,13 +6447,13 @@
|
|
6434
6447
|
<fo:table-body>
|
6435
6448
|
|
6436
6449
|
<xsl:variable name="title_continued_">
|
6437
|
-
<xsl:call-template name="
|
6438
|
-
<xsl:with-param name="
|
6450
|
+
<xsl:call-template name="getLocalizedString">
|
6451
|
+
<xsl:with-param name="key">continued</xsl:with-param>
|
6439
6452
|
</xsl:call-template>
|
6440
6453
|
</xsl:variable>
|
6441
|
-
|
6454
|
+
<xsl:variable name="title_continued_in_parenthesis" select="concat('(',$title_continued_,')')"/>
|
6442
6455
|
<xsl:variable name="title_continued">
|
6443
|
-
<xsl:value-of select="$
|
6456
|
+
<xsl:value-of select="$title_continued_in_parenthesis"/>
|
6444
6457
|
|
6445
6458
|
</xsl:variable>
|
6446
6459
|
|
@@ -7750,6 +7763,9 @@
|
|
7750
7763
|
<!-- END Definition List -->
|
7751
7764
|
<!-- ===================== -->
|
7752
7765
|
|
7766
|
+
<!-- default: ignore title in sections/p -->
|
7767
|
+
<xsl:template match="*[local-name() = 'sections']/*[local-name() = 'p'][starts-with(@class, 'zzSTDTitle')]" priority="3"/>
|
7768
|
+
|
7753
7769
|
<!-- ========================= -->
|
7754
7770
|
<!-- Rich text formatting -->
|
7755
7771
|
<!-- ========================= -->
|
@@ -7825,7 +7841,7 @@
|
|
7825
7841
|
<xsl:variable name="regex_url_start">^(http://|https://|www\.)?(.*)</xsl:variable>
|
7826
7842
|
<xsl:template match="*[local-name()='tt']/text()" priority="2">
|
7827
7843
|
<xsl:choose>
|
7828
|
-
<xsl:when test="java:replaceAll(java:java.lang.String.new(.),
|
7844
|
+
<xsl:when test="java:replaceAll(java:java.lang.String.new(.), $regex_url_start, '$2') != ''">
|
7829
7845
|
<!-- url -->
|
7830
7846
|
<xsl:call-template name="add-zero-spaces-link-java"/>
|
7831
7847
|
</xsl:when>
|
@@ -8287,10 +8303,13 @@
|
|
8287
8303
|
</xsl:choose>
|
8288
8304
|
</xsl:variable>
|
8289
8305
|
|
8306
|
+
<!-- replace sequence #x200B to one ​ -->
|
8307
|
+
<xsl:variable name="text10" select="java:replaceAll(java:java.lang.String.new($text9), '\u200b{2,}', '')"/>
|
8308
|
+
|
8290
8309
|
<!-- replace sequence #x200B and space TO space -->
|
8291
|
-
<xsl:variable name="
|
8310
|
+
<xsl:variable name="text11" select="java:replaceAll(java:java.lang.String.new($text10), '\u200b ', ' ')"/>
|
8292
8311
|
|
8293
|
-
<xsl:value-of select="$
|
8312
|
+
<xsl:value-of select="$text11"/>
|
8294
8313
|
</xsl:template>
|
8295
8314
|
|
8296
8315
|
<xsl:template name="add-zero-spaces-link-java">
|
@@ -8300,8 +8319,12 @@
|
|
8300
8319
|
<xsl:variable name="url_continue" select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$2')"/>
|
8301
8320
|
<!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space, comma, slash, @ -->
|
8302
8321
|
<xsl:variable name="url" select="java:replaceAll(java:java.lang.String.new($url_continue),'(-|\.|:|=|_|—| |,|/|@)','$1')"/>
|
8322
|
+
|
8323
|
+
<!-- replace sequence #x200B to one ​ -->
|
8324
|
+
<xsl:variable name="url2" select="java:replaceAll(java:java.lang.String.new($url), '\u200b{2,}', '')"/>
|
8325
|
+
|
8303
8326
|
<!-- remove zero-width space at the end -->
|
8304
|
-
<xsl:value-of select="java:replaceAll(java:java.lang.String.new($
|
8327
|
+
<xsl:value-of select="java:replaceAll(java:java.lang.String.new($url2), '$', '')"/>
|
8305
8328
|
</xsl:template>
|
8306
8329
|
|
8307
8330
|
<!-- add zero space after dash character (for table's entries) -->
|
@@ -9566,7 +9589,7 @@
|
|
9566
9589
|
|
9567
9590
|
<xsl:call-template name="refine_note_block_style"/>
|
9568
9591
|
|
9569
|
-
<fo:inline xsl:use-attribute-sets="note-name-style">
|
9592
|
+
<fo:inline xsl:use-attribute-sets="note-name-style" role="SKIP">
|
9570
9593
|
|
9571
9594
|
<xsl:call-template name="refine_note-name-style"/>
|
9572
9595
|
|
@@ -9603,12 +9626,12 @@
|
|
9603
9626
|
<xsl:variable name="num"><xsl:number/></xsl:variable>
|
9604
9627
|
<xsl:choose>
|
9605
9628
|
<xsl:when test="$num = 1"> <!-- display first NOTE's paragraph in the same line with label NOTE -->
|
9606
|
-
<fo:inline xsl:use-attribute-sets="note-p-style">
|
9629
|
+
<fo:inline xsl:use-attribute-sets="note-p-style" role="SKIP">
|
9607
9630
|
<xsl:apply-templates/>
|
9608
9631
|
</fo:inline>
|
9609
9632
|
</xsl:when>
|
9610
9633
|
<xsl:otherwise>
|
9611
|
-
<fo:block xsl:use-attribute-sets="note-p-style">
|
9634
|
+
<fo:block xsl:use-attribute-sets="note-p-style" role="SKIP">
|
9612
9635
|
<xsl:apply-templates/>
|
9613
9636
|
</fo:block>
|
9614
9637
|
</xsl:otherwise>
|
@@ -9827,25 +9850,45 @@
|
|
9827
9850
|
<fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style">
|
9828
9851
|
<xsl:if test="not(@mimetype = 'image/svg+xml') and ../*[local-name() = 'name'] and not(ancestor::*[local-name() = 'table'])">
|
9829
9852
|
|
9830
|
-
<xsl:
|
9831
|
-
<xsl:
|
9832
|
-
<xsl:
|
9833
|
-
|
9834
|
-
|
9835
|
-
</xsl:variable>
|
9853
|
+
<xsl:if test="@width != '' and @width != 'auto'">
|
9854
|
+
<xsl:attribute name="width">
|
9855
|
+
<xsl:value-of select="@width"/>
|
9856
|
+
</xsl:attribute>
|
9857
|
+
</xsl:if>
|
9836
9858
|
|
9837
|
-
<xsl:
|
9859
|
+
<xsl:if test="@height != '' and @height != 'auto'">
|
9860
|
+
<xsl:attribute name="height">
|
9861
|
+
<xsl:value-of select="@height"/>
|
9862
|
+
</xsl:attribute>
|
9863
|
+
</xsl:if>
|
9838
9864
|
|
9839
|
-
|
9865
|
+
<xsl:choose>
|
9866
|
+
<xsl:when test="@width != '' and @width != 'auto' and @height != '' and @height != 'auto'">
|
9867
|
+
<xsl:attribute name="scaling">non-uniform</xsl:attribute>
|
9868
|
+
</xsl:when>
|
9869
|
+
<xsl:otherwise>
|
9840
9870
|
|
9841
|
-
|
9871
|
+
<xsl:variable name="img_src">
|
9872
|
+
<xsl:choose>
|
9873
|
+
<xsl:when test="not(starts-with(@src, 'data:'))"><xsl:value-of select="concat($basepath, @src)"/></xsl:when>
|
9874
|
+
<xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
|
9875
|
+
</xsl:choose>
|
9876
|
+
</xsl:variable>
|
9842
9877
|
|
9843
|
-
|
9844
|
-
<xsl:if test="number($scale) < 100">
|
9878
|
+
<xsl:variable name="image_width_effective">
|
9845
9879
|
|
9846
|
-
|
9880
|
+
<xsl:value-of select="$width_effective"/>
|
9847
9881
|
|
9848
|
-
|
9882
|
+
</xsl:variable>
|
9883
|
+
|
9884
|
+
<xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $image_width_effective, $height_effective)"/>
|
9885
|
+
<xsl:if test="number($scale) < 100">
|
9886
|
+
|
9887
|
+
<xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
|
9888
|
+
|
9889
|
+
</xsl:if>
|
9890
|
+
</xsl:otherwise>
|
9891
|
+
</xsl:choose>
|
9849
9892
|
|
9850
9893
|
</xsl:if>
|
9851
9894
|
|
@@ -13540,7 +13583,7 @@
|
|
13540
13583
|
<xsl:template match="*[local-name() = 'span']" mode="update_xml_step1">
|
13541
13584
|
<xsl:apply-templates mode="update_xml_step1"/>
|
13542
13585
|
</xsl:template>
|
13543
|
-
<xsl:template match="*[local-name() = 'sourcecode']//*[local-name() = 'span'][@class]" mode="update_xml_step1" priority="2">
|
13586
|
+
<xsl:template match="*[local-name() = 'sections']/*[local-name() = 'p'][starts-with(@class, 'zzSTDTitle')]/*[local-name() = 'span'][@class] | *[local-name() = 'sourcecode']//*[local-name() = 'span'][@class]" mode="update_xml_step1" priority="2">
|
13544
13587
|
<xsl:copy>
|
13545
13588
|
<xsl:copy-of select="@*"/>
|
13546
13589
|
<xsl:apply-templates mode="update_xml_step1"/>
|
@@ -0,0 +1,100 @@
|
|
1
|
+
module IsoDoc
|
2
|
+
module IEEE
|
3
|
+
class PresentationXMLConvert < IsoDoc::PresentationXMLConvert
|
4
|
+
def bibdata_i18n(bib)
|
5
|
+
super
|
6
|
+
bibdata_dates(bib)
|
7
|
+
end
|
8
|
+
|
9
|
+
def bibdata_dates(bib)
|
10
|
+
bib.xpath(ns("./date")).each do |d|
|
11
|
+
d.next = d.dup
|
12
|
+
d.next["format"] = "ddMMMyyyy"
|
13
|
+
d.next.xpath(ns("./from | ./to | ./on")).each do |x|
|
14
|
+
x.children = ddMMMyyyy(x.text)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def ddMMMyyyy(isodate)
|
20
|
+
return nil if isodate.nil?
|
21
|
+
|
22
|
+
arr = isodate.split("-")
|
23
|
+
if arr.size == 1 && (/^\d+$/.match isodate)
|
24
|
+
Date.new(*arr.map(&:to_i)).strftime("%Y")
|
25
|
+
elsif arr.size == 2
|
26
|
+
Date.new(*arr.map(&:to_i)).strftime("%b %Y")
|
27
|
+
else
|
28
|
+
Date.parse(isodate).strftime("%d %b %Y")
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def boilerplate(docxml)
|
33
|
+
docxml.xpath(ns("//clause[@id = 'boilerplate-participants']/" \
|
34
|
+
"clause/title")).each(&:remove)
|
35
|
+
docxml.xpath(ns("//clause[@id = 'boilerplate-participants']/clause"))
|
36
|
+
.each do |clause|
|
37
|
+
participants(clause)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def participants(clause)
|
42
|
+
clause.xpath(ns(".//ul")).each_with_index do |ulist, idx|
|
43
|
+
ulist.xpath(ns("./li")).each { |list| participants1(list, idx) }
|
44
|
+
ulist.replace(ulist.children)
|
45
|
+
end
|
46
|
+
affiliation_header(clause)
|
47
|
+
end
|
48
|
+
|
49
|
+
def affiliation_header(clause)
|
50
|
+
clause.xpath(ns(".//p[@type = 'officeorgrepmember']")).each do |p|
|
51
|
+
prev = p.previous_element
|
52
|
+
prev && prev.name == "p" &&
|
53
|
+
prev["type"] == "officeorgrepmember" and next
|
54
|
+
p.previous = <<~HDR
|
55
|
+
<p type='officeorgrepmemberhdr'><em>Organization
|
56
|
+
Represented</em><tab/><em>Name of Representative</em></p>
|
57
|
+
HDR
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def participants1(list, idx)
|
62
|
+
key = ""
|
63
|
+
map = list.xpath(ns(".//dt | .//dd")).each_with_object({}) do |dtd, m|
|
64
|
+
(dtd.name == "dt" and key = dtd.text) or
|
65
|
+
m[key] = @c.encode(dtd.text.strip, :hexadecimal)
|
66
|
+
end
|
67
|
+
list.replace(participant_para(map, idx))
|
68
|
+
end
|
69
|
+
|
70
|
+
def participant_para(map, idx)
|
71
|
+
name = participant_name(map)
|
72
|
+
if map["role"]&.casecmp("member")&.zero?
|
73
|
+
participant_member_para(map, name, idx)
|
74
|
+
else
|
75
|
+
participant_officeholder_para(map, name, idx)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
def participant_member_para(map, name, _idx)
|
80
|
+
if map["company"] && (map["name"] || map["surname"])
|
81
|
+
pers = map["name"] || "#{map['given']} #{map['surname']}"
|
82
|
+
"<p type='officeorgrepmember'>#{name}<tab/>#{pers}</p>"
|
83
|
+
elsif map["company"] then "<p type='officeorgmember'>#{name}</p>"
|
84
|
+
else "<p type='officemember'>#{name}</p>"
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
def participant_officeholder_para(map, name, idx)
|
89
|
+
name = "<strong>#{name}</strong>" if idx.zero?
|
90
|
+
br = map["role"].size > 30 ? "<br/>" : ""
|
91
|
+
"<p type='officeholder' align='center'>#{name}, #{br}" \
|
92
|
+
"<em>#{map['role']}</em></p>"
|
93
|
+
end
|
94
|
+
|
95
|
+
def participant_name(map)
|
96
|
+
map["company"] || map["name"] || "#{map['given']} #{map['surname']}"
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require_relative "init"
|
2
|
+
require_relative "presentation_bibdata"
|
2
3
|
require_relative "presentation_terms"
|
3
4
|
require_relative "presentation_ref"
|
4
5
|
require "isodoc"
|
@@ -25,7 +26,6 @@ module IsoDoc
|
|
25
26
|
|
26
27
|
def prefix_clause(target, loc)
|
27
28
|
loc["type"] == "clause" or return loc["type"]
|
28
|
-
|
29
29
|
if subclause?(target, loc["type"],
|
30
30
|
loc&.at(ns("./referenceFrom"))&.text)
|
31
31
|
""
|
@@ -101,34 +101,6 @@ module IsoDoc
|
|
101
101
|
prefix_name(elem, "<br/>", lbl, "title")
|
102
102
|
end
|
103
103
|
|
104
|
-
def bibdata_i18n(bib)
|
105
|
-
super
|
106
|
-
bibdata_dates(bib)
|
107
|
-
end
|
108
|
-
|
109
|
-
def bibdata_dates(bib)
|
110
|
-
bib.xpath(ns("./date")).each do |d|
|
111
|
-
d.next = d.dup
|
112
|
-
d.next["format"] = "ddMMMyyyy"
|
113
|
-
d.next.xpath(ns("./from | ./to | ./on")).each do |x|
|
114
|
-
x.children = ddMMMyyyy(x.text)
|
115
|
-
end
|
116
|
-
end
|
117
|
-
end
|
118
|
-
|
119
|
-
def ddMMMyyyy(isodate)
|
120
|
-
return nil if isodate.nil?
|
121
|
-
|
122
|
-
arr = isodate.split("-")
|
123
|
-
if arr.size == 1 && (/^\d+$/.match isodate)
|
124
|
-
Date.new(*arr.map(&:to_i)).strftime("%Y")
|
125
|
-
elsif arr.size == 2
|
126
|
-
Date.new(*arr.map(&:to_i)).strftime("%b %Y")
|
127
|
-
else
|
128
|
-
Date.parse(isodate).strftime("%d %b %Y")
|
129
|
-
end
|
130
|
-
end
|
131
|
-
|
132
104
|
def amend1(elem)
|
133
105
|
elem.xpath(ns("./description/p")).each do |p|
|
134
106
|
p.children = to_xml(p.children).strip
|
@@ -151,73 +123,6 @@ module IsoDoc
|
|
151
123
|
super
|
152
124
|
end
|
153
125
|
|
154
|
-
def boilerplate(docxml)
|
155
|
-
docxml.xpath(ns("//clause[@id = 'boilerplate-participants']/" \
|
156
|
-
"clause/title")).each(&:remove)
|
157
|
-
docxml.xpath(ns("//clause[@id = 'boilerplate-participants']/clause"))
|
158
|
-
.each do |clause|
|
159
|
-
participants(clause)
|
160
|
-
end
|
161
|
-
end
|
162
|
-
|
163
|
-
def participants(clause)
|
164
|
-
clause.xpath(ns(".//ul")).each_with_index do |ulist, idx|
|
165
|
-
ulist.xpath(ns("./li")).each { |list| participants1(list, idx) }
|
166
|
-
ulist.replace(ulist.children)
|
167
|
-
end
|
168
|
-
affiliation_header(clause)
|
169
|
-
end
|
170
|
-
|
171
|
-
def affiliation_header(clause)
|
172
|
-
clause.xpath(ns(".//p[@type = 'officeorgrepmember']")).each do |p|
|
173
|
-
prev = p.previous_element
|
174
|
-
prev && prev.name == "p" &&
|
175
|
-
prev["type"] == "officeorgrepmember" and next
|
176
|
-
p.previous = <<~HDR
|
177
|
-
<p type='officeorgrepmemberhdr'><em>Organization
|
178
|
-
Represented</em><tab/><em>Name of Representative</em></p>
|
179
|
-
HDR
|
180
|
-
end
|
181
|
-
end
|
182
|
-
|
183
|
-
def participants1(list, idx)
|
184
|
-
key = ""
|
185
|
-
map = list.xpath(ns(".//dt | .//dd")).each_with_object({}) do |dtd, m|
|
186
|
-
(dtd.name == "dt" and key = dtd.text) or
|
187
|
-
m[key] = @c.encode(dtd.text.strip, :hexadecimal)
|
188
|
-
end
|
189
|
-
list.replace(participant_para(map, idx))
|
190
|
-
end
|
191
|
-
|
192
|
-
def participant_para(map, idx)
|
193
|
-
name = participant_name(map)
|
194
|
-
if map["role"]&.casecmp("member")&.zero?
|
195
|
-
participant_member_para(map, name, idx)
|
196
|
-
else
|
197
|
-
participant_officeholder_para(map, name, idx)
|
198
|
-
end
|
199
|
-
end
|
200
|
-
|
201
|
-
def participant_member_para(map, name, _idx)
|
202
|
-
if map["company"] && (map["name"] || map["surname"])
|
203
|
-
pers = map["name"] || "#{map['given']} #{map['surname']}"
|
204
|
-
"<p type='officeorgrepmember'>#{name}<tab/>#{pers}</p>"
|
205
|
-
elsif map["company"] then "<p type='officeorgmember'>#{name}</p>"
|
206
|
-
else "<p type='officemember'>#{name}</p>"
|
207
|
-
end
|
208
|
-
end
|
209
|
-
|
210
|
-
def participant_officeholder_para(map, name, idx)
|
211
|
-
name = "<strong>#{name}</strong>" if idx.zero?
|
212
|
-
br = map["role"].size > 30 ? "<br/>" : ""
|
213
|
-
"<p type='officeholder' align='center'>#{name}, #{br}" \
|
214
|
-
"<em>#{map['role']}</em></p>"
|
215
|
-
end
|
216
|
-
|
217
|
-
def participant_name(map)
|
218
|
-
map["company"] || map["name"] || "#{map['given']} #{map['surname']}"
|
219
|
-
end
|
220
|
-
|
221
126
|
def asciimath_dup(node)
|
222
127
|
@suppressasciimathdup and return
|
223
128
|
super
|
@@ -243,9 +148,15 @@ module IsoDoc
|
|
243
148
|
end
|
244
149
|
|
245
150
|
def ol_numbering(docxml)
|
246
|
-
|
247
|
-
|
248
|
-
|
151
|
+
p = "//clause | //annex | //foreword | //acknowledgements | " \
|
152
|
+
"//introduction | //preface/abstract | //appendix | //terms | " \
|
153
|
+
"//term | //definitions | //references | //colophon"
|
154
|
+
docxml.xpath(ns(p)).each do |c|
|
155
|
+
(c.xpath(ns(".//ol")) -
|
156
|
+
c.xpath(ns("./clause//ol | ./appendix//ol | ./term//ol | " \
|
157
|
+
"./terms//ol | ./definitions//ol | " \
|
158
|
+
"/references//ol | ./colophon//ol")))
|
159
|
+
.each_with_index do |o, i|
|
249
160
|
ol_numbering1(o, i)
|
250
161
|
end
|
251
162
|
end
|
@@ -266,6 +177,17 @@ module IsoDoc
|
|
266
177
|
type
|
267
178
|
end
|
268
179
|
|
180
|
+
def middle_title(docxml)
|
181
|
+
s = docxml.at(ns("//sections")) or return
|
182
|
+
ret = "<p class='zzSTDTitle1'>#{@meta.get[:full_doctitle]}"
|
183
|
+
@meta.get[:amd] || @meta.get[:corr] and ret += "<br/>"
|
184
|
+
@meta.get[:amd] and ret += "Amendment #{@meta.get[:amd]}"
|
185
|
+
@meta.get[:amd] && @meta.get[:corr] and ret += " "
|
186
|
+
@meta.get[:corr] and ret += "Corrigenda #{@meta.get[:corr]}"
|
187
|
+
ret += "</p>"
|
188
|
+
s.children.first.previous = ret
|
189
|
+
end
|
190
|
+
|
269
191
|
include Init
|
270
192
|
end
|
271
193
|
end
|