metanorma-ieee 1.4.3 → 1.4.4
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 +4 -4
- data/lib/html2doc/ieee_wp/lists.rb +2 -1
- data/lib/isodoc/ieee/ieee.amendment.xsl +165 -40
- data/lib/isodoc/ieee/ieee.standard.xsl +165 -40
- data/lib/isodoc/ieee/presentation_concepts.rb +167 -0
- data/lib/isodoc/ieee/presentation_terms.rb +35 -341
- data/lib/isodoc/ieee/presentation_xml_convert.rb +14 -11
- data/lib/isodoc/ieee/xref.rb +8 -15
- data/lib/metanorma/ieee/basicdoc.rng +14 -8
- data/lib/metanorma/ieee/biblio-standoc.rng +37 -7
- data/lib/metanorma/ieee/biblio.rng +30 -18
- data/lib/metanorma/ieee/front.rb +1 -2
- data/lib/metanorma/ieee/ieee.rng +0 -32
- data/lib/metanorma/ieee/isodoc.rng +115 -96
- data/lib/metanorma/ieee/relaton-ieee.rng +34 -37
- data/lib/metanorma/ieee/reqt.rng +7 -6
- data/lib/metanorma/ieee/validate.rb +2 -4
- data/lib/metanorma/ieee/version.rb +1 -1
- metadata +3 -2
@@ -2801,7 +2801,7 @@
|
|
2801
2801
|
<xsl:choose>
|
2802
2802
|
<xsl:when test="ancestor::ieee:table/@unnumbered = 'true' and normalize-space($substring_after) = 'Key'"><!-- no display Table - --></xsl:when>
|
2803
2803
|
<xsl:otherwise>
|
2804
|
-
<fo:inline font-weight="bold" font-style="normal">
|
2804
|
+
<fo:inline font-weight="bold" font-style="normal" role="SKIP">
|
2805
2805
|
<xsl:choose>
|
2806
2806
|
<xsl:when test="$current_template = 'whitepaper' or $current_template= 'icap-whitepaper' or $current_template = 'industry-connection-report'">
|
2807
2807
|
<!-- Figure N in blue color -->
|
@@ -4509,6 +4509,7 @@
|
|
4509
4509
|
</xsl:template> <!-- refine_table-style -->
|
4510
4510
|
|
4511
4511
|
<xsl:attribute-set name="table-name-style">
|
4512
|
+
<xsl:attribute name="role">Caption</xsl:attribute>
|
4512
4513
|
<xsl:attribute name="keep-with-next">always</xsl:attribute>
|
4513
4514
|
|
4514
4515
|
<xsl:attribute name="font-family">Arial</xsl:attribute>
|
@@ -4520,6 +4521,9 @@
|
|
4520
4521
|
|
4521
4522
|
<xsl:template name="refine_table-name-style">
|
4522
4523
|
<xsl:param name="continued"/>
|
4524
|
+
<xsl:if test="$continued = 'true'">
|
4525
|
+
<xsl:attribute name="role">SKIP</xsl:attribute>
|
4526
|
+
</xsl:if>
|
4523
4527
|
|
4524
4528
|
</xsl:template> <!-- refine_table-name-style -->
|
4525
4529
|
|
@@ -6331,7 +6335,7 @@
|
|
6331
6335
|
</xsl:if>
|
6332
6336
|
|
6333
6337
|
</fo:block-container>
|
6334
|
-
</xsl:variable>
|
6338
|
+
</xsl:variable> <!-- END: variable name="table" -->
|
6335
6339
|
|
6336
6340
|
<xsl:variable name="isAdded" select="@added"/>
|
6337
6341
|
<xsl:variable name="isDeleted" select="@deleted"/>
|
@@ -6368,11 +6372,12 @@
|
|
6368
6372
|
|
6369
6373
|
</xsl:template>
|
6370
6374
|
|
6375
|
+
<!-- table/name-->
|
6371
6376
|
<xsl:template match="*[local-name()='table']/*[local-name() = 'name']">
|
6372
6377
|
<xsl:param name="continued"/>
|
6373
6378
|
<xsl:if test="normalize-space() != ''">
|
6374
6379
|
|
6375
|
-
<fo:inline>
|
6380
|
+
<fo:inline role="SKIP">
|
6376
6381
|
|
6377
6382
|
<xsl:if test="$current_template = 'whitepaper' or $current_template = 'icap-whitepaper' or $current_template = 'industry-connection-report'">
|
6378
6383
|
<xsl:attribute name="font-size">11pt</xsl:attribute>
|
@@ -6846,7 +6851,7 @@
|
|
6846
6851
|
|
6847
6852
|
<xsl:variable name="tableWithNotesAndFootnotes">
|
6848
6853
|
|
6849
|
-
<fo:table keep-with-previous="always">
|
6854
|
+
<fo:table keep-with-previous="always" role="SKIP">
|
6850
6855
|
<xsl:for-each select="xalan:nodeset($table_attributes)/table_attributes/@*">
|
6851
6856
|
<xsl:variable name="name" select="local-name()"/>
|
6852
6857
|
<xsl:choose>
|
@@ -6877,9 +6882,9 @@
|
|
6877
6882
|
</xsl:otherwise>
|
6878
6883
|
</xsl:choose>
|
6879
6884
|
|
6880
|
-
<fo:table-body>
|
6881
|
-
<fo:table-row>
|
6882
|
-
<fo:table-cell xsl:use-attribute-sets="table-footer-cell-style" number-columns-spanned="{$cols-count}">
|
6885
|
+
<fo:table-body role="SKIP">
|
6886
|
+
<fo:table-row role="SKIP">
|
6887
|
+
<fo:table-cell xsl:use-attribute-sets="table-footer-cell-style" number-columns-spanned="{$cols-count}" role="SKIP">
|
6883
6888
|
|
6884
6889
|
<xsl:call-template name="refine_table-footer-cell-style"/>
|
6885
6890
|
|
@@ -6953,7 +6958,7 @@
|
|
6953
6958
|
|
6954
6959
|
<!-- if there isn't 'thead' and there is a table's title -->
|
6955
6960
|
<xsl:if test="not(ancestor::*[local-name()='table']/*[local-name()='thead']) and ancestor::*[local-name()='table']/*[local-name()='name']">
|
6956
|
-
<fo:table-header>
|
6961
|
+
<fo:table-header role="Caption">
|
6957
6962
|
<xsl:call-template name="table-header-title">
|
6958
6963
|
<xsl:with-param name="cols-count" select="$cols-count"/>
|
6959
6964
|
</xsl:call-template>
|
@@ -7319,6 +7324,7 @@
|
|
7319
7324
|
<!-- footnotes in text (title, bibliography, main body), not for tables, figures and names --> <!-- table's, figure's names -->
|
7320
7325
|
<!-- fn in text -->
|
7321
7326
|
<xsl:template match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure')] and not(ancestor::*[local-name() = 'name']))]" priority="2" name="fn">
|
7327
|
+
<xsl:param name="footnote_body_from_table">false</xsl:param>
|
7322
7328
|
|
7323
7329
|
<!-- list of unique footnotes -->
|
7324
7330
|
<xsl:variable name="p_fn_">
|
@@ -7384,7 +7390,7 @@
|
|
7384
7390
|
<xsl:copy-of select="$footnote_inline"/>
|
7385
7391
|
</xsl:when>
|
7386
7392
|
<!-- <xsl:when test="$footnotes//*[local-name() = 'fmt-fn-body'][@id = $ref_id] or normalize-space(@skip_footnote_body) = 'false'"> -->
|
7387
|
-
<xsl:when test="$p_fn//fn[@gen_id = $gen_id] or normalize-space(@skip_footnote_body) = 'false'">
|
7393
|
+
<xsl:when test="$p_fn//fn[@gen_id = $gen_id] or normalize-space(@skip_footnote_body) = 'false' or $footnote_body_from_table = 'true'">
|
7388
7394
|
|
7389
7395
|
<fo:footnote xsl:use-attribute-sets="fn-style" role="SKIP">
|
7390
7396
|
<xsl:copy-of select="$footnote_inline"/>
|
@@ -7793,39 +7799,51 @@
|
|
7793
7799
|
<!-- fn reference in the table rendering (for instance, 'some text 1) some text' ) -->
|
7794
7800
|
<!-- fn --> <!-- in table --> <!-- for figure see <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'fn']" priority="2"/> -->
|
7795
7801
|
<xsl:template match="*[local-name()='fn']">
|
7796
|
-
<
|
7802
|
+
<xsl:variable name="target" select="@target"/>
|
7803
|
+
<xsl:choose>
|
7804
|
+
<!-- case for footnotes in Requirement tables (https://github.com/metanorma/metanorma-ogc/issues/791) -->
|
7805
|
+
<xsl:when test="not(ancestor::*[local-name() = 'table'][1]/*[local-name() = 'fmt-footnote-container']/*[local-name() = 'fmt-fn-body'][@id = $target]) and $footnotes/*[local-name() = 'fmt-fn-body'][@id = $target]">
|
7806
|
+
<xsl:call-template name="fn">
|
7807
|
+
<xsl:with-param name="footnote_body_from_table">true</xsl:with-param>
|
7808
|
+
</xsl:call-template>
|
7809
|
+
</xsl:when>
|
7810
|
+
<xsl:otherwise>
|
7797
7811
|
|
7798
|
-
|
7812
|
+
<fo:inline xsl:use-attribute-sets="fn-reference-style">
|
7799
7813
|
|
7800
|
-
|
7801
|
-
<fo:basic-link internal-destination="{@target}" fox:alt-text="footnote {@reference}">
|
7802
|
-
<!-- <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> --> <!-- for footnotes in tables -->
|
7803
|
-
<!-- <xsl:attribute name="internal-destination">
|
7804
|
-
<xsl:value-of select="concat(@reference, '_', ancestor::*[local-name()='table'][1]/@id)"/>
|
7805
|
-
</xsl:attribute>
|
7806
|
-
</xsl:if>
|
7807
|
-
<xsl:if test="$namespace = 'ogc' or $namespace = 'ogc-white-paper'">
|
7808
|
-
<xsl:attribute name="internal-destination">
|
7809
|
-
<xsl:value-of select="@reference"/><xsl:text>_</xsl:text>
|
7810
|
-
<xsl:value-of select="ancestor::*[local-name()='table'][1]/@id"/>
|
7811
|
-
</xsl:attribute>
|
7812
|
-
</xsl:if> -->
|
7813
|
-
<!-- <xsl:if test="$namespace = 'plateau'">
|
7814
|
-
<xsl:text>※</xsl:text>
|
7815
|
-
</xsl:if> -->
|
7816
|
-
<!-- <xsl:value-of select="@reference"/> -->
|
7814
|
+
<xsl:call-template name="refine_fn-reference-style"/>
|
7817
7815
|
|
7818
|
-
|
7816
|
+
<!-- <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="footnote {@reference}"> --> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
|
7817
|
+
<fo:basic-link internal-destination="{@target}" fox:alt-text="footnote {@reference}">
|
7818
|
+
<!-- <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> --> <!-- for footnotes in tables -->
|
7819
|
+
<!-- <xsl:attribute name="internal-destination">
|
7820
|
+
<xsl:value-of select="concat(@reference, '_', ancestor::*[local-name()='table'][1]/@id)"/>
|
7821
|
+
</xsl:attribute>
|
7822
|
+
</xsl:if>
|
7823
|
+
<xsl:if test="$namespace = 'ogc' or $namespace = 'ogc-white-paper'">
|
7824
|
+
<xsl:attribute name="internal-destination">
|
7825
|
+
<xsl:value-of select="@reference"/><xsl:text>_</xsl:text>
|
7826
|
+
<xsl:value-of select="ancestor::*[local-name()='table'][1]/@id"/>
|
7827
|
+
</xsl:attribute>
|
7828
|
+
</xsl:if> -->
|
7829
|
+
<!-- <xsl:if test="$namespace = 'plateau'">
|
7830
|
+
<xsl:text>※</xsl:text>
|
7831
|
+
</xsl:if> -->
|
7832
|
+
<!-- <xsl:value-of select="@reference"/> -->
|
7819
7833
|
|
7820
|
-
|
7821
|
-
|
7822
|
-
|
7823
|
-
|
7824
|
-
|
7825
|
-
|
7826
|
-
|
7827
|
-
|
7828
|
-
|
7834
|
+
<xsl:value-of select="normalize-space(*[local-name() = 'fmt-fn-label'])"/>
|
7835
|
+
|
7836
|
+
<!-- <xsl:if test="$namespace = 'bsi'">
|
7837
|
+
<xsl:text>)</xsl:text>
|
7838
|
+
</xsl:if> -->
|
7839
|
+
<!-- commented, https://github.com/metanorma/isodoc/issues/614 -->
|
7840
|
+
<!-- <xsl:if test="$namespace = 'jis'">
|
7841
|
+
<fo:inline font-weight="normal">)</fo:inline>
|
7842
|
+
</xsl:if> -->
|
7843
|
+
</fo:basic-link>
|
7844
|
+
</fo:inline>
|
7845
|
+
</xsl:otherwise>
|
7846
|
+
</xsl:choose>
|
7829
7847
|
</xsl:template> <!-- fn -->
|
7830
7848
|
|
7831
7849
|
<!-- fn/text() -->
|
@@ -11821,6 +11839,13 @@
|
|
11821
11839
|
<xsl:apply-templates select="."/>
|
11822
11840
|
</xsl:template>
|
11823
11841
|
|
11842
|
+
<!-- prevent missing stem for table and figures in ToC -->
|
11843
|
+
<xsl:template match="*[local-name() = 'name' or local-name() = 'fmt-name']//*[local-name() = 'stem']" mode="contents">
|
11844
|
+
<xsl:if test="not(following-sibling::*[1][local-name() = 'fmt-stem'])">
|
11845
|
+
<xsl:apply-templates select="."/>
|
11846
|
+
</xsl:if>
|
11847
|
+
</xsl:template>
|
11848
|
+
|
11824
11849
|
<xsl:template match="*[local-name() = 'references'][@hidden='true']" mode="contents" priority="3"/>
|
11825
11850
|
|
11826
11851
|
<xsl:template match="*[local-name() = 'references']/*[local-name() = 'bibitem']" mode="contents"/>
|
@@ -12044,7 +12069,8 @@
|
|
12044
12069
|
|
12045
12070
|
<xsl:for-each select="$contents_nodes//tables/table">
|
12046
12071
|
<fo:bookmark internal-destination="{@id}">
|
12047
|
-
<fo:bookmark-title><xsl:value-of select="normalize-space(.)"/></fo:bookmark-title>
|
12072
|
+
<!-- <fo:bookmark-title><xsl:value-of select="normalize-space(.)"/></fo:bookmark-title> -->
|
12073
|
+
<fo:bookmark-title><xsl:apply-templates mode="bookmark_clean"/></fo:bookmark-title>
|
12048
12074
|
</fo:bookmark>
|
12049
12075
|
</xsl:for-each>
|
12050
12076
|
</fo:bookmark>
|
@@ -12053,6 +12079,26 @@
|
|
12053
12079
|
</xsl:template> <!-- insertTableBookmarks -->
|
12054
12080
|
<!-- End Bookmarks -->
|
12055
12081
|
|
12082
|
+
<!-- ============================ -->
|
12083
|
+
<!-- mode="bookmark_clean" -->
|
12084
|
+
<!-- ============================ -->
|
12085
|
+
<xsl:template match="node()" mode="bookmark_clean">
|
12086
|
+
<xsl:apply-templates select="node()" mode="bookmark_clean"/>
|
12087
|
+
</xsl:template>
|
12088
|
+
|
12089
|
+
<xsl:template match="text()" mode="bookmark_clean">
|
12090
|
+
<xsl:value-of select="."/>
|
12091
|
+
</xsl:template>
|
12092
|
+
|
12093
|
+
<xsl:template match="*[local-name() = 'math']" mode="bookmark_clean">
|
12094
|
+
<xsl:value-of select="normalize-space(.)"/>
|
12095
|
+
</xsl:template>
|
12096
|
+
|
12097
|
+
<xsl:template match="*[local-name() = 'asciimath']" mode="bookmark_clean"/>
|
12098
|
+
<!-- ============================ -->
|
12099
|
+
<!-- END: mode="bookmark_clean" -->
|
12100
|
+
<!-- ============================ -->
|
12101
|
+
|
12056
12102
|
<xsl:template name="getLangVersion">
|
12057
12103
|
<xsl:param name="lang"/>
|
12058
12104
|
<xsl:param name="doctype" select="''"/>
|
@@ -14061,9 +14107,15 @@
|
|
14061
14107
|
<xsl:when test="local-name(..) = 'ul'">
|
14062
14108
|
<xsl:choose>
|
14063
14109
|
<xsl:when test="normalize-space($processing_instruction_type) = 'simple'"/>
|
14110
|
+
<!-- https://github.com/metanorma/isodoc/issues/675 -->
|
14111
|
+
<xsl:when test="@label"><xsl:value-of select="@label"/></xsl:when>
|
14064
14112
|
<xsl:otherwise><xsl:call-template name="setULLabel"/></xsl:otherwise>
|
14065
14113
|
</xsl:choose>
|
14066
14114
|
</xsl:when>
|
14115
|
+
<!-- https://github.com/metanorma/isodoc/issues/675 -->
|
14116
|
+
<xsl:when test="local-name(..) = 'ol' and @label and @full = 'true'"> <!-- @full added in the template li/fmt-name -->
|
14117
|
+
<xsl:value-of select="@label"/>
|
14118
|
+
</xsl:when>
|
14067
14119
|
<xsl:when test="local-name(..) = 'ol' and @label"> <!-- for ordered lists 'ol', and if there is @label, for instance label="1.1.2" -->
|
14068
14120
|
|
14069
14121
|
<xsl:variable name="type" select="../@type"/>
|
@@ -14188,7 +14240,7 @@
|
|
14188
14240
|
|
14189
14241
|
</xsl:otherwise>
|
14190
14242
|
</xsl:choose>
|
14191
|
-
</xsl:template>
|
14243
|
+
</xsl:template> <!-- getListItemFormat -->
|
14192
14244
|
|
14193
14245
|
<xsl:template match="*[local-name() = 'ul'] | *[local-name() = 'ol']">
|
14194
14246
|
<xsl:param name="indent">0</xsl:param>
|
@@ -14320,6 +14372,11 @@
|
|
14320
14372
|
|
14321
14373
|
<xsl:call-template name="refine_list-item-label-style"/>
|
14322
14374
|
|
14375
|
+
<xsl:if test="local-name(..) = 'ul'">
|
14376
|
+
<xsl:variable name="li_label" select="@label"/>
|
14377
|
+
<xsl:copy-of select="$ul_labels//label[. = $li_label]/@*[not(local-name() = 'level')]"/>
|
14378
|
+
</xsl:if>
|
14379
|
+
|
14323
14380
|
<!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
|
14324
14381
|
<xsl:if test="*[1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
|
14325
14382
|
<xsl:call-template name="append_add-style"/>
|
@@ -15766,6 +15823,16 @@
|
|
15766
15823
|
</xsl:choose>
|
15767
15824
|
</xsl:template>
|
15768
15825
|
|
15826
|
+
<!-- li/fmt-name -->
|
15827
|
+
<xsl:template match="*[local-name() = 'li']/*[local-name() = 'fmt-name']" priority="2" mode="update_xml_step1">
|
15828
|
+
<xsl:attribute name="label"><xsl:value-of select="."/></xsl:attribute>
|
15829
|
+
<xsl:attribute name="full">true</xsl:attribute>
|
15830
|
+
</xsl:template>
|
15831
|
+
<xsl:template match="*[local-name() = 'li']/*[local-name() = 'fmt-name']" priority="2" mode="update_xml_pres">
|
15832
|
+
<xsl:attribute name="label"><xsl:value-of select="."/></xsl:attribute>
|
15833
|
+
<xsl:attribute name="full">true</xsl:attribute>
|
15834
|
+
</xsl:template>
|
15835
|
+
|
15769
15836
|
<xsl:template match="*[local-name() = 'fmt-preferred']"/>
|
15770
15837
|
<xsl:template match="*[local-name() = 'fmt-preferred'][*[local-name() = 'p']]" mode="update_xml_step1">
|
15771
15838
|
<xsl:apply-templates mode="update_xml_step1"/>
|
@@ -16684,6 +16751,64 @@
|
|
16684
16751
|
<fo:inline xml:lang="none"><xsl:value-of select="."/></fo:inline>
|
16685
16752
|
</xsl:template>
|
16686
16753
|
|
16754
|
+
<!-- ===================================== -->
|
16755
|
+
<!-- ===================================== -->
|
16756
|
+
<!-- Ruby text (CJK languages) rendering -->
|
16757
|
+
<!-- ===================================== -->
|
16758
|
+
<!-- ===================================== -->
|
16759
|
+
<xsl:template match="*[local-name() = 'ruby']">
|
16760
|
+
<fo:inline-container text-indent="0mm" last-line-end-indent="0mm">
|
16761
|
+
<xsl:if test="not(ancestor::*[local-name() = 'ruby'])">
|
16762
|
+
<xsl:attribute name="alignment-baseline">central</xsl:attribute>
|
16763
|
+
</xsl:if>
|
16764
|
+
<xsl:variable name="rt_text" select="*[local-name() = 'rt']"/>
|
16765
|
+
<xsl:variable name="rb_text" select=".//*[local-name() = 'rb'][not(*[local-name() = 'ruby'])]"/>
|
16766
|
+
<!-- Example: width="2em" -->
|
16767
|
+
<xsl:variable name="text_rt_width" select="java:org.metanorma.fop.Util.getStringWidthByFontSize($rt_text, $font_main, 6)"/>
|
16768
|
+
<xsl:variable name="text_rb_width" select="java:org.metanorma.fop.Util.getStringWidthByFontSize($rb_text, $font_main, 10)"/>
|
16769
|
+
<xsl:variable name="text_width">
|
16770
|
+
<xsl:choose>
|
16771
|
+
<xsl:when test="$text_rt_width >= $text_rb_width"><xsl:value-of select="$text_rt_width"/></xsl:when>
|
16772
|
+
<xsl:otherwise><xsl:value-of select="$text_rb_width"/></xsl:otherwise>
|
16773
|
+
</xsl:choose>
|
16774
|
+
</xsl:variable>
|
16775
|
+
<xsl:attribute name="width"><xsl:value-of select="$text_width div 10"/>em</xsl:attribute>
|
16776
|
+
|
16777
|
+
<xsl:choose>
|
16778
|
+
<xsl:when test="ancestor::*[local-name() = 'ruby']">
|
16779
|
+
<xsl:apply-templates select="*[local-name() = 'rb']"/>
|
16780
|
+
<xsl:apply-templates select="*[local-name() = 'rt']"/>
|
16781
|
+
</xsl:when>
|
16782
|
+
<xsl:otherwise>
|
16783
|
+
<xsl:apply-templates select="*[local-name() = 'rt']"/>
|
16784
|
+
<xsl:apply-templates select="*[local-name() = 'rb']"/>
|
16785
|
+
</xsl:otherwise>
|
16786
|
+
</xsl:choose>
|
16787
|
+
|
16788
|
+
<xsl:apply-templates select="node()[not(local-name() = 'rt') and not(local-name() = 'rb')]"/>
|
16789
|
+
</fo:inline-container>
|
16790
|
+
</xsl:template>
|
16791
|
+
|
16792
|
+
<xsl:template match="*[local-name() = 'rb']">
|
16793
|
+
<fo:block line-height="1em" text-align="center"><xsl:apply-templates/></fo:block>
|
16794
|
+
</xsl:template>
|
16795
|
+
|
16796
|
+
<xsl:template match="*[local-name() = 'rt']">
|
16797
|
+
<fo:block font-size="0.5em" text-align="center" line-height="1.2em" space-before="-1.4em" space-before.conditionality="retain"> <!-- -->
|
16798
|
+
<xsl:if test="ancestor::*[local-name() = 'ruby'][last()]//*[local-name() = 'ruby'] or ancestor::*[local-name() = 'rb']">
|
16799
|
+
<xsl:attribute name="space-before">0em</xsl:attribute>
|
16800
|
+
</xsl:if>
|
16801
|
+
<xsl:apply-templates/>
|
16802
|
+
</fo:block>
|
16803
|
+
|
16804
|
+
</xsl:template>
|
16805
|
+
|
16806
|
+
<!-- ===================================== -->
|
16807
|
+
<!-- ===================================== -->
|
16808
|
+
<!-- END: Ruby text (CJK languages) rendering -->
|
16809
|
+
<!-- ===================================== -->
|
16810
|
+
<!-- ===================================== -->
|
16811
|
+
|
16687
16812
|
<xsl:template name="printEdition">
|
16688
16813
|
<xsl:variable name="edition_i18n" select="normalize-space((//*[local-name() = 'metanorma'])[1]/*[local-name() = 'bibdata']/*[local-name() = 'edition'][normalize-space(@language) != ''])"/>
|
16689
16814
|
|
@@ -0,0 +1,167 @@
|
|
1
|
+
module IsoDoc
|
2
|
+
module Ieee
|
3
|
+
class PresentationXMLConvert < IsoDoc::PresentationXMLConvert
|
4
|
+
def deprecates(desgn)
|
5
|
+
desgn.remove
|
6
|
+
end
|
7
|
+
|
8
|
+
def designation_boldface(desgn)
|
9
|
+
name = desgn.at(ns("./expression/name | ./letter-symbol/name")) or return
|
10
|
+
name.children = "<strong>#{name.children}</strong>"
|
11
|
+
end
|
12
|
+
|
13
|
+
def related(docxml)
|
14
|
+
insert_related_type(docxml)
|
15
|
+
admitted_to_related docxml
|
16
|
+
term_reorder(docxml)
|
17
|
+
docxml.xpath(ns("//term[fmt-related/semx]")).each do |f|
|
18
|
+
related_term(f)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
# temporarily insert related/@type to fmt-related/semx, for sorting
|
23
|
+
def insert_related_type(docxml)
|
24
|
+
docxml.xpath(ns("//fmt-related/semx")).each do |r|
|
25
|
+
orig = semx_orig(r)
|
26
|
+
r["type"] = orig["type"]
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def related_term(term)
|
31
|
+
r = term.at(ns("./fmt-related"))
|
32
|
+
r.xpath(ns(".//xref | .//eref | .//termref")).each(&:remove)
|
33
|
+
coll = sort_related(r.xpath(ns("./semx")))
|
34
|
+
r.children = term_related_collapse(coll)
|
35
|
+
end
|
36
|
+
|
37
|
+
def term_related_collapse(coll)
|
38
|
+
ret = [[coll[0]]]
|
39
|
+
coll[1..-1].each do |r|
|
40
|
+
if ret[-1][0]["type"] != r["type"]
|
41
|
+
ret << [r]
|
42
|
+
next
|
43
|
+
end
|
44
|
+
ret[-1] << r
|
45
|
+
end
|
46
|
+
ret.map do |x|
|
47
|
+
x.map do |y|
|
48
|
+
to_xml(y)
|
49
|
+
end.join("; ")
|
50
|
+
end.map { |x| "<p>#{x}</p>" }.join("\n")
|
51
|
+
end
|
52
|
+
|
53
|
+
def sort_terms_key(term)
|
54
|
+
d = term.at(ns("./preferred/expression/name | " \
|
55
|
+
"./preferred/letter-symbol/name | " \
|
56
|
+
"./preferred/graphical-symbol/figure/name | " \
|
57
|
+
"./preferred/graphical-symbol/figure/@id | " \
|
58
|
+
"./preferred | ./fmt-preferred//semx"))
|
59
|
+
f = term.at(ns("./field-of-application")) || term.at(ns("./domain"))
|
60
|
+
@c.decode("#{sort_terms_key1(d)} :: #{sort_terms_key1(f)}")
|
61
|
+
end
|
62
|
+
|
63
|
+
def sort_terms_key1(elem)
|
64
|
+
elem.nil? and return "zzzz"
|
65
|
+
dup = elem.dup
|
66
|
+
dup.xpath(ns(".//asciimath | .//latexmath")).each(&:remove)
|
67
|
+
dup.text&.strip&.downcase || "zzzz"
|
68
|
+
end
|
69
|
+
|
70
|
+
def sort_related(coll)
|
71
|
+
coll.sort do |a, b|
|
72
|
+
sort_related_key(a) <=> sort_related_key(b)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
def sort_related_key(related)
|
77
|
+
type = case related["type"]
|
78
|
+
when "contrast" then 1
|
79
|
+
when "equivalent" then 2
|
80
|
+
when "see" then 3
|
81
|
+
when "seealso" then 4
|
82
|
+
else "5-#{related['type']}"
|
83
|
+
end
|
84
|
+
"#{type} :: #{sort_terms_key(related)}"
|
85
|
+
end
|
86
|
+
|
87
|
+
def admitted_to_related(docxml)
|
88
|
+
docxml.xpath(ns("//term")).each do |t|
|
89
|
+
t.xpath(ns("./fmt-admitted/semx | ./fmt-preferred/semx")).each_with_index do |a, i|
|
90
|
+
orig = semx_orig(a)
|
91
|
+
(i.zero? ||
|
92
|
+
orig.at(ns("./abbreviation-type | ./graphical-symbol"))) and next
|
93
|
+
out = t.at(ns("./fmt-related")) || t.at(ns("./definition")).before("<fmt-related/>").previous
|
94
|
+
admitted_to_related1(a, t.at(ns("./fmt-preferred/semx")), out)
|
95
|
+
a.parent.name == "fmt-preferred" and a.remove
|
96
|
+
end
|
97
|
+
t.at(ns("./fmt-admitted"))&.remove
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
def admitted_to_related1(adm, pref, out)
|
102
|
+
out << <<~TERM
|
103
|
+
<semx element='related' source='#{adm['source']}' type='equivalent'><fmt-preferred>#{to_xml(adm)}</p></semx></fmt-preferred>
|
104
|
+
TERM
|
105
|
+
out.parent.next = <<~TERM
|
106
|
+
<term><fmt-preferred>#{to_xml(adm)}</fmt-preferred>
|
107
|
+
<fmt-related>
|
108
|
+
<semx element="related" source="#{pref['source']}" type="see"><fmt-preferred>#{to_xml(pref)}</fmt-preferred></semx>
|
109
|
+
</fmt-related>
|
110
|
+
<fmt-definition></fmt-definition></term>
|
111
|
+
TERM
|
112
|
+
end
|
113
|
+
|
114
|
+
def term_reorder(xmldoc)
|
115
|
+
xmldoc.xpath(ns("//terms")).each { |t| term_reorder1(t) }
|
116
|
+
end
|
117
|
+
|
118
|
+
def term_reorder1(terms)
|
119
|
+
ins = terms.at(ns("./term"))&.previous_element or return
|
120
|
+
coll = terms.xpath(ns("./term"))
|
121
|
+
ret = sort_terms(coll)
|
122
|
+
coll.each(&:remove)
|
123
|
+
ret.reverse_each { |t| ins.next = t }
|
124
|
+
end
|
125
|
+
|
126
|
+
def sort_terms(terms)
|
127
|
+
terms.sort do |a, b|
|
128
|
+
sort_terms_key(a) <=> sort_terms_key(b)
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
def designation_field(desgn, name, orig)
|
133
|
+
if desgn["element"] == "preferred"
|
134
|
+
f = orig.parent.xpath(ns("./domain | ./subject"))
|
135
|
+
.map { |u| to_xml(semx_fmt_dup(u)) }.join(", ")
|
136
|
+
name << "<span class='fmt-designation-field'>, <#{f}></span>" unless f.empty?
|
137
|
+
end
|
138
|
+
super
|
139
|
+
end
|
140
|
+
|
141
|
+
def merge_second_preferred(term)
|
142
|
+
term.name == "fmt-admitted" and return
|
143
|
+
pref =
|
144
|
+
term.parent.at(ns("./preferred[not(abbreviation-type)][expression/name]"))
|
145
|
+
x = term.parent.xpath(ns("./preferred[expression/name][abbreviation-type] | " \
|
146
|
+
"./admitted[expression/name][abbreviation-type]"))
|
147
|
+
(pref && !x.empty?) or return
|
148
|
+
fmt_pref = term.parent.at(ns(".//semx[@source = '#{pref['id']}']"))
|
149
|
+
fdf = fmt_pref.at(ns(".//span[@class = 'fmt-designation-field']"))&.text
|
150
|
+
out = to_xml(fmt_pref)
|
151
|
+
tail = x.map do |p|
|
152
|
+
ret = term.parent.at(ns(".//semx[@source = '#{p['id']}']")).remove
|
153
|
+
fdf1 = ret.at(ns(".//span[@class = 'fmt-designation-field']"))
|
154
|
+
fdf1 && (fdf1&.text == fdf) and fdf1.remove # repetition of domain suppressed
|
155
|
+
to_xml(ret).strip
|
156
|
+
end.join(", ")
|
157
|
+
out += " (#{tail})"
|
158
|
+
term.children = out
|
159
|
+
end
|
160
|
+
|
161
|
+
def concept1(node)
|
162
|
+
concept_render(node, ital: "false", ref: "false", bold: "false",
|
163
|
+
linkref: "false", linkmention: "false")
|
164
|
+
end
|
165
|
+
end
|
166
|
+
end
|
167
|
+
end
|