metanorma-plateau 1.0.1 → 1.0.2

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: 1268e01df68c0fb0e3183fe765d12baf42671e556aa706f05994cd88588ea20b
4
- data.tar.gz: 4c5d698b9b0920e8d531f4096b42688e29a1c787b85e72c5125616bf9b5ac489
3
+ metadata.gz: dc08fb504acf45c0d77f27f9bbcf191ca7628848872579378dcb9affe6ba9eda
4
+ data.tar.gz: 361bf2f09029b5e6ce0a3ae64bef629641a459e6007d590c6473b4be7422cd50
5
5
  SHA512:
6
- metadata.gz: c041ac3a8da56eb013fca3cbaee812419c05a5a764c0b7bf4f68c00b3430b52cc5c035b41a507810975d336cc779b25ba5186d9cbdded21d1d67f7f5ae9ef525
7
- data.tar.gz: c9ea20b4a996ff0d067450b88aa0e53e7942e6b0e33c07487807dd4a1847b2cf54cdc860b64ab17aa1522080f3c1421f9c1d1f8045fe73573f5b6b1adec101d9
6
+ metadata.gz: 58989675f6c1df60b3a80e486a8dc6ee7e0eb8a649c725b98939a8524e9b61c39f31cc730af6311808f05c8859f481f8419e8abf8ad1c1e522654f60e94d17f7
7
+ data.tar.gz: 89df4cbeffa86118cb426d04deb89c22cf602b419239f26d93addc844649f18b33942cc51bf01acf709ec31e2082645ad4e123bed74d93c6ae17cfc4409c2830
@@ -2685,6 +2685,7 @@
2685
2685
  </xsl:template> <!-- refine_table-style -->
2686
2686
 
2687
2687
  <xsl:attribute-set name="table-name-style">
2688
+ <xsl:attribute name="role">Caption</xsl:attribute>
2688
2689
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
2689
2690
 
2690
2691
  <xsl:attribute name="font-weight">bold</xsl:attribute>
@@ -2696,6 +2697,9 @@
2696
2697
 
2697
2698
  <xsl:template name="refine_table-name-style">
2698
2699
  <xsl:param name="continued"/>
2700
+ <xsl:if test="$continued = 'true'">
2701
+ <xsl:attribute name="role">SKIP</xsl:attribute>
2702
+ </xsl:if>
2699
2703
 
2700
2704
  <xsl:if test="$doctype = 'technical-report'">
2701
2705
  <xsl:attribute name="font-weight">normal</xsl:attribute>
@@ -4465,7 +4469,7 @@
4465
4469
  </xsl:if>
4466
4470
 
4467
4471
  </fo:block-container>
4468
- </xsl:variable>
4472
+ </xsl:variable> <!-- END: variable name="table" -->
4469
4473
 
4470
4474
  <xsl:variable name="isAdded" select="@added"/>
4471
4475
  <xsl:variable name="isDeleted" select="@deleted"/>
@@ -4475,14 +4479,14 @@
4475
4479
 
4476
4480
  <!-- centered table when table name is centered (see table-name-style) -->
4477
4481
 
4478
- <fo:table table-layout="fixed" width="100%" xsl:use-attribute-sets="table-container-style">
4482
+ <fo:table table-layout="fixed" width="100%" xsl:use-attribute-sets="table-container-style" role="SKIP">
4479
4483
 
4480
4484
  <fo:table-column column-width="proportional-column-width(1)"/>
4481
4485
  <fo:table-column column-width="{@width}"/>
4482
4486
  <fo:table-column column-width="proportional-column-width(1)"/>
4483
- <fo:table-body>
4484
- <fo:table-row>
4485
- <fo:table-cell column-number="2">
4487
+ <fo:table-body role="SKIP">
4488
+ <fo:table-row role="SKIP">
4489
+ <fo:table-cell column-number="2" role="SKIP">
4486
4490
  <xsl:copy-of select="$table-preamble"/>
4487
4491
  <fo:block role="SKIP">
4488
4492
  <xsl:call-template name="setTrackChangesStyles">
@@ -4523,11 +4527,12 @@
4523
4527
 
4524
4528
  </xsl:template>
4525
4529
 
4530
+ <!-- table/name-->
4526
4531
  <xsl:template match="*[local-name()='table']/*[local-name() = 'name']">
4527
4532
  <xsl:param name="continued"/>
4528
4533
  <xsl:if test="normalize-space() != ''">
4529
4534
 
4530
- <fo:block xsl:use-attribute-sets="table-name-style" role="SKIP">
4535
+ <fo:block xsl:use-attribute-sets="table-name-style">
4531
4536
 
4532
4537
  <xsl:call-template name="refine_table-name-style">
4533
4538
  <xsl:with-param name="continued" select="$continued"/>
@@ -5004,7 +5009,7 @@
5004
5009
 
5005
5010
  <xsl:variable name="tableWithNotesAndFootnotes">
5006
5011
 
5007
- <fo:table keep-with-previous="always">
5012
+ <fo:table keep-with-previous="always" role="SKIP">
5008
5013
  <xsl:for-each select="xalan:nodeset($table_attributes)/table_attributes/@*">
5009
5014
  <xsl:variable name="name" select="local-name()"/>
5010
5015
  <xsl:choose>
@@ -5035,9 +5040,9 @@
5035
5040
  </xsl:otherwise>
5036
5041
  </xsl:choose>
5037
5042
 
5038
- <fo:table-body>
5039
- <fo:table-row>
5040
- <fo:table-cell xsl:use-attribute-sets="table-footer-cell-style" number-columns-spanned="{$cols-count}">
5043
+ <fo:table-body role="SKIP">
5044
+ <fo:table-row role="SKIP">
5045
+ <fo:table-cell xsl:use-attribute-sets="table-footer-cell-style" number-columns-spanned="{$cols-count}" role="SKIP">
5041
5046
 
5042
5047
  <xsl:call-template name="refine_table-footer-cell-style"/>
5043
5048
 
@@ -5432,6 +5437,7 @@
5432
5437
  <!-- footnotes in text (title, bibliography, main body), not for tables, figures and names --> <!-- table's, figure's names -->
5433
5438
  <!-- fn in text -->
5434
5439
  <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">
5440
+ <xsl:param name="footnote_body_from_table">false</xsl:param>
5435
5441
 
5436
5442
  <!-- list of unique footnotes -->
5437
5443
  <xsl:variable name="p_fn_">
@@ -5497,7 +5503,7 @@
5497
5503
  <xsl:copy-of select="$footnote_inline"/>
5498
5504
  </xsl:when>
5499
5505
  <!-- <xsl:when test="$footnotes//*[local-name() = 'fmt-fn-body'][@id = $ref_id] or normalize-space(@skip_footnote_body) = 'false'"> -->
5500
- <xsl:when test="$p_fn//fn[@gen_id = $gen_id] or normalize-space(@skip_footnote_body) = 'false'">
5506
+ <xsl:when test="$p_fn//fn[@gen_id = $gen_id] or normalize-space(@skip_footnote_body) = 'false' or $footnote_body_from_table = 'true'">
5501
5507
 
5502
5508
  <fo:footnote xsl:use-attribute-sets="fn-style" role="SKIP">
5503
5509
  <xsl:copy-of select="$footnote_inline"/>
@@ -5915,39 +5921,51 @@
5915
5921
  <!-- fn reference in the table rendering (for instance, 'some text 1) some text' ) -->
5916
5922
  <!-- fn --> <!-- in table --> <!-- for figure see <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'fn']" priority="2"/> -->
5917
5923
  <xsl:template match="*[local-name()='fn']">
5918
- <fo:inline xsl:use-attribute-sets="fn-reference-style">
5919
-
5920
- <xsl:call-template name="refine_fn-reference-style"/>
5924
+ <xsl:variable name="target" select="@target"/>
5925
+ <xsl:choose>
5926
+ <!-- case for footnotes in Requirement tables (https://github.com/metanorma/metanorma-ogc/issues/791) -->
5927
+ <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]">
5928
+ <xsl:call-template name="fn">
5929
+ <xsl:with-param name="footnote_body_from_table">true</xsl:with-param>
5930
+ </xsl:call-template>
5931
+ </xsl:when>
5932
+ <xsl:otherwise>
5921
5933
 
5922
- <!-- <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="footnote {@reference}"> --> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
5923
- <fo:basic-link internal-destination="{@target}" fox:alt-text="footnote {@reference}">
5924
- <!-- <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> --> <!-- for footnotes in tables -->
5925
- <!-- <xsl:attribute name="internal-destination">
5926
- <xsl:value-of select="concat(@reference, '_', ancestor::*[local-name()='table'][1]/@id)"/>
5927
- </xsl:attribute>
5928
- </xsl:if>
5929
- <xsl:if test="$namespace = 'ogc' or $namespace = 'ogc-white-paper'">
5930
- <xsl:attribute name="internal-destination">
5931
- <xsl:value-of select="@reference"/><xsl:text>_</xsl:text>
5932
- <xsl:value-of select="ancestor::*[local-name()='table'][1]/@id"/>
5933
- </xsl:attribute>
5934
- </xsl:if> -->
5935
- <!-- <xsl:if test="$namespace = 'plateau'">
5936
- <xsl:text>※</xsl:text>
5937
- </xsl:if> -->
5938
- <!-- <xsl:value-of select="@reference"/> -->
5934
+ <fo:inline xsl:use-attribute-sets="fn-reference-style">
5939
5935
 
5940
- <xsl:value-of select="normalize-space(*[local-name() = 'fmt-fn-label'])"/>
5936
+ <xsl:call-template name="refine_fn-reference-style"/>
5941
5937
 
5942
- <!-- <xsl:if test="$namespace = 'bsi'">
5943
- <xsl:text>)</xsl:text>
5944
- </xsl:if> -->
5945
- <!-- commented, https://github.com/metanorma/isodoc/issues/614 -->
5946
- <!-- <xsl:if test="$namespace = 'jis'">
5947
- <fo:inline font-weight="normal">)</fo:inline>
5948
- </xsl:if> -->
5949
- </fo:basic-link>
5950
- </fo:inline>
5938
+ <!-- <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="footnote {@reference}"> --> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
5939
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="footnote {@reference}">
5940
+ <!-- <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> --> <!-- for footnotes in tables -->
5941
+ <!-- <xsl:attribute name="internal-destination">
5942
+ <xsl:value-of select="concat(@reference, '_', ancestor::*[local-name()='table'][1]/@id)"/>
5943
+ </xsl:attribute>
5944
+ </xsl:if>
5945
+ <xsl:if test="$namespace = 'ogc' or $namespace = 'ogc-white-paper'">
5946
+ <xsl:attribute name="internal-destination">
5947
+ <xsl:value-of select="@reference"/><xsl:text>_</xsl:text>
5948
+ <xsl:value-of select="ancestor::*[local-name()='table'][1]/@id"/>
5949
+ </xsl:attribute>
5950
+ </xsl:if> -->
5951
+ <!-- <xsl:if test="$namespace = 'plateau'">
5952
+ <xsl:text>※</xsl:text>
5953
+ </xsl:if> -->
5954
+ <!-- <xsl:value-of select="@reference"/> -->
5955
+
5956
+ <xsl:value-of select="normalize-space(*[local-name() = 'fmt-fn-label'])"/>
5957
+
5958
+ <!-- <xsl:if test="$namespace = 'bsi'">
5959
+ <xsl:text>)</xsl:text>
5960
+ </xsl:if> -->
5961
+ <!-- commented, https://github.com/metanorma/isodoc/issues/614 -->
5962
+ <!-- <xsl:if test="$namespace = 'jis'">
5963
+ <fo:inline font-weight="normal">)</fo:inline>
5964
+ </xsl:if> -->
5965
+ </fo:basic-link>
5966
+ </fo:inline>
5967
+ </xsl:otherwise>
5968
+ </xsl:choose>
5951
5969
  </xsl:template> <!-- fn -->
5952
5970
 
5953
5971
  <!-- fn/text() -->
@@ -9985,6 +10003,13 @@
9985
10003
  <xsl:apply-templates select="."/>
9986
10004
  </xsl:template>
9987
10005
 
10006
+ <!-- prevent missing stem for table and figures in ToC -->
10007
+ <xsl:template match="*[local-name() = 'name' or local-name() = 'fmt-name']//*[local-name() = 'stem']" mode="contents">
10008
+ <xsl:if test="not(following-sibling::*[1][local-name() = 'fmt-stem'])">
10009
+ <xsl:apply-templates select="."/>
10010
+ </xsl:if>
10011
+ </xsl:template>
10012
+
9988
10013
  <xsl:template match="*[local-name() = 'references'][@hidden='true']" mode="contents" priority="3"/>
9989
10014
 
9990
10015
  <xsl:template match="*[local-name() = 'references']/*[local-name() = 'bibitem']" mode="contents"/>
@@ -10208,7 +10233,8 @@
10208
10233
 
10209
10234
  <xsl:for-each select="$contents_nodes//tables/table">
10210
10235
  <fo:bookmark internal-destination="{@id}">
10211
- <fo:bookmark-title><xsl:value-of select="normalize-space(.)"/></fo:bookmark-title>
10236
+ <!-- <fo:bookmark-title><xsl:value-of select="normalize-space(.)"/></fo:bookmark-title> -->
10237
+ <fo:bookmark-title><xsl:apply-templates mode="bookmark_clean"/></fo:bookmark-title>
10212
10238
  </fo:bookmark>
10213
10239
  </xsl:for-each>
10214
10240
  </fo:bookmark>
@@ -10217,6 +10243,26 @@
10217
10243
  </xsl:template> <!-- insertTableBookmarks -->
10218
10244
  <!-- End Bookmarks -->
10219
10245
 
10246
+ <!-- ============================ -->
10247
+ <!-- mode="bookmark_clean" -->
10248
+ <!-- ============================ -->
10249
+ <xsl:template match="node()" mode="bookmark_clean">
10250
+ <xsl:apply-templates select="node()" mode="bookmark_clean"/>
10251
+ </xsl:template>
10252
+
10253
+ <xsl:template match="text()" mode="bookmark_clean">
10254
+ <xsl:value-of select="."/>
10255
+ </xsl:template>
10256
+
10257
+ <xsl:template match="*[local-name() = 'math']" mode="bookmark_clean">
10258
+ <xsl:value-of select="normalize-space(.)"/>
10259
+ </xsl:template>
10260
+
10261
+ <xsl:template match="*[local-name() = 'asciimath']" mode="bookmark_clean"/>
10262
+ <!-- ============================ -->
10263
+ <!-- END: mode="bookmark_clean" -->
10264
+ <!-- ============================ -->
10265
+
10220
10266
  <xsl:template name="getLangVersion">
10221
10267
  <xsl:param name="lang"/>
10222
10268
  <xsl:param name="doctype" select="''"/>
@@ -12210,9 +12256,15 @@
12210
12256
  <xsl:when test="local-name(..) = 'ul'">
12211
12257
  <xsl:choose>
12212
12258
  <xsl:when test="normalize-space($processing_instruction_type) = 'simple'"/>
12259
+ <!-- https://github.com/metanorma/isodoc/issues/675 -->
12260
+ <xsl:when test="@label"><xsl:value-of select="@label"/></xsl:when>
12213
12261
  <xsl:otherwise><xsl:call-template name="setULLabel"/></xsl:otherwise>
12214
12262
  </xsl:choose>
12215
12263
  </xsl:when>
12264
+ <!-- https://github.com/metanorma/isodoc/issues/675 -->
12265
+ <xsl:when test="local-name(..) = 'ol' and @label and @full = 'true'"> <!-- @full added in the template li/fmt-name -->
12266
+ <xsl:value-of select="@label"/>
12267
+ </xsl:when>
12216
12268
  <xsl:when test="local-name(..) = 'ol' and @label"> <!-- for ordered lists 'ol', and if there is @label, for instance label="1.1.2" -->
12217
12269
 
12218
12270
  <xsl:variable name="type" select="../@type"/>
@@ -12337,7 +12389,7 @@
12337
12389
 
12338
12390
  </xsl:otherwise>
12339
12391
  </xsl:choose>
12340
- </xsl:template>
12392
+ </xsl:template> <!-- getListItemFormat -->
12341
12393
 
12342
12394
  <xsl:template match="*[local-name() = 'ul'] | *[local-name() = 'ol']">
12343
12395
  <xsl:param name="indent">0</xsl:param>
@@ -12476,6 +12528,11 @@
12476
12528
 
12477
12529
  <xsl:call-template name="refine_list-item-label-style"/>
12478
12530
 
12531
+ <xsl:if test="local-name(..) = 'ul'">
12532
+ <xsl:variable name="li_label" select="@label"/>
12533
+ <xsl:copy-of select="$ul_labels//label[. = $li_label]/@*[not(local-name() = 'level')]"/>
12534
+ </xsl:if>
12535
+
12479
12536
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
12480
12537
  <xsl:if test="*[1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
12481
12538
  <xsl:call-template name="append_add-style"/>
@@ -13874,6 +13931,16 @@
13874
13931
  </xsl:choose>
13875
13932
  </xsl:template>
13876
13933
 
13934
+ <!-- li/fmt-name -->
13935
+ <xsl:template match="*[local-name() = 'li']/*[local-name() = 'fmt-name']" priority="2" mode="update_xml_step1">
13936
+ <xsl:attribute name="label"><xsl:value-of select="."/></xsl:attribute>
13937
+ <xsl:attribute name="full">true</xsl:attribute>
13938
+ </xsl:template>
13939
+ <xsl:template match="*[local-name() = 'li']/*[local-name() = 'fmt-name']" priority="2" mode="update_xml_pres">
13940
+ <xsl:attribute name="label"><xsl:value-of select="."/></xsl:attribute>
13941
+ <xsl:attribute name="full">true</xsl:attribute>
13942
+ </xsl:template>
13943
+
13877
13944
  <xsl:template match="*[local-name() = 'fmt-preferred']"/>
13878
13945
  <xsl:template match="*[local-name() = 'fmt-preferred'][*[local-name() = 'p']]" mode="update_xml_step1">
13879
13946
  <xsl:apply-templates mode="update_xml_step1"/>
@@ -14795,6 +14862,64 @@
14795
14862
  <fo:inline xml:lang="none"><xsl:value-of select="."/></fo:inline>
14796
14863
  </xsl:template>
14797
14864
 
14865
+ <!-- ===================================== -->
14866
+ <!-- ===================================== -->
14867
+ <!-- Ruby text (CJK languages) rendering -->
14868
+ <!-- ===================================== -->
14869
+ <!-- ===================================== -->
14870
+ <xsl:template match="*[local-name() = 'ruby']">
14871
+ <fo:inline-container text-indent="0mm" last-line-end-indent="0mm">
14872
+ <xsl:if test="not(ancestor::*[local-name() = 'ruby'])">
14873
+ <xsl:attribute name="alignment-baseline">central</xsl:attribute>
14874
+ </xsl:if>
14875
+ <xsl:variable name="rt_text" select="*[local-name() = 'rt']"/>
14876
+ <xsl:variable name="rb_text" select=".//*[local-name() = 'rb'][not(*[local-name() = 'ruby'])]"/>
14877
+ <!-- Example: width="2em" -->
14878
+ <xsl:variable name="text_rt_width" select="java:org.metanorma.fop.Util.getStringWidthByFontSize($rt_text, $font_main, 6)"/>
14879
+ <xsl:variable name="text_rb_width" select="java:org.metanorma.fop.Util.getStringWidthByFontSize($rb_text, $font_main, 10)"/>
14880
+ <xsl:variable name="text_width">
14881
+ <xsl:choose>
14882
+ <xsl:when test="$text_rt_width &gt;= $text_rb_width"><xsl:value-of select="$text_rt_width"/></xsl:when>
14883
+ <xsl:otherwise><xsl:value-of select="$text_rb_width"/></xsl:otherwise>
14884
+ </xsl:choose>
14885
+ </xsl:variable>
14886
+ <xsl:attribute name="width"><xsl:value-of select="$text_width div 10"/>em</xsl:attribute>
14887
+
14888
+ <xsl:choose>
14889
+ <xsl:when test="ancestor::*[local-name() = 'ruby']">
14890
+ <xsl:apply-templates select="*[local-name() = 'rb']"/>
14891
+ <xsl:apply-templates select="*[local-name() = 'rt']"/>
14892
+ </xsl:when>
14893
+ <xsl:otherwise>
14894
+ <xsl:apply-templates select="*[local-name() = 'rt']"/>
14895
+ <xsl:apply-templates select="*[local-name() = 'rb']"/>
14896
+ </xsl:otherwise>
14897
+ </xsl:choose>
14898
+
14899
+ <xsl:apply-templates select="node()[not(local-name() = 'rt') and not(local-name() = 'rb')]"/>
14900
+ </fo:inline-container>
14901
+ </xsl:template>
14902
+
14903
+ <xsl:template match="*[local-name() = 'rb']">
14904
+ <fo:block line-height="1em" text-align="center"><xsl:apply-templates/></fo:block>
14905
+ </xsl:template>
14906
+
14907
+ <xsl:template match="*[local-name() = 'rt']">
14908
+ <fo:block font-size="0.5em" text-align="center" line-height="1.2em" space-before="-1.4em" space-before.conditionality="retain"> <!-- -->
14909
+ <xsl:if test="ancestor::*[local-name() = 'ruby'][last()]//*[local-name() = 'ruby'] or ancestor::*[local-name() = 'rb']">
14910
+ <xsl:attribute name="space-before">0em</xsl:attribute>
14911
+ </xsl:if>
14912
+ <xsl:apply-templates/>
14913
+ </fo:block>
14914
+
14915
+ </xsl:template>
14916
+
14917
+ <!-- ===================================== -->
14918
+ <!-- ===================================== -->
14919
+ <!-- END: Ruby text (CJK languages) rendering -->
14920
+ <!-- ===================================== -->
14921
+ <!-- ===================================== -->
14922
+
14798
14923
  <xsl:template name="printEdition">
14799
14924
  <xsl:variable name="edition_i18n" select="normalize-space((//*[local-name() = 'metanorma'])[1]/*[local-name() = 'bibdata']/*[local-name() = 'edition'][normalize-space(@language) != ''])"/>
14800
14925
 
@@ -75,8 +75,10 @@ module IsoDoc
75
75
  elem.previous = ret
76
76
  end
77
77
 
78
+ # revert to iso
78
79
  def ol_depth(node)
79
- @iso.ol_depth(node)
80
+ depth = node.ancestors("ul, ol").size + 1
81
+ @counter.ol_type(node, depth) # defined in Xref::Counter
80
82
  end
81
83
 
82
84
  # how many columns in the table?
@@ -131,9 +133,13 @@ module IsoDoc
131
133
  end
132
134
  if node.at(ns("./note | ./source | ./example | ./fmt-footnote-container"))
133
135
  tf = final_tfoot_cell(node)
134
- node.xpath(ns("./example")).each { |x| tf.children.last.next = x.remove }
136
+ node.xpath(ns("./example")).each do |x|
137
+ tf.children.last.next = x.remove
138
+ end
135
139
  node.xpath(ns("./note")).each { |x| tf.children.last.next = x.remove }
136
- node.xpath(ns("./fmt-footnote-container")).each { |x| tf.children.last.next = x.remove }
140
+ node.xpath(ns("./fmt-footnote-container")).each do |x|
141
+ tf.children.last.next = x.remove
142
+ end
137
143
  node.xpath(ns("./source")).each do |x|
138
144
  tf.children.last.next = x.remove
139
145
  end
@@ -156,7 +162,7 @@ module IsoDoc
156
162
  def table_key(node)
157
163
  node.xpath(ns(".//dd")).each do |dd|
158
164
  text_node = dd.xpath(".//text()[normalize-space()]").first or next
159
- colon = %w(zh ja ko).include?(@lang) ? ":": ": "
165
+ colon = %w(zh ja ko).include?(@lang) ? ":" : ": "
160
166
  text_node.previous = "<span class='fmt-dt-delim'>#{colon}</span>"
161
167
  end
162
168
  end
@@ -1,4 +1,20 @@
1
1
  module IsoDoc
2
+ module XrefGen
3
+ module OlTypeProvider
4
+ # revert to ISO default
5
+ def ol_type(list, depth)
6
+ return list["type"].to_sym if list["type"]
7
+ return :arabic if [2, 7].include? depth
8
+ return :alphabet if [1, 6].include? depth
9
+ return :alphabet_upper if [4, 9].include? depth
10
+ return :roman if [3, 8].include? depth
11
+ return :roman_upper if [5, 10].include? depth
12
+
13
+ :arabic
14
+ end
15
+ end
16
+ end
17
+
2
18
  module Plateau
3
19
  class Counter < IsoDoc::XrefGen::Counter
4
20
  end
@@ -48,15 +64,14 @@ module IsoDoc
48
64
  c = IsoDoc::XrefGen::Counter.new
49
65
  j = 0
50
66
  nodeSet(clauses).each do |clause|
51
- clause.xpath(ns(FIGURE_NO_CLASS)).noblank.each do |t|
52
- labelled_ancestor(t, %w(figure)) and next # do not label nested figure
53
- j = subfigure_increment(j, c, t)
54
- #label = "#{num}#{hier_separator}#{c.print}"
55
- sublabel = subfigure_label(j)
56
- figure_anchor(t, sublabel, hiersemx(clause, num, c, t), "figure")
67
+ clause.xpath(ns(FIGURE_NO_CLASS)).noblank.each do |t|
68
+ labelled_ancestor(t, %w(figure)) and next # do not label nested figure
69
+ j = subfigure_increment(j, c, t)
70
+ sublabel = subfigure_label(j)
71
+ figure_anchor(t, sublabel, hiersemx(clause, num, c, t), "figure")
72
+ end
73
+ hierarchical_figure_class_names(clause, num)
57
74
  end
58
- hierarchical_figure_class_names(clause, num)
59
- end
60
75
  end
61
76
 
62
77
  def hierarchical_figure_class_names(clause, num)
@@ -67,9 +82,9 @@ module IsoDoc
67
82
  c[t["class"]] ||= IsoDoc::XrefGen::Counter.new
68
83
  labelled_ancestor(t, %w(figure)) and next
69
84
  j = subfigure_increment(j, c[t["class"]], t)
70
- #label = "#{num}#{hier_separator}#{c.print}"
71
85
  sublabel = j.zero? ? nil : "#{(j + 96).chr})"
72
- figure_anchor(t, sublabel, hiersemx(clause, num, c[t["class"]], t), t["class"])
86
+ figure_anchor(t, sublabel, hiersemx(clause, num, c[t["class"]], t),
87
+ t["class"])
73
88
  end
74
89
  end
75
90
 
@@ -1701,16 +1701,22 @@ which can be bookmarks as well as block or section references</a:documentation>
1701
1701
  <a:documentation>Inline reference to a paragraph or paragraphs, appearing as a footnote.
1702
1702
  The target of a footnote is the location it is embedded in within the text</a:documentation>
1703
1703
  <element name="fn">
1704
- <attribute name="reference">
1705
- <a:documentation>The number of the footnote, used to identify it visually</a:documentation>
1706
- </attribute>
1707
- <oneOrMore>
1708
- <ref name="paragraph">
1709
- <a:documentation>The content of the footnote</a:documentation>
1710
- </ref>
1711
- </oneOrMore>
1704
+ <ref name="FnAttributes"/>
1705
+ <ref name="FnBody"/>
1712
1706
  </element>
1713
1707
  </define>
1708
+ <define name="FnBody">
1709
+ <oneOrMore>
1710
+ <ref name="paragraph">
1711
+ <a:documentation>The content of the footnote</a:documentation>
1712
+ </ref>
1713
+ </oneOrMore>
1714
+ </define>
1715
+ <define name="FnAttributes">
1716
+ <attribute name="reference">
1717
+ <a:documentation>The number of the footnote, used to identify it visually</a:documentation>
1718
+ </attribute>
1719
+ </define>
1714
1720
  <define name="callout">
1715
1721
  <a:documentation>Inline reference to a paragraph or paragraphs, appearing as annotation of source code</a:documentation>
1716
1722
  <element name="callout">
@@ -1,13 +1,14 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0">
3
- <!--
4
- Add-ons to biblio.rnc for standoc model: defines the extension point BibDataExtensionType
5
- of relaton
6
-
7
- Specialisations as for biblio.rnc. Extension point can be redefined completely for a flavour of standoc
8
- (SDO); but other elements in Bibdata can only be extended (more specialised vocabularies for Bibdata)
9
- -->
10
3
  <include href="biblio.rng">
4
+ <!-- ALERT: we cannot have comments on root element, as they intervene with https://github.com/metanorma/metanorma/issues/437 fix -->
5
+ <!--
6
+ Add-ons to biblio.rnc for standoc model: defines the extension point BibDataExtensionType
7
+ of relaton
8
+
9
+ Specialisations as for biblio.rnc. Extension point can be redefined completely for a flavour of standoc
10
+ (SDO); but other elements in Bibdata can only be extended (more specialised vocabularies for Bibdata)
11
+ -->
11
12
  <define name="BibData">
12
13
  <a:documentation>The bibliographic description of a standardisation document</a:documentation>
13
14
  <ref name="StandardBibliographicItem"/>
@@ -91,6 +92,9 @@ a standards definition organization</a:documentation>
91
92
  <a:documentation>Representation of the identifier for the standardisation document, giving its individual semantic components</a:documentation>
92
93
  </ref>
93
94
  </zeroOrMore>
95
+ <ref name="DocumentImages">
96
+ <a:documentation>Coverpage and other images to be rendered with document</a:documentation>
97
+ </ref>
94
98
  </define>
95
99
  <define name="doctype">
96
100
  <a:documentation>Classification of the standardisation document</a:documentation>
@@ -268,6 +272,32 @@ and not those document components</a:documentation>
268
272
  </optional>
269
273
  </element>
270
274
  </define>
275
+ <define name="DocumentImages">
276
+ <zeroOrMore>
277
+ <element name="coverpage-image">
278
+ <a:documentation>Images to be displayed on the coverpage of the document</a:documentation>
279
+ <ref name="image-no-id"/>
280
+ </element>
281
+ </zeroOrMore>
282
+ <zeroOrMore>
283
+ <element name="innercoverpage-image">
284
+ <a:documentation>Images to be displayed on the inner coverpage of the document</a:documentation>
285
+ <ref name="image-no-id"/>
286
+ </element>
287
+ </zeroOrMore>
288
+ <zeroOrMore>
289
+ <element name="tocside-image">
290
+ <a:documentation>Images to be displayed on the Table of Contents page of the document</a:documentation>
291
+ <ref name="image-no-id"/>
292
+ </element>
293
+ </zeroOrMore>
294
+ <zeroOrMore>
295
+ <element name="backpage-image">
296
+ <a:documentation>Images to be displayed on the backpage of the document</a:documentation>
297
+ <ref name="image-no-id"/>
298
+ </element>
299
+ </zeroOrMore>
300
+ </define>
271
301
  <define name="StandardBibliographicItem">
272
302
  <ref name="BibliographicItem"/>
273
303
  <zeroOrMore>
@@ -1,23 +1,25 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
- <!--
3
- instantiations of this grammar may replace leaf strings
4
- with more elaborated types; e.g. title (text) replaced with
5
- title-main, title-intro, title-part; type replaced with
6
- enum.
7
-
8
- some renaming at leaf nodes is permissible
9
-
10
- obligations can change both from optional to mandatory,
11
- and from mandatory to optional; optional elements may
12
- be omitted; freely positioned alternatives may be replaced
13
- with strict ordering
14
-
15
- DO NOT introduce a namespace here. We do not want a distinct namespace
16
- for these elements, and a distinct namespace for any grammar inheriting
17
- these elements; we just want one namespace for any child grammars
18
- of this.
19
- -->
20
2
  <grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
3
+ <!--
4
+ ALERT: we cannot have comments on root element, as they intervene with https://github.com/metanorma/metanorma/issues/437 fix
5
+
6
+ Instantiations of this grammar may replace leaf strings
7
+ with more elaborated types; e.g. title (text) replaced with
8
+ title-main, title-intro, title-part; type replaced with
9
+ enum.
10
+
11
+ Some renaming at leaf nodes is permissible
12
+
13
+ Obligations can change both from optional to mandatory,
14
+ and from mandatory to optional; optional elements may
15
+ be omitted; freely positioned alternatives may be replaced
16
+ with strict ordering
17
+
18
+ DO NOT introduce a namespace here. We do not want a distinct namespace
19
+ for these elements, and a distinct namespace for any grammar inheriting
20
+ these elements; we just want one namespace for any child grammars
21
+ of this.
22
+ -->
21
23
  <!--
22
24
  https://www.myintervals.com/blog/2009/05/20/iso-8601-date-validation-that-doesnt-suck/
23
25
  iso8601date = xsd:string { pattern = "([\+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24\:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d([\.,]\d+)?)?([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?" }
@@ -1241,6 +1243,11 @@ Refer to `BibliographicItem` for definitions</a:documentation>
1241
1243
  </define>
1242
1244
  <define name="formattedref">
1243
1245
  <element name="formattedref">
1246
+ <optional>
1247
+ <attribute name="format">
1248
+ <a:documentation>format of formatted reference; Metanorma assumes references are formatted as Metanorma XML</a:documentation>
1249
+ </attribute>
1250
+ </optional>
1244
1251
  <oneOrMore>
1245
1252
  <ref name="TextElement"/>
1246
1253
  </oneOrMore>
@@ -1812,6 +1819,11 @@ May be used to differentiate rendering of notes in bibliographies</a:documentati
1812
1819
  <a:documentation>Abstract of bibliographic item</a:documentation>
1813
1820
  <element name="abstract">
1814
1821
  <ref name="LocalizedStringAttributes"/>
1822
+ <optional>
1823
+ <attribute name="format">
1824
+ <a:documentation>What format the formatted abstract is in. In Metanorma, assumed to be Metanorma XML</a:documentation>
1825
+ </attribute>
1826
+ </optional>
1815
1827
  <choice>
1816
1828
  <oneOrMore>
1817
1829
  <ref name="BasicBlockNoId">
@@ -13,10 +13,8 @@ module Metanorma
13
13
  "ogc"
14
14
  end
15
15
 
16
- def validate(doc)
17
- content_validate(doc)
18
- schema_validate(formattedstr_strip(doc.dup),
19
- File.join(File.dirname(__FILE__), "plateau.rng"))
16
+ def schema_file
17
+ "plateau.rng"
20
18
  end
21
19
 
22
20
  def org_abbrev