metanorma-ogc 1.4.1 → 1.4.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -364,7 +364,7 @@
364
364
 
365
365
  <xsl:choose>
366
366
  <xsl:when test="@level = 1">
367
- <fo:list-block provisional-distance-between-starts="7mm">
367
+ <fo:list-block provisional-distance-between-starts="8mm">
368
368
  <xsl:if test="@type = 'annex'">
369
369
  <xsl:attribute name="provisional-distance-between-starts">0mm</xsl:attribute>
370
370
  </xsl:if>
@@ -393,7 +393,7 @@
393
393
  </fo:list-block>
394
394
  </xsl:when>
395
395
  <xsl:otherwise>
396
- <fo:block text-align-last="justify" margin-left="7mm">
396
+ <fo:block text-align-last="justify" margin-left="8mm">
397
397
  <fo:basic-link internal-destination="{@id}" fox:alt-text="{text()}">
398
398
  <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(@section))"/>
399
399
  <xsl:text> </xsl:text>
@@ -579,7 +579,7 @@
579
579
  <xsl:value-of select="translate(., $thinspace, ' ')"/>
580
580
  </xsl:template>
581
581
 
582
- <xsl:template match="text()" priority="3" mode="contents">
582
+ <xsl:template match="ogc:title//text() | ogc:name//text()" priority="3" mode="contents">
583
583
  <xsl:value-of select="translate(., $thinspace, ' ')"/>
584
584
  </xsl:template>
585
585
 
@@ -587,7 +587,9 @@
587
587
  <xsl:variable name="content">
588
588
  <xsl:call-template name="add-zero-spaces"/>
589
589
  </xsl:variable>
590
- <xsl:value-of select="translate($content, $thinspace, ' ')"/>
590
+ <!-- add zero-width space in the words like 'adeOfAbstractTransportaonSpace' to split it in the table's cell -->
591
+ <xsl:variable name="content2" select="java:replaceAll(java:java.lang.String.new($content),'([a-z]{2,})([A-Z])(.?)','$1​$2$3')"/>
592
+ <xsl:value-of select="translate($content2, $thinspace, ' ')"/>
591
593
  </xsl:template>
592
594
 
593
595
 
@@ -1057,6 +1059,9 @@
1057
1059
  <xsl:if test="ancestor::ogc:table">
1058
1060
  <xsl:attribute name="margin-left">1.5mm</xsl:attribute>
1059
1061
  </xsl:if>
1062
+ <xsl:if test="ancestor::ogc:ul or ancestor::ogc:ol">
1063
+ <xsl:attribute name="margin-top">10pt</xsl:attribute>
1064
+ </xsl:if>
1060
1065
  <fo:block-container margin-left="0mm">
1061
1066
  <fo:list-block provisional-distance-between-starts="12mm" space-after="12pt" line-height="115%">
1062
1067
  <xsl:if test="ancestor::ogc:table">
@@ -1091,17 +1096,25 @@
1091
1096
  <xsl:number format="a)" lang="en"/>
1092
1097
  </xsl:when>
1093
1098
  <xsl:when test="../@type = 'alphabet'">
1094
- <xsl:number format="1)"/>
1099
+ <xsl:number format="1."/>
1095
1100
  </xsl:when>
1096
1101
  <xsl:when test="../@type = 'alphabet_upper'">
1097
1102
  <xsl:number format="A)" lang="en"/>
1098
1103
  </xsl:when>
1099
-
1100
1104
  <xsl:when test="../@type = 'roman'">
1101
1105
  <xsl:number format="i)"/>
1102
1106
  </xsl:when>
1107
+ <xsl:when test="ancestor::ogc:table">
1108
+ <xsl:variable name="level" select="count(ancestor-or-self::ogc:li[ancestor::ogc:table])"/>
1109
+ <xsl:choose>
1110
+ <xsl:when test="$level = 1"><xsl:number format="a)" lang="en"/></xsl:when>
1111
+ <xsl:when test="$level = 2"><xsl:number format="1."/></xsl:when>
1112
+ <xsl:when test="$level = 3"><xsl:number format="i)"/></xsl:when>
1113
+ <xsl:otherwise><xsl:number format="a)" lang="en"/></xsl:otherwise>
1114
+ </xsl:choose>
1115
+ </xsl:when>
1103
1116
  <xsl:otherwise>
1104
- <xsl:number format="1)"/>
1117
+ <xsl:number format="1."/>
1105
1118
  </xsl:otherwise>
1106
1119
  </xsl:choose>
1107
1120
  </xsl:otherwise>
@@ -1110,6 +1123,9 @@
1110
1123
  </fo:list-item-label>
1111
1124
  <fo:list-item-body start-indent="body-start()" line-height-shift-adjustment="disregard-shifts">
1112
1125
  <fo:block margin-bottom="10pt">
1126
+ <xsl:if test="not(following-sibling::*) and not(../following-sibling::*)">
1127
+ <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
1128
+ </xsl:if>
1113
1129
  <xsl:apply-templates/>
1114
1130
  </fo:block>
1115
1131
  </fo:list-item-body>
@@ -1834,7 +1850,7 @@
1834
1850
 
1835
1851
  <xsl:attribute name="text-align">left</xsl:attribute>
1836
1852
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
1837
- <xsl:attribute name="font-weight">normal</xsl:attribute>
1853
+ <xsl:attribute name="font-weight">bold</xsl:attribute><!-- normal -->
1838
1854
  <xsl:attribute name="font-size">11pt</xsl:attribute>
1839
1855
 
1840
1856
 
@@ -1994,6 +2010,7 @@
1994
2010
 
1995
2011
 
1996
2012
 
2013
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
1997
2014
  <xsl:attribute name="margin-top">12pt</xsl:attribute>
1998
2015
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
1999
2016
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
@@ -2954,6 +2971,8 @@
2954
2971
 
2955
2972
 
2956
2973
  <xsl:attribute name="border">solid 0pt white</xsl:attribute>
2974
+ <xsl:attribute name="padding-top">1mm</xsl:attribute>
2975
+ <xsl:attribute name="padding-bottom">1mm</xsl:attribute>
2957
2976
 
2958
2977
 
2959
2978
 
@@ -5957,6 +5976,7 @@
5957
5976
  </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" priority="4">
5958
5977
  <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
5959
5978
  <fo:block start-indent="{5 * $level}mm" text-indent="-5mm">
5979
+
5960
5980
  <xsl:apply-templates/>
5961
5981
  </fo:block>
5962
5982
  </xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
@@ -364,7 +364,7 @@
364
364
 
365
365
  <xsl:choose>
366
366
  <xsl:when test="@level = 1">
367
- <fo:list-block provisional-distance-between-starts="7mm">
367
+ <fo:list-block provisional-distance-between-starts="8mm">
368
368
  <xsl:if test="@type = 'annex'">
369
369
  <xsl:attribute name="provisional-distance-between-starts">0mm</xsl:attribute>
370
370
  </xsl:if>
@@ -393,7 +393,7 @@
393
393
  </fo:list-block>
394
394
  </xsl:when>
395
395
  <xsl:otherwise>
396
- <fo:block text-align-last="justify" margin-left="7mm">
396
+ <fo:block text-align-last="justify" margin-left="8mm">
397
397
  <fo:basic-link internal-destination="{@id}" fox:alt-text="{text()}">
398
398
  <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(@section))"/>
399
399
  <xsl:text> </xsl:text>
@@ -579,7 +579,7 @@
579
579
  <xsl:value-of select="translate(., $thinspace, ' ')"/>
580
580
  </xsl:template>
581
581
 
582
- <xsl:template match="text()" priority="3" mode="contents">
582
+ <xsl:template match="ogc:title//text() | ogc:name//text()" priority="3" mode="contents">
583
583
  <xsl:value-of select="translate(., $thinspace, ' ')"/>
584
584
  </xsl:template>
585
585
 
@@ -587,7 +587,9 @@
587
587
  <xsl:variable name="content">
588
588
  <xsl:call-template name="add-zero-spaces"/>
589
589
  </xsl:variable>
590
- <xsl:value-of select="translate($content, $thinspace, ' ')"/>
590
+ <!-- add zero-width space in the words like 'adeOfAbstractTransportaonSpace' to split it in the table's cell -->
591
+ <xsl:variable name="content2" select="java:replaceAll(java:java.lang.String.new($content),'([a-z]{2,})([A-Z])(.?)','$1​$2$3')"/>
592
+ <xsl:value-of select="translate($content2, $thinspace, ' ')"/>
591
593
  </xsl:template>
592
594
 
593
595
 
@@ -1057,6 +1059,9 @@
1057
1059
  <xsl:if test="ancestor::ogc:table">
1058
1060
  <xsl:attribute name="margin-left">1.5mm</xsl:attribute>
1059
1061
  </xsl:if>
1062
+ <xsl:if test="ancestor::ogc:ul or ancestor::ogc:ol">
1063
+ <xsl:attribute name="margin-top">10pt</xsl:attribute>
1064
+ </xsl:if>
1060
1065
  <fo:block-container margin-left="0mm">
1061
1066
  <fo:list-block provisional-distance-between-starts="12mm" space-after="12pt" line-height="115%">
1062
1067
  <xsl:if test="ancestor::ogc:table">
@@ -1091,17 +1096,25 @@
1091
1096
  <xsl:number format="a)" lang="en"/>
1092
1097
  </xsl:when>
1093
1098
  <xsl:when test="../@type = 'alphabet'">
1094
- <xsl:number format="1)"/>
1099
+ <xsl:number format="1."/>
1095
1100
  </xsl:when>
1096
1101
  <xsl:when test="../@type = 'alphabet_upper'">
1097
1102
  <xsl:number format="A)" lang="en"/>
1098
1103
  </xsl:when>
1099
-
1100
1104
  <xsl:when test="../@type = 'roman'">
1101
1105
  <xsl:number format="i)"/>
1102
1106
  </xsl:when>
1107
+ <xsl:when test="ancestor::ogc:table">
1108
+ <xsl:variable name="level" select="count(ancestor-or-self::ogc:li[ancestor::ogc:table])"/>
1109
+ <xsl:choose>
1110
+ <xsl:when test="$level = 1"><xsl:number format="a)" lang="en"/></xsl:when>
1111
+ <xsl:when test="$level = 2"><xsl:number format="1."/></xsl:when>
1112
+ <xsl:when test="$level = 3"><xsl:number format="i)"/></xsl:when>
1113
+ <xsl:otherwise><xsl:number format="a)" lang="en"/></xsl:otherwise>
1114
+ </xsl:choose>
1115
+ </xsl:when>
1103
1116
  <xsl:otherwise>
1104
- <xsl:number format="1)"/>
1117
+ <xsl:number format="1."/>
1105
1118
  </xsl:otherwise>
1106
1119
  </xsl:choose>
1107
1120
  </xsl:otherwise>
@@ -1110,6 +1123,9 @@
1110
1123
  </fo:list-item-label>
1111
1124
  <fo:list-item-body start-indent="body-start()" line-height-shift-adjustment="disregard-shifts">
1112
1125
  <fo:block margin-bottom="10pt">
1126
+ <xsl:if test="not(following-sibling::*) and not(../following-sibling::*)">
1127
+ <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
1128
+ </xsl:if>
1113
1129
  <xsl:apply-templates/>
1114
1130
  </fo:block>
1115
1131
  </fo:list-item-body>
@@ -1834,7 +1850,7 @@
1834
1850
 
1835
1851
  <xsl:attribute name="text-align">left</xsl:attribute>
1836
1852
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
1837
- <xsl:attribute name="font-weight">normal</xsl:attribute>
1853
+ <xsl:attribute name="font-weight">bold</xsl:attribute><!-- normal -->
1838
1854
  <xsl:attribute name="font-size">11pt</xsl:attribute>
1839
1855
 
1840
1856
 
@@ -1994,6 +2010,7 @@
1994
2010
 
1995
2011
 
1996
2012
 
2013
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
1997
2014
  <xsl:attribute name="margin-top">12pt</xsl:attribute>
1998
2015
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
1999
2016
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
@@ -2954,6 +2971,8 @@
2954
2971
 
2955
2972
 
2956
2973
  <xsl:attribute name="border">solid 0pt white</xsl:attribute>
2974
+ <xsl:attribute name="padding-top">1mm</xsl:attribute>
2975
+ <xsl:attribute name="padding-bottom">1mm</xsl:attribute>
2957
2976
 
2958
2977
 
2959
2978
 
@@ -5957,6 +5976,7 @@
5957
5976
  </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" priority="4">
5958
5977
  <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
5959
5978
  <fo:block start-indent="{5 * $level}mm" text-indent="-5mm">
5979
+
5960
5980
  <xsl:apply-templates/>
5961
5981
  </fo:block>
5962
5982
  </xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
@@ -364,7 +364,7 @@
364
364
 
365
365
  <xsl:choose>
366
366
  <xsl:when test="@level = 1">
367
- <fo:list-block provisional-distance-between-starts="7mm">
367
+ <fo:list-block provisional-distance-between-starts="8mm">
368
368
  <xsl:if test="@type = 'annex'">
369
369
  <xsl:attribute name="provisional-distance-between-starts">0mm</xsl:attribute>
370
370
  </xsl:if>
@@ -393,7 +393,7 @@
393
393
  </fo:list-block>
394
394
  </xsl:when>
395
395
  <xsl:otherwise>
396
- <fo:block text-align-last="justify" margin-left="7mm">
396
+ <fo:block text-align-last="justify" margin-left="8mm">
397
397
  <fo:basic-link internal-destination="{@id}" fox:alt-text="{text()}">
398
398
  <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(@section))"/>
399
399
  <xsl:text> </xsl:text>
@@ -579,7 +579,7 @@
579
579
  <xsl:value-of select="translate(., $thinspace, ' ')"/>
580
580
  </xsl:template>
581
581
 
582
- <xsl:template match="text()" priority="3" mode="contents">
582
+ <xsl:template match="ogc:title//text() | ogc:name//text()" priority="3" mode="contents">
583
583
  <xsl:value-of select="translate(., $thinspace, ' ')"/>
584
584
  </xsl:template>
585
585
 
@@ -587,7 +587,9 @@
587
587
  <xsl:variable name="content">
588
588
  <xsl:call-template name="add-zero-spaces"/>
589
589
  </xsl:variable>
590
- <xsl:value-of select="translate($content, $thinspace, ' ')"/>
590
+ <!-- add zero-width space in the words like 'adeOfAbstractTransportaonSpace' to split it in the table's cell -->
591
+ <xsl:variable name="content2" select="java:replaceAll(java:java.lang.String.new($content),'([a-z]{2,})([A-Z])(.?)','$1​$2$3')"/>
592
+ <xsl:value-of select="translate($content2, $thinspace, ' ')"/>
591
593
  </xsl:template>
592
594
 
593
595
 
@@ -1057,6 +1059,9 @@
1057
1059
  <xsl:if test="ancestor::ogc:table">
1058
1060
  <xsl:attribute name="margin-left">1.5mm</xsl:attribute>
1059
1061
  </xsl:if>
1062
+ <xsl:if test="ancestor::ogc:ul or ancestor::ogc:ol">
1063
+ <xsl:attribute name="margin-top">10pt</xsl:attribute>
1064
+ </xsl:if>
1060
1065
  <fo:block-container margin-left="0mm">
1061
1066
  <fo:list-block provisional-distance-between-starts="12mm" space-after="12pt" line-height="115%">
1062
1067
  <xsl:if test="ancestor::ogc:table">
@@ -1091,17 +1096,25 @@
1091
1096
  <xsl:number format="a)" lang="en"/>
1092
1097
  </xsl:when>
1093
1098
  <xsl:when test="../@type = 'alphabet'">
1094
- <xsl:number format="1)"/>
1099
+ <xsl:number format="1."/>
1095
1100
  </xsl:when>
1096
1101
  <xsl:when test="../@type = 'alphabet_upper'">
1097
1102
  <xsl:number format="A)" lang="en"/>
1098
1103
  </xsl:when>
1099
-
1100
1104
  <xsl:when test="../@type = 'roman'">
1101
1105
  <xsl:number format="i)"/>
1102
1106
  </xsl:when>
1107
+ <xsl:when test="ancestor::ogc:table">
1108
+ <xsl:variable name="level" select="count(ancestor-or-self::ogc:li[ancestor::ogc:table])"/>
1109
+ <xsl:choose>
1110
+ <xsl:when test="$level = 1"><xsl:number format="a)" lang="en"/></xsl:when>
1111
+ <xsl:when test="$level = 2"><xsl:number format="1."/></xsl:when>
1112
+ <xsl:when test="$level = 3"><xsl:number format="i)"/></xsl:when>
1113
+ <xsl:otherwise><xsl:number format="a)" lang="en"/></xsl:otherwise>
1114
+ </xsl:choose>
1115
+ </xsl:when>
1103
1116
  <xsl:otherwise>
1104
- <xsl:number format="1)"/>
1117
+ <xsl:number format="1."/>
1105
1118
  </xsl:otherwise>
1106
1119
  </xsl:choose>
1107
1120
  </xsl:otherwise>
@@ -1110,6 +1123,9 @@
1110
1123
  </fo:list-item-label>
1111
1124
  <fo:list-item-body start-indent="body-start()" line-height-shift-adjustment="disregard-shifts">
1112
1125
  <fo:block margin-bottom="10pt">
1126
+ <xsl:if test="not(following-sibling::*) and not(../following-sibling::*)">
1127
+ <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
1128
+ </xsl:if>
1113
1129
  <xsl:apply-templates/>
1114
1130
  </fo:block>
1115
1131
  </fo:list-item-body>
@@ -1834,7 +1850,7 @@
1834
1850
 
1835
1851
  <xsl:attribute name="text-align">left</xsl:attribute>
1836
1852
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
1837
- <xsl:attribute name="font-weight">normal</xsl:attribute>
1853
+ <xsl:attribute name="font-weight">bold</xsl:attribute><!-- normal -->
1838
1854
  <xsl:attribute name="font-size">11pt</xsl:attribute>
1839
1855
 
1840
1856
 
@@ -1994,6 +2010,7 @@
1994
2010
 
1995
2011
 
1996
2012
 
2013
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
1997
2014
  <xsl:attribute name="margin-top">12pt</xsl:attribute>
1998
2015
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
1999
2016
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
@@ -2954,6 +2971,8 @@
2954
2971
 
2955
2972
 
2956
2973
  <xsl:attribute name="border">solid 0pt white</xsl:attribute>
2974
+ <xsl:attribute name="padding-top">1mm</xsl:attribute>
2975
+ <xsl:attribute name="padding-bottom">1mm</xsl:attribute>
2957
2976
 
2958
2977
 
2959
2978
 
@@ -5957,6 +5976,7 @@
5957
5976
  </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" priority="4">
5958
5977
  <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
5959
5978
  <fo:block start-indent="{5 * $level}mm" text-indent="-5mm">
5979
+
5960
5980
  <xsl:apply-templates/>
5961
5981
  </fo:block>
5962
5982
  </xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
@@ -5364,6 +5364,7 @@
5364
5364
  </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" priority="4">
5365
5365
  <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
5366
5366
  <fo:block start-indent="{5 * $level}mm" text-indent="-5mm">
5367
+
5367
5368
  <xsl:apply-templates/>
5368
5369
  </fo:block>
5369
5370
  </xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
@@ -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,27 @@ 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
77
83
  end
78
84
 
79
85
  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
86
+ node = recommendation_steps(node)
87
+ out << "<tr><td>#{node['label']}</td><td>#{node.children}</td></tr>"
91
88
  end
92
89
 
93
90
  def rec_subj(node)
94
91
  case node["type_original"]
95
- when "class" then "Target Type"
96
- when "conformanceclass" then "Requirements Class"
92
+ when "class" then "Target type"
93
+ when "conformanceclass" then "Requirements class"
97
94
  when "verification", "abstracttest" then "Requirement"
98
95
  else "Subject"
99
96
  end
@@ -108,6 +105,7 @@ module IsoDoc
108
105
  end
109
106
 
110
107
  def recommendation_attributes(node, out)
108
+ recommend_title(node, out)
111
109
  recommendation_attributes1(node).each do |i|
112
110
  out.add_child("<tr><td>#{i[0]}</td><td>#{i[1]}</td></tr>")
113
111
  end
@@ -126,8 +124,11 @@ module IsoDoc
126
124
 
127
125
  node.elements.size == 1 && node.first_element_child.name == "dl" and
128
126
  return reqt_dl(node.first_element_child, out)
127
+ node.name == "component" and
128
+ return recommendation_attributes1_component(node, out)
129
129
  b = out.add_child("<tr><td colspan='2'></td></tr>").first
130
- b.at(ns(".//td")) << (preserve_in_nested_table?(node) ? node : node.children)
130
+ b.at(ns(".//td")) <<
131
+ (preserve_in_nested_table?(node) ? node : node.children)
131
132
  end
132
133
 
133
134
  def reqt_dl(node, out)
@@ -146,19 +147,31 @@ module IsoDoc
146
147
  node["class"] = klass
147
148
  node["type_original"] = node["type"]
148
149
  node["type"] = recommend_class(node)
150
+ recommendation_component_labels(node)
151
+ end
152
+
153
+ def recommendation_component_labels(node)
154
+ node.xpath(ns("./component[@class = 'part']")).each_with_index do |c, i|
155
+ c["label"] = (i + "A".ord).chr.to_s
156
+ end
157
+ node.xpath(ns("./component[not(@class = 'part')]")).each do |c|
158
+ c["label"] = case c["class"]
159
+ when "test-purpose" then "Test purpose"
160
+ when "test-method" then "Test method"
161
+ else Metanorma::Utils.strict_capitalize_first(c["class"])
162
+ end
163
+ end
149
164
  end
150
165
 
151
166
  def recommendation_parse1(node, klass)
152
167
  recommendation_base(node, klass)
153
168
  recommendation_header(node)
154
169
  b = node.add_child("<tbody></tbody>").first
155
- recommend_title(node, b)
156
170
  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
171
+ node.elements.reject do |n|
172
+ %w(thead tbody classification subject
173
+ inherit).include?(n.name)
174
+ end.each { |n| requirement_component_parse(n, b) }
162
175
  node.delete("type_original")
163
176
  end
164
177
 
@@ -191,13 +204,12 @@ module IsoDoc
191
204
  def requirement_table_cleanup(docxml)
192
205
  docxml.xpath(ns("//table[@type = 'recommendclass']/tbody/tr/td/table"))
193
206
  .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)
207
+ t.xpath(ns("./thead | ./tbody |./tfoot")).each do |x|
208
+ x.replace(x.children)
200
209
  end
210
+ (x = t.at(ns("./tr/th[@colspan = '2']"))) &&
211
+ (y = t.at(ns("./tr/td[@colspan = '2']"))) and
212
+ requirement_table_cleanup1(x, y)
201
213
  t.parent.parent.replace(t.children)
202
214
  end
203
215
  end