metanorma-iso 3.4.8 → 3.4.9

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.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +9 -0
  3. data/lib/isodoc/iso/html/style-human.css +5 -0
  4. data/lib/isodoc/iso/html/style-iso.css +5 -0
  5. data/lib/isodoc/iso/iso.amendment.xsl +113 -66
  6. data/lib/isodoc/iso/iso.international-standard.xsl +113 -66
  7. data/lib/isodoc/iso/presentation_xml_convert.rb +16 -0
  8. data/lib/metanorma/iso/basicdoc.rng +1 -1
  9. data/lib/metanorma/iso/cleanup_biblio.rb +28 -24
  10. data/lib/metanorma/iso/front_id.rb +4 -0
  11. data/lib/metanorma/iso/{mathml3-content.rng → mathml4-content.rng} +104 -80
  12. data/lib/metanorma/iso/mathml4-core.rng +1041 -0
  13. data/lib/metanorma/iso/{mathml3-presentation.rng → mathml4-presentation.rng} +184 -1060
  14. data/lib/metanorma/iso/{mathml3-strict-content.rng → mathml4-strict-content.rng} +92 -8
  15. data/lib/metanorma/iso/mathml4.rng +30 -0
  16. data/lib/metanorma/iso/metanorma-mathml.rng +22 -8
  17. data/lib/metanorma/iso/processor.rb +32 -2
  18. data/lib/metanorma/iso/sts/transformer/back_transformer.rb +85 -0
  19. data/lib/metanorma/iso/sts/transformer/base.rb +118 -0
  20. data/lib/metanorma/iso/sts/transformer/block_dispatcher.rb +109 -0
  21. data/lib/metanorma/iso/sts/transformer/body_transformer.rb +39 -0
  22. data/lib/metanorma/iso/sts/transformer/content_text.rb +40 -0
  23. data/lib/metanorma/iso/sts/transformer/context.rb +64 -0
  24. data/lib/metanorma/iso/sts/transformer/def_list_transformer.rb +57 -0
  25. data/lib/metanorma/iso/sts/transformer/document_transformer.rb +30 -0
  26. data/lib/metanorma/iso/sts/transformer/example_transformer.rb +41 -0
  27. data/lib/metanorma/iso/sts/transformer/figure_transformer.rb +44 -0
  28. data/lib/metanorma/iso/sts/transformer/footnote_collector.rb +82 -0
  29. data/lib/metanorma/iso/sts/transformer/formula_transformer.rb +38 -0
  30. data/lib/metanorma/iso/sts/transformer/front_transformer.rb +56 -0
  31. data/lib/metanorma/iso/sts/transformer/id_generator.rb +181 -0
  32. data/lib/metanorma/iso/sts/transformer/inline_transformer.rb +293 -0
  33. data/lib/metanorma/iso/sts/transformer/iso_meta_transformer.rb +374 -0
  34. data/lib/metanorma/iso/sts/transformer/list_transformer.rb +65 -0
  35. data/lib/metanorma/iso/sts/transformer/nbsp_processor.rb +43 -0
  36. data/lib/metanorma/iso/sts/transformer/note_transformer.rb +43 -0
  37. data/lib/metanorma/iso/sts/transformer/paragraph_transformer.rb +28 -0
  38. data/lib/metanorma/iso/sts/transformer/quote_transformer.rb +17 -0
  39. data/lib/metanorma/iso/sts/transformer/reference_transformer.rb +136 -0
  40. data/lib/metanorma/iso/sts/transformer/section_transformer.rb +102 -0
  41. data/lib/metanorma/iso/sts/transformer/sourcecode_transformer.rb +18 -0
  42. data/lib/metanorma/iso/sts/transformer/standard.rb +33 -0
  43. data/lib/metanorma/iso/sts/transformer/table_transformer.rb +99 -0
  44. data/lib/metanorma/iso/sts/transformer/term_transformer.rb +227 -0
  45. data/lib/metanorma/iso/sts/transformer.rb +52 -0
  46. data/lib/metanorma/iso/sts.rb +38 -0
  47. data/lib/metanorma/iso/version.rb +1 -1
  48. data/lib/metanorma-iso.rb +1 -0
  49. data/metanorma-iso.gemspec +2 -0
  50. metadata +63 -7
  51. data/.hound.yml +0 -5
  52. data/lib/metanorma/iso/mathml3-common.rng +0 -257
  53. data/lib/metanorma/iso/mathml3.rng +0 -23
@@ -3835,7 +3835,7 @@
3835
3835
  <fo:block-container>
3836
3836
  <!-- List of Tables -->
3837
3837
  <xsl:call-template name="insertListOf_Title">
3838
- <xsl:with-param name="title" select="$title-list-tables"/>
3838
+ <xsl:with-param name="title" select="$toc_title_lists/mnx:doc[@num = $num]/mnx:title-list-tables"/>
3839
3839
  </xsl:call-template>
3840
3840
  <fo:block role="TOC">
3841
3841
  <xsl:for-each select="$contents/mnx:doc[@num = $num]//mnx:tables/mnx:table">
@@ -3849,7 +3849,7 @@
3849
3849
  <fo:block-container>
3850
3850
  <!-- List of Figures -->
3851
3851
  <xsl:call-template name="insertListOf_Title">
3852
- <xsl:with-param name="title" select="$title-list-figures"/>
3852
+ <xsl:with-param name="title" select="$toc_title_lists/mnx:doc[@num = $num]/mnx:title-list-figures"/>
3853
3853
  </xsl:call-template>
3854
3854
  <fo:block role="TOC">
3855
3855
  <xsl:for-each select="$contents/mnx:doc[@num = $num]//mnx:figures/mnx:figure">
@@ -3863,7 +3863,7 @@
3863
3863
  <fo:block-container>
3864
3864
  <!-- List of Examples -->
3865
3865
  <xsl:call-template name="insertListOf_Title">
3866
- <xsl:with-param name="title" select="$title-list-examples"/>
3866
+ <xsl:with-param name="title" select="$toc_title_lists/mnx:doc[@num = $num]/mnx:title-list-examples"/>
3867
3867
  </xsl:call-template>
3868
3868
  <fo:block role="TOC">
3869
3869
  <xsl:for-each select="$contents/mnx:doc[@num = $num]//mnx:examples/mnx:example">
@@ -3949,7 +3949,11 @@
3949
3949
  <xsl:call-template name="setAltText">
3950
3950
  <xsl:with-param name="value" select="@alt-text"/>
3951
3951
  </xsl:call-template>
3952
- <xsl:apply-templates select="." mode="contents"/>
3952
+ <xsl:variable name="item">
3953
+ <!-- mnx:table/mn:fmt-name, mnx:figure/mn:fmt-name, mnx:example/mn:fmt-name -->
3954
+ <xsl:apply-templates select="mn:fmt-name" mode="contents_item"/>
3955
+ </xsl:variable>
3956
+ <xsl:apply-templates select="xalan:nodeset($item)/node()"/>
3953
3957
  <fo:inline keep-together.within-line="always" role="SKIP">
3954
3958
  <fo:leader xsl:use-attribute-sets="toc-leader-style"/>
3955
3959
  <fo:inline role="SKIP"><fo:page-number-citation ref-id="{@id}" role="SKIP"/></fo:inline>
@@ -6465,45 +6469,59 @@
6465
6469
 
6466
6470
  <xsl:variable name="ace_tag">ace-tag_</xsl:variable>
6467
6471
 
6468
- <xsl:variable name="title-list-tables">
6469
- <xsl:variable name="toc_table_title" select="//mn:metanorma/mn:metanorma-extension/mn:toc[@type='table']/mn:title"/>
6470
- <xsl:value-of select="$toc_table_title"/>
6471
- <xsl:if test="normalize-space($toc_table_title) = ''">
6472
- <xsl:call-template name="getLocalizedString">
6473
- <xsl:with-param name="key">toc_tables</xsl:with-param>
6474
- </xsl:call-template>
6475
- </xsl:if>
6476
- </xsl:variable>
6472
+ <xsl:variable name="toc_title_lists_">
6473
+ <xsl:for-each select="//mn:metanorma">
6474
+ <xsl:variable name="num"><xsl:number level="any" count="mn:metanorma"/></xsl:variable>
6475
+ <xsl:variable name="docid"><xsl:call-template name="getDocumentId"/></xsl:variable>
6476
+ <xsl:variable name="current_document">
6477
+ <xsl:copy-of select="."/>
6478
+ </xsl:variable>
6479
+ <xsl:for-each select="xalan:nodeset($current_document)">
6480
+ <mnx:doc id="{$docid}" num="{$num}">
6481
+ <mnx:title-list-tables>
6482
+ <xsl:variable name="toc_table_title" select="/mn:metanorma/mn:metanorma-extension/mn:presentation-metadata/mn:toc[@type='table']/mn:title"/>
6483
+ <xsl:value-of select="$toc_table_title"/>
6484
+ <xsl:if test="normalize-space($toc_table_title) = ''">
6485
+ <xsl:call-template name="getLocalizedString">
6486
+ <xsl:with-param name="key">toc_tables</xsl:with-param>
6487
+ </xsl:call-template>
6488
+ </xsl:if>
6489
+ </mnx:title-list-tables>
6477
6490
 
6478
- <xsl:variable name="title-list-figures">
6479
- <xsl:variable name="toc_figure_title" select="//mn:metanorma/mn:metanorma-extension/mn:toc[@type='figure']/mn:title"/>
6480
- <xsl:value-of select="$toc_figure_title"/>
6481
- <xsl:if test="normalize-space($toc_figure_title) = ''">
6482
- <xsl:call-template name="getLocalizedString">
6483
- <xsl:with-param name="key">toc_figures</xsl:with-param>
6484
- </xsl:call-template>
6485
- </xsl:if>
6486
- </xsl:variable>
6491
+ <mnx:title-list-figures>
6492
+ <xsl:variable name="toc_figure_title" select="/mn:metanorma/mn:metanorma-extension/mn:presentation-metadata/mn:toc[@type='figure']/mn:title"/>
6493
+ <xsl:value-of select="$toc_figure_title"/>
6494
+ <xsl:if test="normalize-space($toc_figure_title) = ''">
6495
+ <xsl:call-template name="getLocalizedString">
6496
+ <xsl:with-param name="key">toc_figures</xsl:with-param>
6497
+ </xsl:call-template>
6498
+ </xsl:if>
6499
+ </mnx:title-list-figures>
6487
6500
 
6488
- <xsl:variable name="title-list-examples">
6489
- <xsl:variable name="toc_example_title" select="//mn:metanorma/mn:metanorma-extension/mn:toc[@type='example']/mn:title"/>
6490
- <xsl:value-of select="$toc_example_title"/>
6491
- <xsl:if test="normalize-space($toc_example_title) = ''">
6492
- <xsl:call-template name="getLocalizedString">
6493
- <xsl:with-param name="key">toc_examples</xsl:with-param>
6494
- </xsl:call-template>
6495
- </xsl:if>
6496
- </xsl:variable>
6501
+ <mnx:title-list-examples>
6502
+ <xsl:variable name="toc_example_title" select="/mn:metanorma/mn:metanorma-extension/mn:presentation-metadata/mn:toc[@type='example']/mn:title"/>
6503
+ <xsl:value-of select="$toc_example_title"/>
6504
+ <xsl:if test="normalize-space($toc_example_title) = ''">
6505
+ <xsl:call-template name="getLocalizedString">
6506
+ <xsl:with-param name="key">toc_examples</xsl:with-param>
6507
+ </xsl:call-template>
6508
+ </xsl:if>
6509
+ </mnx:title-list-examples>
6497
6510
 
6498
- <xsl:variable name="title-list-recommendations">
6499
- <xsl:variable name="toc_requirement_title" select="//mn:metanorma/mn:metanorma-extension/mn:toc[@type='requirement']/mn:title"/>
6500
- <xsl:value-of select="$toc_requirement_title"/>
6501
- <xsl:if test="normalize-space($toc_requirement_title) = ''">
6502
- <xsl:call-template name="getLocalizedString">
6503
- <xsl:with-param name="key">toc_recommendations</xsl:with-param>
6504
- </xsl:call-template>
6505
- </xsl:if>
6511
+ <mnx:title-list-recommendations>
6512
+ <xsl:variable name="toc_requirement_title" select="/mn:metanorma/mn:metanorma-extension/mn:presentation-metadata/mn:toc[@type='requirement']/mn:title"/>
6513
+ <xsl:value-of select="$toc_requirement_title"/>
6514
+ <xsl:if test="normalize-space($toc_requirement_title) = ''">
6515
+ <xsl:call-template name="getLocalizedString">
6516
+ <xsl:with-param name="key">toc_recommendations</xsl:with-param>
6517
+ </xsl:call-template>
6518
+ </xsl:if>
6519
+ </mnx:title-list-recommendations>
6520
+ </mnx:doc>
6521
+ </xsl:for-each>
6522
+ </xsl:for-each>
6506
6523
  </xsl:variable>
6524
+ <xsl:variable name="toc_title_lists" select="xalan:nodeset($toc_title_lists_)"/>
6507
6525
 
6508
6526
  <xsl:variable name="bibdata">
6509
6527
  <xsl:copy-of select="//mn:metanorma/mn:bibdata"/>
@@ -7313,7 +7331,7 @@
7313
7331
  <xsl:apply-templates mode="update_xml_step1"/>
7314
7332
  </xsl:template>
7315
7333
 
7316
- <xsl:template match="mn:semx" mode="update_xml_step1">
7334
+ <xsl:template match="mn:semx[not(@element = 'name')]" mode="update_xml_step1">
7317
7335
  <xsl:apply-templates mode="update_xml_step1"/>
7318
7336
  </xsl:template>
7319
7337
 
@@ -7699,7 +7717,7 @@
7699
7717
  <xsl:variable name="non_white_space">[^\s\u3000-\u9FFF]</xsl:variable>
7700
7718
  <xsl:variable name="regex_dots_units">((\b((<xsl:value-of select="$non_white_space"/>{1,3}\.<xsl:value-of select="$non_white_space"/>+)|(<xsl:value-of select="$non_white_space"/>+\.<xsl:value-of select="$non_white_space"/>{1,3}))\b)|(\.<xsl:value-of select="$non_white_space"/>{1,3})\b)</xsl:variable>
7701
7719
 
7702
- <xsl:template match="text()[not(ancestor::mn:bibdata or ancestor::mn:fmt-link[not(contains(normalize-space(),' '))] or ancestor::mn:sourcecode or (ancestor::mn:tt and ancestor::mn:table and string-length() &gt; 20) or ancestor::*[local-name() = 'math'] or ancestor::*[local-name() = 'svg'] or ancestor::mn:name or ancestor::mn:fmt-name or starts-with(., 'http://') or starts-with(., 'https://') or starts-with(., 'www.') or normalize-space() = '' )]" name="keep_together_standard_number" mode="update_xml_enclose_keep-together_within-line">
7720
+ <xsl:template match="text()[not( (ancestor::mn:bibdata and not(ancestor::mn:title)) or ancestor::mn:fmt-link[not(contains(normalize-space(),' '))] or ancestor::mn:sourcecode or (ancestor::mn:tt and ancestor::mn:table and string-length() &gt; 20) or ancestor::*[local-name() = 'math'] or ancestor::*[local-name() = 'svg'] or ancestor::mn:name or (ancestor::mn:fmt-name and not(ancestor::mn:semx[@element = 'name'])) or starts-with(., 'http://') or starts-with(., 'https://') or starts-with(., 'www.') or normalize-space() = '' )]" name="keep_together_standard_number" mode="update_xml_enclose_keep-together_within-line">
7703
7721
 
7704
7722
  <xsl:variable name="parent" select="local-name(..)"/>
7705
7723
 
@@ -7745,7 +7763,7 @@
7745
7763
  <xsl:variable name="text">
7746
7764
  <xsl:element name="text" namespace="{$namespace_full}">
7747
7765
  <xsl:choose>
7748
- <xsl:when test="ancestor::mn:table"><xsl:value-of select="."/></xsl:when> <!-- no need enclose standard's number into tag 'keep-together_within-line' in table cells -->
7766
+ <xsl:when test="ancestor::mn:table and not(ancestor::mn:fmt-name)"><xsl:value-of select="."/></xsl:when> <!-- no need enclose standard's number into tag 'keep-together_within-line' in table cells -->
7749
7767
  <xsl:otherwise>
7750
7768
  <xsl:variable name="text_" select="java:replaceAll(java:java.lang.String.new(.), $regex_standard_reference, concat($tag_keep-together_within-line_open,'$1',$tag_keep-together_within-line_close))"/>
7751
7769
  <!-- <xsl:value-of select="$text__"/> -->
@@ -7840,6 +7858,10 @@
7840
7858
  <xsl:copy-of select="."/>
7841
7859
  </xsl:template>
7842
7860
 
7861
+ <xsl:template match="mn:semx" mode="update_xml_enclose_keep-together_within-line">
7862
+ <xsl:apply-templates mode="update_xml_enclose_keep-together_within-line"/>
7863
+ </xsl:template>
7864
+
7843
7865
  <xsl:template name="replace_text_tags">
7844
7866
  <xsl:param name="tag_open"/>
7845
7867
  <xsl:param name="tag_close"/>
@@ -15547,6 +15569,7 @@
15547
15569
  <xsl:variable name="svg_content">
15548
15570
  <xsl:apply-templates select="." mode="svg_update"/>
15549
15571
  </xsl:variable>
15572
+ <!-- <svg_content><xsl:copy-of select="$svg_content"/></svg_content> -->
15550
15573
 
15551
15574
  <xsl:variable name="alt-text">
15552
15575
  <xsl:choose>
@@ -15761,7 +15784,7 @@
15761
15784
  </xsl:copy>
15762
15785
  </xsl:template>
15763
15786
 
15764
- <xsl:template match="mn:image/@href" mode="svg_update">
15787
+ <xsl:template match="*[local-name() = 'image']/@href" mode="svg_update">
15765
15788
  <xsl:attribute name="href" namespace="http://www.w3.org/1999/xlink">
15766
15789
  <xsl:value-of select="."/>
15767
15790
  </xsl:attribute>
@@ -18520,13 +18543,13 @@
18520
18543
 
18521
18544
  <xsl:template name="processTablesFigures_Contents">
18522
18545
  <xsl:param name="always"/>
18523
- <xsl:if test="(//mn:metanorma/mn:metanorma-extension/mn:toc[@type='table']/mn:title) or normalize-space($always) = 'true'">
18546
+ <xsl:if test="(//mn:metanorma/mn:metanorma-extension/mn:presentation-metadata/mn:toc[@type='table']/mn:title) or normalize-space($always) = 'true'">
18524
18547
  <xsl:call-template name="processTables_Contents"/>
18525
18548
  </xsl:if>
18526
- <xsl:if test="(//mn:metanorma/mn:metanorma-extension/mn:toc[@type='figure']/mn:title) or normalize-space($always) = 'true'">
18549
+ <xsl:if test="(//mn:metanorma/mn:metanorma-extension/mn:presentation-metadata/mn:toc[@type='figure']/mn:title) or normalize-space($always) = 'true'">
18527
18550
  <xsl:call-template name="processFigures_Contents"/>
18528
18551
  </xsl:if>
18529
- <xsl:if test="(//mn:metanorma/mn:metanorma-extension/mn:toc[@type='example']/mn:title)">
18552
+ <xsl:if test="(//mn:metanorma/mn:metanorma-extension/mn:presentation-metadata/mn:toc[@type='example']/mn:title)">
18530
18553
  <xsl:call-template name="processExamples_Contents"/>
18531
18554
  </xsl:if>
18532
18555
  </xsl:template>
@@ -18577,22 +18600,22 @@
18577
18600
 
18578
18601
  <xsl:template name="processExamples_Contents">
18579
18602
  <mnx:examples>
18580
- <xsl:for-each select="//mn:example[@id and mn:fmt-name and not(@unnumbered = 'true') and normalize-space(@id) != '']">
18581
- <xsl:choose>
18582
- <xsl:when test="mn:fmt-name">
18583
- <xsl:variable name="fmt_name">
18584
- <xsl:apply-templates select="mn:fmt-name" mode="update_xml_step1"/>
18585
- </xsl:variable>
18586
- <mnx:example id="{@id}" alt-text="{normalize-space($fmt_name)}">
18587
- <xsl:copy-of select="$fmt_name"/>
18588
- </mnx:example>
18589
- </xsl:when>
18590
- <xsl:otherwise>
18591
- <mnx:example id="{@id}" alt-text="{mn:name}">
18592
- <xsl:copy-of select="mn:name"/>
18593
- </mnx:example>
18594
- </xsl:otherwise>
18595
- </xsl:choose>
18603
+ <xsl:for-each select="//mn:example[@id and mn:fmt-name and normalize-space(@id) != '']">
18604
+ <!-- https://github.com/metanorma/metanorma-pdfa/issues/32#issuecomment-4929133938:
18605
+ //example/fmt-xref-label[@container] + //example/fmt-name/span[@class = 'fmt-caption-delim'] + //example/name,
18606
+ with the last two elements dropped if //example/name does not exist. -->
18607
+ <xsl:variable name="example_name">
18608
+ <xsl:apply-templates select="mn:name/node()" mode="update_xml_step1"/>
18609
+ </xsl:variable>
18610
+ <mnx:example id="{@id}" alt-text="{normalize-space($example_name)}">
18611
+ <xsl:element name="fmt-name" namespace="{$namespace_full}">
18612
+ <xsl:value-of select="mn:fmt-xref-label[@container]"/>
18613
+ <xsl:if test="normalize-space($example_name) != ''">
18614
+ <xsl:value-of select="mn:fmt-name/mn:span[@class = 'fmt-caption-delim']"/>
18615
+ <xsl:copy-of select="$example_name"/>
18616
+ </xsl:if>
18617
+ </xsl:element>
18618
+ </mnx:example>
18596
18619
  </xsl:for-each>
18597
18620
  </mnx:examples>
18598
18621
  </xsl:template>
@@ -18865,15 +18888,18 @@
18865
18888
 
18866
18889
  <xsl:call-template name="insertFigureBookmarks">
18867
18890
  <xsl:with-param name="contents" select="mnx:contents"/>
18891
+ <xsl:with-param name="num" select="@num"/>
18868
18892
  </xsl:call-template>
18869
18893
 
18870
18894
  <xsl:call-template name="insertTableBookmarks">
18871
18895
  <xsl:with-param name="contents" select="mnx:contents"/>
18896
+ <xsl:with-param name="num" select="@num"/>
18872
18897
  <xsl:with-param name="lang" select="@lang"/>
18873
18898
  </xsl:call-template>
18874
18899
 
18875
18900
  <xsl:call-template name="insertExampleBookmarks">
18876
18901
  <xsl:with-param name="contents" select="mnx:contents"/>
18902
+ <xsl:with-param name="num" select="@num"/>
18877
18903
  <xsl:with-param name="lang" select="@lang"/>
18878
18904
  </xsl:call-template>
18879
18905
 
@@ -18888,15 +18914,18 @@
18888
18914
 
18889
18915
  <xsl:call-template name="insertFigureBookmarks">
18890
18916
  <xsl:with-param name="contents" select="mnx:contents"/>
18917
+ <xsl:with-param name="num" select="@num"/>
18891
18918
  </xsl:call-template>
18892
18919
 
18893
18920
  <xsl:call-template name="insertTableBookmarks">
18894
18921
  <xsl:with-param name="contents" select="mnx:contents"/>
18922
+ <xsl:with-param name="num" select="@num"/>
18895
18923
  <xsl:with-param name="lang" select="@lang"/>
18896
18924
  </xsl:call-template>
18897
18925
 
18898
18926
  <xsl:call-template name="insertExampleBookmarks">
18899
18927
  <xsl:with-param name="contents" select="mnx:contents"/>
18928
+ <xsl:with-param name="num" select="@num"/>
18900
18929
  <xsl:with-param name="lang" select="@lang"/>
18901
18930
  </xsl:call-template>
18902
18931
 
@@ -18909,15 +18938,18 @@
18909
18938
 
18910
18939
  <xsl:call-template name="insertFigureBookmarks">
18911
18940
  <xsl:with-param name="contents" select="$contents_nodes/mnx:contents"/>
18941
+ <xsl:with-param name="num" select="@num"/>
18912
18942
  </xsl:call-template>
18913
18943
 
18914
18944
  <xsl:call-template name="insertTableBookmarks">
18915
18945
  <xsl:with-param name="contents" select="$contents_nodes/mnx:contents"/>
18946
+ <xsl:with-param name="num" select="@num"/>
18916
18947
  <xsl:with-param name="lang" select="@lang"/>
18917
18948
  </xsl:call-template>
18918
18949
 
18919
18950
  <xsl:call-template name="insertExampleBookmarks">
18920
18951
  <xsl:with-param name="contents" select="$contents_nodes/mnx:contents"/>
18952
+ <xsl:with-param name="num" select="@num"/>
18921
18953
  <xsl:with-param name="lang" select="@lang"/>
18922
18954
  </xsl:call-template>
18923
18955
 
@@ -18933,6 +18965,7 @@
18933
18965
 
18934
18966
  <xsl:template name="insertFigureBookmarks">
18935
18967
  <xsl:param name="contents"/>
18968
+ <xsl:param name="num"/>
18936
18969
  <xsl:variable name="contents_nodes" select="xalan:nodeset($contents)"/>
18937
18970
  <xsl:if test="$contents_nodes/mnx:figure">
18938
18971
  <fo:bookmark internal-destination="{$contents_nodes/mnx:figure[1]/@id}" starting-state="hide">
@@ -18950,7 +18983,7 @@
18950
18983
  <fo:bookmark internal-destination="empty_bookmark" starting-state="hide">
18951
18984
 
18952
18985
  <xsl:variable name="bookmark-title">
18953
- <xsl:value-of select="$title-list-figures"/>
18986
+ <xsl:value-of select="$toc_title_lists/mnx:doc[@num = $num]/mnx:title-list-figures"/>
18954
18987
  </xsl:variable>
18955
18988
  <fo:bookmark-title><xsl:value-of select="normalize-space($bookmark-title)"/></fo:bookmark-title>
18956
18989
  <xsl:for-each select="$contents_nodes//mnx:figures/mnx:figure">
@@ -18964,6 +18997,7 @@
18964
18997
 
18965
18998
  <xsl:template name="insertTableBookmarks">
18966
18999
  <xsl:param name="contents"/>
19000
+ <xsl:param name="num"/>
18967
19001
  <xsl:param name="lang"/>
18968
19002
  <xsl:variable name="contents_nodes" select="xalan:nodeset($contents)"/>
18969
19003
  <xsl:if test="$contents_nodes/mnx:table">
@@ -18987,7 +19021,7 @@
18987
19021
  <fo:bookmark internal-destination="empty_bookmark" starting-state="hide">
18988
19022
 
18989
19023
  <xsl:variable name="bookmark-title">
18990
- <xsl:value-of select="$title-list-tables"/>
19024
+ <xsl:value-of select="$toc_title_lists/mnx:doc[@num = $num]/mnx:title-list-tables"/>
18991
19025
  </xsl:variable>
18992
19026
 
18993
19027
  <fo:bookmark-title><xsl:value-of select="$bookmark-title"/></fo:bookmark-title>
@@ -19002,8 +19036,9 @@
19002
19036
  </xsl:if>
19003
19037
  </xsl:template> <!-- insertTableBookmarks -->
19004
19038
 
19005
- <xsl:template name="insertExampleBookmarks">
19039
+ <xsl:template name="insertExampleBookmarks">
19006
19040
  <xsl:param name="contents"/>
19041
+ <xsl:param name="num"/>
19007
19042
  <xsl:param name="lang"/>
19008
19043
  <xsl:variable name="contents_nodes" select="xalan:nodeset($contents)"/>
19009
19044
  <xsl:if test="$contents_nodes/mnx:example">
@@ -19027,7 +19062,7 @@
19027
19062
  <fo:bookmark internal-destination="empty_bookmark" starting-state="hide">
19028
19063
 
19029
19064
  <xsl:variable name="bookmark-title">
19030
- <xsl:value-of select="$title-list-examples"/>
19065
+ <xsl:value-of select="$toc_title_lists/mnx:doc[@num = $num]/mnx:title-list-examples"/>
19031
19066
  </xsl:variable>
19032
19067
 
19033
19068
  <fo:bookmark-title><xsl:value-of select="$bookmark-title"/></fo:bookmark-title>
@@ -19188,6 +19223,18 @@
19188
19223
  </xsl:copy>
19189
19224
  </xsl:template>
19190
19225
 
19226
+ <xsl:template match="mn:tt" mode="contents_item">
19227
+ <xsl:copy>
19228
+ <xsl:apply-templates mode="contents_item"/>
19229
+ </xsl:copy>
19230
+ </xsl:template>
19231
+
19232
+ <xsl:template match="*[local-name() = 'keep-together_within-line']" mode="contents_item">
19233
+ <xsl:copy>
19234
+ <xsl:apply-templates mode="contents_item"/>
19235
+ </xsl:copy>
19236
+ </xsl:template>
19237
+
19191
19238
  <xsl:template match="mn:stem" mode="contents_item"/>
19192
19239
  <xsl:template match="mn:fmt-stem" mode="contents_item">
19193
19240
  <xsl:copy-of select="."/>
@@ -257,6 +257,22 @@ module IsoDoc
257
257
  XML
258
258
  end
259
259
 
260
+ # ISO House Style: a status footnote (withdrawn/replaced, "available
261
+ # from", etc.) on a bibliography reference belongs on the document
262
+ # designation, not on the [n] ordinal. Place the footnote(s) after the
263
+ # SDO identifier rather than after the ordinal; non-standard references
264
+ # (no designation) are left as the base renders them.
265
+ # https://github.com/metanorma/iso-10303/issues/717
266
+ def biblio_ref_entry_code(ordinal, ids, _standard, datefn, _bib)
267
+ ret = esc(ids[:ordinal]) || esc(ids[:content]) || esc(ids[:metanorma]) ||
268
+ "[#{esc ordinal.to_s}]"
269
+ if ids[:sdo] && !ids[:sdo].empty?
270
+ "#{prefix_bracketed_ref(ret)}#{esc ids[:sdo]}#{datefn}, "
271
+ else
272
+ prefix_bracketed_ref("#{ret}#{datefn}")
273
+ end
274
+ end
275
+
260
276
  include Init
261
277
  end
262
278
  end
@@ -1931,7 +1931,7 @@ or as the string "auto"</a:documentation>
1931
1931
  </element>
1932
1932
  </define>
1933
1933
  <define name="mathml">
1934
- <a:documentation>Encoding of MathML: the official W3C MathML 3.0 grammar (namespace
1934
+ <a:documentation>Encoding of MathML: the official W3C MathML 4 grammar (namespace
1935
1935
  http://www.w3.org/1998/Math/MathML), via the metanorma wrapper in
1936
1936
  grammars/mathml/. See grammars/mathml/README.adoc and basicdoc-models#35.</a:documentation>
1937
1937
  <externalRef href="metanorma-mathml.rng"/>
@@ -34,29 +34,28 @@ module Metanorma
34
34
  ISO_NAME = "International Organization for Standardization".freeze
35
35
  IEC_NAME = "International Electrotechnical Commission".freeze
36
36
 
37
+ # Default publisher sort order for ISO documents: ISO first, IEC second,
38
+ # then other standards, then everything else. A metanorma-taste config or
39
+ # a per-document :sort-biblio-<abbrev>: attribute overrides this via the
40
+ # shared Standoc::Ref helpers (e.g. OIML ranks OIML ahead of ISO/IEC).
41
+ DEFAULT_PUBLISHER_SORT = [
42
+ { abbrev: "ISO", name: ISO_NAME, rank: 1 },
43
+ { abbrev: "IEC", name: IEC_NAME, rank: 2 },
44
+ ].freeze
45
+
37
46
  def pub_class(bib)
38
- bib.at("#{PUBLISHER}[abbreviation = 'ISO']") ||
39
- bib.at("#{PUBLISHER}[name = '#{ISO_NAME}']") and return 1
40
- bib.at("#{PUBLISHER}[abbreviation = 'IEC']") ||
41
- bib.at("#{PUBLISHER}[name = '#{IEC_NAME}']") and return 2
42
- bib.at("./docidentifier[@type]" \
43
- "[not(#{@conv.skip_docid} or @type = 'metanorma')]") ||
44
- bib.at("./docidentifier[not(@type)]") and return 3
45
- 4
46
- end
47
-
48
- def second_pub_class(bib, first_pub)
49
- case first_pub
50
- when 1
51
- n = bib.at("#{PUBLISHER}[not(abbreviation = 'ISO')]" \
52
- "[not(name = '#{ISO_NAME}')]")
53
- n&.at("./abbreviation") || n&.at("./name") || ""
54
- when 2
55
- n = bib.at("#{PUBLISHER}[not(abbreviation = 'IEC')]" \
56
- "[not(name = '#{IEC_NAME}')]")
57
- n&.at("./abbreviation") || n&.at("./name") || ""
58
- else ""
59
- end
47
+ publisher_sort_rank(bib, DEFAULT_PUBLISHER_SORT)
48
+ end
49
+
50
+ def second_pub_class(bib, _first_pub = nil)
51
+ publisher_sort_second(bib, DEFAULT_PUBLISHER_SORT)
52
+ end
53
+
54
+ # ISO also ranks a reference with only an untyped docidentifier as a
55
+ # standards reference (historical pub_class behaviour), widening the base
56
+ # typed-only definition.
57
+ def biblio_standards_ref?(bib)
58
+ super || !!bib.at("./docidentifier[not(@type)]")
60
59
  end
61
60
 
62
61
  def sort_biblio(bib)
@@ -145,8 +144,13 @@ module Metanorma
145
144
  end
146
145
 
147
146
  def parse_draft_docid(docid, bibitem)
148
- publisher = pub_class(bibitem)
149
- base_pubid = publisher == 1 ? Pubid::Iso::Identifier : Pubid::Iec::Identifier
147
+ # Semantic ISO-vs-IEC identity, NOT the sort rank: pub_class is now
148
+ # configurable (a taste may rerank ISO below OIML), so draft docid
149
+ # parsing must use the publisher identity predicate directly.
150
+ base_pubid = if PublisherIdentity.iso_publisher?(bibitem)
151
+ Pubid::Iso::Identifier
152
+ else Pubid::Iec::Identifier
153
+ end
150
154
  [base_pubid, base_pubid.parse(docid.text).to_h]
151
155
  end
152
156
 
@@ -169,6 +169,10 @@ module Metanorma
169
169
  iso_id_out_non_amd(xml, params, with_prf)
170
170
  rescue StandardError, *STAGE_ERROR => e
171
171
  @log.add("ISO_52", "Document identifier: #{e}")
172
+ # a taste layered on this flavour (:docstage-valid:) manages its
173
+ # own stage repertoire and docidentifier template: do not abort
174
+ # when pubid cannot parse a taste-supplied stage
175
+ @docstage_valid and return
172
176
  clean_abort("Document identifier: #{e}", xml)
173
177
  end
174
178