metanorma-ogc 1.4.1 → 1.4.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/lib/asciidoctor/ogc/basicdoc.rng +21 -4
  3. data/lib/asciidoctor/ogc/cleanup.rb +173 -0
  4. data/lib/asciidoctor/ogc/converter.rb +19 -76
  5. data/lib/asciidoctor/ogc/isodoc.rng +218 -52
  6. data/lib/asciidoctor/ogc/reqt.rng +23 -2
  7. data/lib/asciidoctor/ogc/validate.rb +35 -20
  8. data/lib/isodoc/ogc/base_convert.rb +47 -10
  9. data/lib/isodoc/ogc/html/htmlstyle.css +10 -0
  10. data/lib/isodoc/ogc/html/htmlstyle.scss +12 -0
  11. data/lib/isodoc/ogc/html/ogc.css +4 -0
  12. data/lib/isodoc/ogc/html/ogc.scss +4 -0
  13. data/lib/isodoc/ogc/html/wordstyle.css +12 -1
  14. data/lib/isodoc/ogc/html/wordstyle.scss +12 -1
  15. data/lib/isodoc/ogc/html/wordstyle_wp.css +12 -1
  16. data/lib/isodoc/ogc/html/wordstyle_wp.scss +12 -1
  17. data/lib/isodoc/ogc/i18n-en.yaml +10 -8
  18. data/lib/isodoc/ogc/ogc.abstract-specification-topic.xsl +268 -33
  19. data/lib/isodoc/ogc/ogc.best-practice.xsl +268 -33
  20. data/lib/isodoc/ogc/ogc.change-request-supporting-document.xsl +268 -33
  21. data/lib/isodoc/ogc/ogc.community-practice.xsl +268 -33
  22. data/lib/isodoc/ogc/ogc.community-standard.xsl +268 -33
  23. data/lib/isodoc/ogc/ogc.discussion-paper.xsl +268 -33
  24. data/lib/isodoc/ogc/ogc.engineering-report.xsl +268 -33
  25. data/lib/isodoc/ogc/ogc.other.xsl +268 -33
  26. data/lib/isodoc/ogc/ogc.policy.xsl +268 -33
  27. data/lib/isodoc/ogc/ogc.reference-model.xsl +268 -33
  28. data/lib/isodoc/ogc/ogc.release-notes.xsl +268 -33
  29. data/lib/isodoc/ogc/ogc.standard.xsl +268 -33
  30. data/lib/isodoc/ogc/ogc.test-suite.xsl +268 -33
  31. data/lib/isodoc/ogc/ogc.user-guide.xsl +268 -33
  32. data/lib/isodoc/ogc/ogc.white-paper.xsl +167 -10
  33. data/lib/isodoc/ogc/presentation_xml_convert.rb +6 -3
  34. data/lib/isodoc/ogc/reqt.rb +49 -36
  35. data/lib/isodoc/ogc/xref.rb +1 -2
  36. data/lib/metanorma/ogc/version.rb +1 -1
  37. metadata +3 -2
@@ -1357,6 +1357,11 @@
1357
1357
 
1358
1358
 
1359
1359
 
1360
+ </xsl:attribute-set><xsl:attribute-set name="table-note-name-style">
1361
+
1362
+
1363
+
1364
+
1360
1365
  </xsl:attribute-set><xsl:attribute-set name="note-p-style">
1361
1366
 
1362
1367
 
@@ -1537,13 +1542,20 @@
1537
1542
 
1538
1543
  </xsl:attribute-set><xsl:attribute-set name="list-style">
1539
1544
 
1540
- </xsl:attribute-set><xsl:variable name="border-block-added">2.5pt solid rgb(0, 176, 80)</xsl:variable><xsl:variable name="border-block-deleted">2.5pt solid rgb(255, 0, 0)</xsl:variable><xsl:template name="processPrefaceSectionsDefault_Contents">
1545
+ </xsl:attribute-set><xsl:attribute-set name="toc-style">
1546
+ <xsl:attribute name="line-height">135%</xsl:attribute>
1547
+ </xsl:attribute-set><xsl:variable name="border-block-added">2.5pt solid rgb(0, 176, 80)</xsl:variable><xsl:variable name="border-block-deleted">2.5pt solid rgb(255, 0, 0)</xsl:variable><xsl:template name="OLD_processPrefaceSectionsDefault_Contents">
1541
1548
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
1542
1549
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
1543
1550
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
1544
1551
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name() != 'abstract' and local-name() != 'foreword' and local-name() != 'introduction' and local-name() != 'acknowledgements']" mode="contents"/>
1545
1552
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='acknowledgements']" mode="contents"/>
1546
- </xsl:template><xsl:template name="processMainSectionsDefault_Contents">
1553
+ </xsl:template><xsl:template name="processPrefaceSectionsDefault_Contents">
1554
+ <xsl:for-each select="/*/*[local-name()='preface']/*">
1555
+ <xsl:sort select="@displayorder" data-type="number"/>
1556
+ <xsl:apply-templates select="." mode="contents"/>
1557
+ </xsl:for-each>
1558
+ </xsl:template><xsl:template name="OLD_processMainSectionsDefault_Contents">
1547
1559
  <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='clause'][@type='scope']" mode="contents"/>
1548
1560
 
1549
1561
  <!-- Normative references -->
@@ -1556,13 +1568,33 @@
1556
1568
  <!-- Bibliography -->
1557
1569
  <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]" mode="contents"/>
1558
1570
 
1559
- </xsl:template><xsl:template name="processPrefaceSectionsDefault">
1571
+ </xsl:template><xsl:template name="processMainSectionsDefault_Contents">
1572
+ <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
1573
+ <xsl:sort select="@displayorder" data-type="number"/>
1574
+ <xsl:apply-templates select="." mode="contents"/>
1575
+ </xsl:for-each>
1576
+
1577
+ <xsl:for-each select="/*/*[local-name()='annex']">
1578
+ <xsl:sort select="@displayorder" data-type="number"/>
1579
+ <xsl:apply-templates select="." mode="contents"/>
1580
+ </xsl:for-each>
1581
+
1582
+ <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
1583
+ <xsl:sort select="@displayorder" data-type="number"/>
1584
+ <xsl:apply-templates select="." mode="contents"/>
1585
+ </xsl:for-each>
1586
+ </xsl:template><xsl:template name="OLD_processPrefaceSectionsDefault">
1560
1587
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']"/>
1561
1588
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']"/>
1562
1589
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']"/>
1563
1590
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name() != 'abstract' and local-name() != 'foreword' and local-name() != 'introduction' and local-name() != 'acknowledgements']"/>
1564
1591
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='acknowledgements']"/>
1565
- </xsl:template><xsl:template name="processMainSectionsDefault">
1592
+ </xsl:template><xsl:template name="processPrefaceSectionsDefault">
1593
+ <xsl:for-each select="/*/*[local-name()='preface']/*">
1594
+ <xsl:sort select="@displayorder" data-type="number"/>
1595
+ <xsl:apply-templates select="."/>
1596
+ </xsl:for-each>
1597
+ </xsl:template><xsl:template name="OLD_processMainSectionsDefault">
1566
1598
  <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='clause'][@type='scope']"/>
1567
1599
 
1568
1600
  <!-- Normative references -->
@@ -1574,6 +1606,22 @@
1574
1606
  <xsl:apply-templates select="/*/*[local-name()='annex']"/>
1575
1607
  <!-- Bibliography -->
1576
1608
  <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][not(@normative='true')]"/>
1609
+ </xsl:template><xsl:template name="processMainSectionsDefault">
1610
+ <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
1611
+ <xsl:sort select="@displayorder" data-type="number"/>
1612
+ <xsl:apply-templates select="."/>
1613
+
1614
+ </xsl:for-each>
1615
+
1616
+ <xsl:for-each select="/*/*[local-name()='annex']">
1617
+ <xsl:sort select="@displayorder" data-type="number"/>
1618
+ <xsl:apply-templates select="."/>
1619
+ </xsl:for-each>
1620
+
1621
+ <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
1622
+ <xsl:sort select="@displayorder" data-type="number"/>
1623
+ <xsl:apply-templates select="."/>
1624
+ </xsl:for-each>
1577
1625
  </xsl:template><xsl:template match="text()">
1578
1626
  <xsl:value-of select="."/>
1579
1627
  </xsl:template><xsl:template match="*[local-name()='br']">
@@ -2429,9 +2477,8 @@
2429
2477
 
2430
2478
  <!-- Table's note name (NOTE, for example) -->
2431
2479
 
2432
- <fo:inline padding-right="2mm">
2480
+ <fo:inline padding-right="2mm" xsl:use-attribute-sets="table-note-name-style">
2433
2481
 
2434
-
2435
2482
 
2436
2483
 
2437
2484
 
@@ -3060,6 +3107,8 @@
3060
3107
  <xsl:if test="$font-size != ''">
3061
3108
  <xsl:attribute name="font-size">
3062
3109
  <xsl:choose>
3110
+ <xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
3111
+ <xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
3063
3112
  <xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
3064
3113
  <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
3065
3114
  </xsl:choose>
@@ -4112,6 +4161,13 @@
4112
4161
  </xsl:attribute>
4113
4162
  <xsl:apply-templates mode="svg_update"/>
4114
4163
  </xsl:copy>
4164
+ </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][*[local-name() = 'svg']]" priority="3">
4165
+ <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
4166
+ <xsl:for-each select="*[local-name() = 'svg']">
4167
+ <xsl:call-template name="image_svg">
4168
+ <xsl:with-param name="name" select="$name"/>
4169
+ </xsl:call-template>
4170
+ </xsl:for-each>
4115
4171
  </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
4116
4172
  <xsl:variable name="svg_content" select="document(@src)"/>
4117
4173
  <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
@@ -4216,7 +4272,7 @@
4216
4272
  </fo:basic-link>
4217
4273
  </fo:block>
4218
4274
  </fo:block-container>
4219
- </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'table']/*[local-name() = 'name'] | *[local-name() = 'permission']/*[local-name() = 'name'] | *[local-name() = 'recommendation']/*[local-name() = 'name'] | *[local-name() = 'requirement']/*[local-name() = 'name']" mode="contents">
4275
+ </xsl:template><xsl:template match="*[local-name() = 'emf']"/><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'table']/*[local-name() = 'name'] | *[local-name() = 'permission']/*[local-name() = 'name'] | *[local-name() = 'recommendation']/*[local-name() = 'name'] | *[local-name() = 'requirement']/*[local-name() = 'name']" mode="contents">
4220
4276
  <xsl:apply-templates mode="contents"/>
4221
4277
  <xsl:text> </xsl:text>
4222
4278
  </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'table']/*[local-name() = 'name'] | *[local-name() = 'permission']/*[local-name() = 'name'] | *[local-name() = 'recommendation']/*[local-name() = 'name'] | *[local-name() = 'requirement']/*[local-name() = 'name']" mode="bookmarks">
@@ -4526,12 +4582,16 @@
4526
4582
  <xsl:if test="$font-size != ''">
4527
4583
  <xsl:attribute name="font-size">
4528
4584
  <xsl:choose>
4585
+ <xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
4586
+ <xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
4529
4587
  <xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
4530
4588
  <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
4531
4589
  </xsl:choose>
4532
4590
  </xsl:attribute>
4533
4591
  </xsl:if>
4534
4592
 
4593
+
4594
+
4535
4595
  <xsl:apply-templates/>
4536
4596
  </fo:block>
4537
4597
 
@@ -4915,14 +4975,15 @@
4915
4975
  </xsl:if>
4916
4976
  </xsl:template><xsl:variable name="localized.source">
4917
4977
  <xsl:call-template name="getLocalizedString">
4918
- <xsl:with-param name="key">source</xsl:with-param>
4919
- </xsl:call-template>
4978
+ <xsl:with-param name="key">source</xsl:with-param>
4979
+ </xsl:call-template>
4920
4980
  </xsl:variable><xsl:template match="*[local-name() = 'origin']">
4921
4981
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
4922
4982
  <xsl:if test="normalize-space(@citeas) = ''">
4923
4983
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
4924
4984
  </xsl:if>
4925
4985
 
4986
+
4926
4987
  <fo:inline>
4927
4988
 
4928
4989
 
@@ -4930,6 +4991,7 @@
4930
4991
 
4931
4992
 
4932
4993
 
4994
+
4933
4995
  <xsl:call-template name="getTitle">
4934
4996
  <xsl:with-param name="name" select="'title-source'"/>
4935
4997
  </xsl:call-template>
@@ -4941,6 +5003,7 @@
4941
5003
  <fo:inline xsl:use-attribute-sets="origin-style">
4942
5004
  <xsl:apply-templates/>
4943
5005
  </fo:inline>
5006
+
4944
5007
  </fo:basic-link>
4945
5008
  </xsl:template><xsl:template match="*[local-name() = 'modification']/*[local-name() = 'p']">
4946
5009
  <fo:inline><xsl:apply-templates/></fo:inline>
@@ -5007,6 +5070,9 @@
5007
5070
 
5008
5071
  </xsl:if>
5009
5072
 
5073
+ <xsl:variable name="citeas" select="java:replaceAll(java:java.lang.String.new(@citeas),'^\[?(.+?)\]?$','$1')"/> <!-- remove leading and trailing brackets -->
5074
+ <xsl:variable name="text" select="normalize-space()"/>
5075
+
5010
5076
 
5011
5077
 
5012
5078
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
@@ -5022,7 +5088,9 @@
5022
5088
 
5023
5089
 
5024
5090
  </xsl:if>
5025
-
5091
+
5092
+
5093
+
5026
5094
  <xsl:apply-templates/>
5027
5095
  </fo:basic-link>
5028
5096
 
@@ -5364,6 +5432,7 @@
5364
5432
  </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" priority="4">
5365
5433
  <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
5366
5434
  <fo:block start-indent="{5 * $level}mm" text-indent="-5mm">
5435
+
5367
5436
  <xsl:apply-templates/>
5368
5437
  </fo:block>
5369
5438
  </xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
@@ -5672,9 +5741,97 @@
5672
5741
  <fo:block-container border="1pt solid black" width="50%">
5673
5742
  <fo:block> </fo:block>
5674
5743
  </fo:block-container>
5744
+ </xsl:template><xsl:template match="*[local-name() = 'toc']">
5745
+ <xsl:param name="colwidths"/>
5746
+ <xsl:variable name="colwidths_">
5747
+ <xsl:choose>
5748
+ <xsl:when test="not($colwidths)">
5749
+ <xsl:variable name="toc_table_simple">
5750
+ <tbody>
5751
+ <xsl:apply-templates mode="toc_table_width"/>
5752
+ </tbody>
5753
+ </xsl:variable>
5754
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($toc_table_simple)/*/tr[1]/td)"/>
5755
+ <xsl:call-template name="calculate-column-widths">
5756
+ <xsl:with-param name="cols-count" select="$cols-count"/>
5757
+ <xsl:with-param name="table" select="$toc_table_simple"/>
5758
+ </xsl:call-template>
5759
+ </xsl:when>
5760
+ <xsl:otherwise>
5761
+ <xsl:copy-of select="$colwidths"/>
5762
+ </xsl:otherwise>
5763
+ </xsl:choose>
5764
+ </xsl:variable>
5765
+ <fo:block role="TOCI" space-after="16pt">
5766
+ <fo:table width="100%" table-layout="fixed">
5767
+ <xsl:for-each select="xalan:nodeset($colwidths_)/column">
5768
+ <fo:table-column column-width="proportional-column-width({.})"/>
5769
+ </xsl:for-each>
5770
+ <fo:table-body>
5771
+ <xsl:apply-templates/>
5772
+ </fo:table-body>
5773
+ </fo:table>
5774
+ </fo:block>
5775
+ </xsl:template><xsl:template match="*[local-name() = 'toc']//*[local-name() = 'li']">
5776
+ <fo:table-row min-height="5mm">
5777
+ <xsl:apply-templates/>
5778
+ </fo:table-row>
5779
+ </xsl:template><xsl:template match="*[local-name() = 'toc']//*[local-name() = 'li']/*[local-name() = 'p']">
5780
+ <xsl:apply-templates/>
5781
+ </xsl:template><xsl:template match="*[local-name() = 'toc']//*[local-name() = 'xref']" priority="3">
5782
+ <!-- <xref target="cgpm9th1948r6">1.6.3<tab/>&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
5783
+ <xsl:variable name="target" select="@target"/>
5784
+ <xsl:for-each select="*[local-name() = 'tab']">
5785
+ <xsl:variable name="current_id" select="generate-id()"/>
5786
+ <fo:table-cell>
5787
+ <fo:block>
5788
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
5789
+ <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
5790
+ <xsl:choose>
5791
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
5792
+ <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
5793
+ </xsl:choose>
5794
+ </xsl:for-each>
5795
+ </fo:basic-link>
5796
+ </fo:block>
5797
+ </fo:table-cell>
5798
+ </xsl:for-each>
5799
+ <!-- last column - for page numbers -->
5800
+ <fo:table-cell text-align="right" font-size="10pt" font-weight="bold" font-family="Arial">
5801
+ <fo:block>
5802
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
5803
+ <fo:page-number-citation ref-id="{$target}"/>
5804
+ </fo:basic-link>
5805
+ </fo:block>
5806
+ </fo:table-cell>
5807
+ </xsl:template><xsl:template match="*" mode="toc_table_width">
5808
+ <xsl:apply-templates mode="toc_table_width"/>
5809
+ </xsl:template><xsl:template match="*[local-name() = 'clause'][@type = 'toc']/*[local-name() = 'title']" mode="toc_table_width"/><xsl:template match="*[local-name() = 'clause'][not(@type = 'toc')]/*[local-name() = 'title']" mode="toc_table_width"/><xsl:template match="*[local-name() = 'li']" mode="toc_table_width">
5810
+ <tr>
5811
+ <xsl:apply-templates mode="toc_table_width"/>
5812
+ </tr>
5813
+ </xsl:template><xsl:template match="*[local-name() = 'xref']" mode="toc_table_width">
5814
+ <!-- <xref target="cgpm9th1948r6">1.6.3<tab/>&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
5815
+ <xsl:for-each select="*[local-name() = 'tab']">
5816
+ <xsl:variable name="current_id" select="generate-id()"/>
5817
+ <td>
5818
+ <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
5819
+ <xsl:copy-of select="."/>
5820
+ </xsl:for-each>
5821
+ </td>
5822
+ </xsl:for-each>
5823
+ <td>333</td> <!-- page number, just for fill -->
5675
5824
  </xsl:template><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']"/><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
5676
5825
  <fo:inline padding-right="5mm"> </fo:inline>
5677
5826
  <fo:inline><xsl:apply-templates/></fo:inline>
5827
+ </xsl:template><xsl:template match="*[local-name() = 'blacksquare']" name="blacksquare">
5828
+ <fo:inline padding-right="2.5mm" baseline-shift="5%">
5829
+ <fo:instream-foreign-object content-height="2mm" content-width="2mm" fox:alt-text="Quad">
5830
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" viewBox="0 0 2 2">
5831
+ <rect x="0" y="0" width="2" height="2" fill="black"/>
5832
+ </svg>
5833
+ </fo:instream-foreign-object>
5834
+ </fo:inline>
5678
5835
  </xsl:template><xsl:template name="convertDate">
5679
5836
  <xsl:param name="date"/>
5680
5837
  <xsl:param name="format" select="'short'"/>
@@ -43,8 +43,10 @@ module IsoDoc
43
43
  end
44
44
 
45
45
  def insert_submitting_orgs(docxml)
46
- orgs = []
47
- docxml.xpath(ns(submittingorgs_path)).each { |org| orgs << org.text }
46
+ orgs = docxml.xpath(ns(submittingorgs_path))
47
+ .each_with_object([]) do |org, m|
48
+ m << org.text
49
+ end
48
50
  return if orgs.empty?
49
51
 
50
52
  if a = submit_orgs_append_pt(docxml)
@@ -146,7 +148,8 @@ module IsoDoc
146
148
  end
147
149
 
148
150
  def clause1(elem)
149
- return if elem.name == "terms" && elem.parent.name == "annex"
151
+ return if elem.name == "terms" && elem.parent.name == "annex" &&
152
+ elem.parent.xpath(ns("./terms")).size == 1
150
153
 
151
154
  super
152
155
  end
@@ -1,4 +1,5 @@
1
1
  require "isodoc"
2
+ require "metanorma-utils"
2
3
 
3
4
  module IsoDoc
4
5
  module Ogc
@@ -34,24 +35,25 @@ module IsoDoc
34
35
  b = out.add_child("<p class='#{recommendation_class(node)}'></p>").first
35
36
  if name = node&.at(ns("./name"))&.remove
36
37
  name.children.each { |n| b << n }
37
- b << l10n(":")
38
38
  end
39
39
  if title = node&.at(ns("./title"))&.remove
40
- b << l10n(" ") if name
40
+ b << l10n(": ") if name
41
41
  title.children.each { |n| b << n }
42
42
  end
43
43
  end
44
44
 
45
45
  def recommend_title(node, out)
46
46
  label = node&.at(ns("./label"))&.remove or return
47
+ label.xpath(ns(".//xref | .//eref | .//quote/source"))
48
+ .each { |f| xref1(f) }
49
+ label.xpath(ns(".//concept")).each { |f| concept1(f) }
47
50
  b = out.add_child("<tr><td colspan='2'><p></p></td></tr>")
48
51
  p = b.at(ns(".//p"))
49
- p << label.children
52
+ p << label.text
50
53
  end
51
54
 
52
55
  def recommendation_attributes1(node)
53
56
  out = recommendation_attributes1_head(node, [])
54
- out = recommendation_attributes1_component(node, out)
55
57
  node.xpath(ns("./classification")).each do |c|
56
58
  line = recommendation_attr_keyvalue(c, "tag", "value") and out << line
57
59
  end
@@ -68,32 +70,28 @@ module IsoDoc
68
70
  out
69
71
  end
70
72
 
71
- def strict_capitalize_phrase(str)
72
- str.split(/ /).map do |w|
73
- letters = w.chars
74
- letters.first.upcase!
75
- letters.join
76
- end.join(" ")
73
+ def recommendation_steps(node)
74
+ node.elements.each { |e| recommendation_steps(e) }
75
+ return node unless node.at(ns("./component[@class = 'step']"))
76
+
77
+ d = node.at(ns("./component[@class = 'step']"))
78
+ d = d.replace("<ol><li>#{d.children.to_xml}</li></ol>").first
79
+ node.xpath(ns("./component[@class = 'step']")).each do |f|
80
+ f = f.replace("<li>#{f.children.to_xml}</li>").first
81
+ d << f
82
+ end
83
+ node
77
84
  end
78
85
 
79
86
  def recommendation_attributes1_component(node, out)
80
- node.xpath(ns("./component[not(@class = 'part')]")).each do |c|
81
- out << case c["class"]
82
- when "test-purpose" then ["Test Purpose", c.remove.children]
83
- when "test-method" then ["Test Method", c.remove.children]
84
- else [strict_capitalize_phrase(c["class"]), c.remove.children]
85
- end
86
- end
87
- node.xpath(ns("./component[@class = 'part']")).each_with_index do |c, i|
88
- out << [(i + "A".ord).chr.to_s, c.remove.children]
89
- end
90
- out
87
+ node = recommendation_steps(node)
88
+ out << "<tr><td>#{node['label']}</td><td>#{node.children}</td></tr>"
91
89
  end
92
90
 
93
91
  def rec_subj(node)
94
92
  case node["type_original"]
95
- when "class" then "Target Type"
96
- when "conformanceclass" then "Requirements Class"
93
+ when "class" then "Target type"
94
+ when "conformanceclass" then "Requirements class"
97
95
  when "verification", "abstracttest" then "Requirement"
98
96
  else "Subject"
99
97
  end
@@ -108,6 +106,7 @@ module IsoDoc
108
106
  end
109
107
 
110
108
  def recommendation_attributes(node, out)
109
+ recommend_title(node, out)
111
110
  recommendation_attributes1(node).each do |i|
112
111
  out.add_child("<tr><td>#{i[0]}</td><td>#{i[1]}</td></tr>")
113
112
  end
@@ -126,8 +125,11 @@ module IsoDoc
126
125
 
127
126
  node.elements.size == 1 && node.first_element_child.name == "dl" and
128
127
  return reqt_dl(node.first_element_child, out)
128
+ node.name == "component" and
129
+ return recommendation_attributes1_component(node, out)
129
130
  b = out.add_child("<tr><td colspan='2'></td></tr>").first
130
- b.at(ns(".//td")) << (preserve_in_nested_table?(node) ? node : node.children)
131
+ b.at(ns(".//td")) <<
132
+ (preserve_in_nested_table?(node) ? node : node.children)
131
133
  end
132
134
 
133
135
  def reqt_dl(node, out)
@@ -146,19 +148,31 @@ module IsoDoc
146
148
  node["class"] = klass
147
149
  node["type_original"] = node["type"]
148
150
  node["type"] = recommend_class(node)
151
+ recommendation_component_labels(node)
152
+ end
153
+
154
+ def recommendation_component_labels(node)
155
+ node.xpath(ns("./component[@class = 'part']")).each_with_index do |c, i|
156
+ c["label"] = (i + "A".ord).chr.to_s
157
+ end
158
+ node.xpath(ns("./component[not(@class = 'part')]")).each do |c|
159
+ c["label"] = case c["class"]
160
+ when "test-purpose" then "Test purpose"
161
+ when "test-method" then "Test method"
162
+ else Metanorma::Utils.strict_capitalize_first(c["class"])
163
+ end
164
+ end
149
165
  end
150
166
 
151
167
  def recommendation_parse1(node, klass)
152
168
  recommendation_base(node, klass)
153
169
  recommendation_header(node)
154
170
  b = node.add_child("<tbody></tbody>").first
155
- recommend_title(node, b)
156
171
  recommendation_attributes(node, b)
157
- node.elements.each do |n|
158
- next if %w(thead tbody).include?(n.name)
159
-
160
- requirement_component_parse(n, b)
161
- end
172
+ node.elements.reject do |n|
173
+ %w(thead tbody classification subject
174
+ inherit).include?(n.name)
175
+ end.each { |n| requirement_component_parse(n, b) }
162
176
  node.delete("type_original")
163
177
  end
164
178
 
@@ -191,13 +205,12 @@ module IsoDoc
191
205
  def requirement_table_cleanup(docxml)
192
206
  docxml.xpath(ns("//table[@type = 'recommendclass']/tbody/tr/td/table"))
193
207
  .each do |t|
194
- x = t.at(ns("./thead")) and x.replace(x.children)
195
- x = t.at(ns("./tbody")) and x.replace(x.children)
196
- x = t.at(ns("./tfoot")) and x.replace(x.children)
197
- if (x = t.at(ns("./tr/th[@colspan = '2']"))) &&
198
- (y = t.at(ns("./tr/td[@colspan = '2']")))
199
- requirement_table_cleanup1(x, y)
208
+ t.xpath(ns("./thead | ./tbody |./tfoot")).each do |x|
209
+ x.replace(x.children)
200
210
  end
211
+ (x = t.at(ns("./tr/th[@colspan = '2']"))) &&
212
+ (y = t.at(ns("./tr/td[@colspan = '2']"))) and
213
+ requirement_table_cleanup1(x, y)
201
214
  t.parent.parent.replace(t.children)
202
215
  end
203
216
  end
@@ -200,8 +200,7 @@ module IsoDoc
200
200
  when 6 then "(#{num})"
201
201
  when 7 then "(#{(96 + num).chr})"
202
202
  when 8 then "(#{RomanNumerals.to_roman(num).downcase})"
203
- else
204
- num.to_s
203
+ else num.to_s
205
204
  end
206
205
  end
207
206
 
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Ogc
3
- VERSION = "1.4.1".freeze
3
+ VERSION = "1.4.4".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-ogc
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.1
4
+ version: 1.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-08-30 00:00:00.000000000 Z
11
+ date: 2021-10-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: iso-639
@@ -218,6 +218,7 @@ files:
218
218
  - lib/asciidoctor/ogc/basicdoc.rng
219
219
  - lib/asciidoctor/ogc/biblio.rng
220
220
  - lib/asciidoctor/ogc/boilerplate.xml
221
+ - lib/asciidoctor/ogc/cleanup.rb
221
222
  - lib/asciidoctor/ogc/converter.rb
222
223
  - lib/asciidoctor/ogc/front.rb
223
224
  - lib/asciidoctor/ogc/isodoc.rng