metanorma-ieee 1.0.11 → 1.0.12

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: 672c2ce5167d82952924a69bfefdf2edc9e462678e2f3b798254d57762da5a59
4
- data.tar.gz: ac59d2d3e835a7054aac01ee2d81cb2993571070d2c16e2107e5036a91fabd4a
3
+ metadata.gz: 1fcccb9ecbb7f583ec84c5e85aa31e33f997e97710354839a3a72bed031d0765
4
+ data.tar.gz: d5147dabd75d8aaeebef7f8b3451320a20f8bad6b455b07a70506e26060acd07
5
5
  SHA512:
6
- metadata.gz: cc7f1827d98e014a16d0110767f6fed7a80e7b1237930b49b230de2e7238f260ec69f0ad7858d7b13f6fc9b8cbcf6daa9e39fa0aee527b63eb385489fba1f3c3
7
- data.tar.gz: 84d434983b7469a5be73efa00b896f95cc6e390a1985ce67cf3b8909856fbcb58af436d340a990a382b1bad1542beda0703a2c3ac7d597751739495d0043b341
6
+ metadata.gz: ef4b1f8961eaf3e59265eb81e8b3fe0ee021a557a5444fa89a504a5c759ef121d324732f8e7a7b851caf0fb2e19b968266754afe25785a3ea67fbbe557621cb8
7
+ data.tar.gz: 3d4b86db388a053e2fda8a3bbf885f84d8f940f5959a1651b96b6b279c33b0f598b2c034e57d521ac745a67601526af27b4dbe4897cbbbe8110e9d9797e11b5d
@@ -1,8 +1,32 @@
1
1
  class Html2Doc
2
2
  class IEEE < ::Html2Doc
3
3
  def style_list(elem, level, liststyle, listnumber)
4
- super
4
+ return unless liststyle
5
+
6
+ sameelem_level = elem.ancestors.map(&:name).count(elem.parent.name)
7
+ if elem["style"]
8
+ elem["style"] += ";"
9
+ else
10
+ elem["style"] = ""
11
+ end
12
+ sameelem_level1 = sameelem_level
13
+ if liststyle == "l11" && sameelem_level.to_i > 1
14
+ liststyle = "l21"
15
+ sameelem_level1 -= 1
16
+ end
17
+ if liststyle == "l16"
18
+ s = case elem.parent["type"]
19
+ when "a" then 1
20
+ when "1" then 2
21
+ else 3
22
+ end
23
+ sameelem_level1 += s - (sameelem_level1 % 3)
24
+ sameelem_level1 < 1 and sameelem_level1 += 3
25
+ end
26
+ elem["style"] += "mso-list:#{liststyle} level#{sameelem_level1} lfo#{listnumber}-#{level};"
27
+ elem["style"] += "text-indent:-0.79cm; margin-left:#{0.4 + (level.to_i * 0.76)}cm;"
5
28
  elem.parent["level"] = level
29
+ elem.parent["sameelem_level"] = sameelem_level
6
30
  end
7
31
 
8
32
  def list2para(list)
@@ -10,7 +34,9 @@ class Html2Doc
10
34
 
11
35
  level = list["level"] || "1"
12
36
  list.delete("level")
13
- list2para1(list, level, list.name)
37
+ samelevel = list["sameelem_level"] || "1"
38
+ list.delete("sameelem_level")
39
+ list2para1(list, samelevel, list.name)
14
40
  end
15
41
 
16
42
  def list2para1(list, level, type)
@@ -5724,7 +5724,7 @@
5724
5724
  </xsl:attribute>
5725
5725
  </xsl:for-each>
5726
5726
 
5727
- <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name'] or ./*[local-name()='source']"/>
5727
+ <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or ./*[local-name()='example'] or .//*[local-name()='fn'][local-name(..) != 'name'] or ./*[local-name()='source']"/>
5728
5728
  <xsl:if test="$isNoteOrFnExist = 'true'">
5729
5729
  <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
5730
5730
  </xsl:if>
@@ -5768,7 +5768,7 @@
5768
5768
  <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
5769
5769
  </xsl:when>
5770
5770
  <xsl:otherwise>
5771
- <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note') and not(local-name() = 'dl') and not(local-name() = 'source') and not(local-name() = 'p') and not(local-name() = 'thead') and not(local-name() = 'tfoot')]"/> <!-- process all table' elements, except name, header, footer, note, source and dl which render separaterely -->
5771
+ <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note') and not(local-name() = 'example') and not(local-name() = 'dl') and not(local-name() = 'source') and not(local-name() = 'p') and not(local-name() = 'thead') and not(local-name() = 'tfoot')]"/> <!-- process all table' elements, except name, header, footer, note, source and dl which render separaterely -->
5772
5772
  </xsl:otherwise>
5773
5773
  </xsl:choose>
5774
5774
 
@@ -6270,7 +6270,7 @@
6270
6270
  <xsl:param name="colwidths"/>
6271
6271
  <xsl:param name="colgroup"/>
6272
6272
 
6273
- <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name'] or ../*[local-name()='source'] or ../*[local-name()='p']"/>
6273
+ <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ../*[local-name()='example'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name'] or ../*[local-name()='source'] or ../*[local-name()='p']"/>
6274
6274
 
6275
6275
  <xsl:variable name="isNoteOrFnExistShowAfterTable">
6276
6276
 
@@ -6343,6 +6343,7 @@
6343
6343
  <xsl:apply-templates select="../*[local-name()='p']"/>
6344
6344
  <xsl:apply-templates select="../*[local-name()='dl']"/>
6345
6345
  <xsl:apply-templates select="../*[local-name()='note']"/>
6346
+ <xsl:apply-templates select="../*[local-name()='example']"/>
6346
6347
  <xsl:apply-templates select="../*[local-name()='source']"/>
6347
6348
 
6348
6349
  <xsl:variable name="isDisplayRowSeparator">
@@ -6351,7 +6352,7 @@
6351
6352
 
6352
6353
  <!-- horizontal row separator -->
6353
6354
  <xsl:if test="normalize-space($isDisplayRowSeparator) = 'true'">
6354
- <xsl:if test="../*[local-name()='note'] and normalize-space($table_fn_block) != ''">
6355
+ <xsl:if test="(../*[local-name()='note'] or ../*[local-name()='example']) and normalize-space($table_fn_block) != ''">
6355
6356
  <fo:block-container border-top="0.5pt solid black" padding-left="1mm" padding-right="1mm">
6356
6357
 
6357
6358
  <xsl:call-template name="setBordersTableArray"/>
@@ -6654,13 +6655,13 @@
6654
6655
  </fo:table-cell>
6655
6656
  </xsl:template> <!-- td -->
6656
6657
 
6657
- <xsl:template match="*[local-name()='table']/*[local-name()='note']" priority="2">
6658
+ <xsl:template match="*[local-name()='table']/*[local-name()='note' or local-name() = 'example']" priority="2">
6658
6659
 
6659
6660
  <fo:block xsl:use-attribute-sets="table-note-style">
6660
6661
 
6661
6662
  <xsl:call-template name="refine_table-note-style"/>
6662
6663
 
6663
- <!-- Table's note name (NOTE, for example) -->
6664
+ <!-- Table's note/example name (NOTE, for example) -->
6664
6665
  <fo:inline xsl:use-attribute-sets="table-note-name-style">
6665
6666
 
6666
6667
  <xsl:call-template name="refine_table-note-name-style"/>
@@ -6674,7 +6675,7 @@
6674
6675
 
6675
6676
  </xsl:template> <!-- table/note -->
6676
6677
 
6677
- <xsl:template match="*[local-name()='table']/*[local-name()='note']/*[local-name()='p']" priority="2">
6678
+ <xsl:template match="*[local-name()='table']/*[local-name()='note' or local-name()='example']/*[local-name()='p']" priority="2">
6678
6679
  <xsl:apply-templates/>
6679
6680
  </xsl:template>
6680
6681
 
@@ -7740,10 +7741,15 @@
7740
7741
  <!-- ========================= -->
7741
7742
  <xsl:template match="*[local-name()='em']">
7742
7743
  <fo:inline font-style="italic">
7744
+ <xsl:call-template name="refine_italic_style"/>
7743
7745
  <xsl:apply-templates/>
7744
7746
  </fo:inline>
7745
7747
  </xsl:template>
7746
7748
 
7749
+ <xsl:template name="refine_italic_style">
7750
+
7751
+ </xsl:template>
7752
+
7747
7753
  <xsl:template match="*[local-name()='strong'] | *[local-name()='b']">
7748
7754
  <xsl:param name="split_keep-within-line"/>
7749
7755
  <fo:inline font-weight="bold">
@@ -11610,6 +11616,12 @@
11610
11616
 
11611
11617
  </xsl:template>
11612
11618
 
11619
+ <xsl:template match="*[local-name() = 'table']/*[local-name() = 'example']/*[local-name() = 'name']">
11620
+ <fo:inline xsl:use-attribute-sets="example-name-style">
11621
+ <xsl:apply-templates/>
11622
+ </fo:inline>
11623
+ </xsl:template>
11624
+
11613
11625
  <xsl:template match="*[local-name() = 'example']/*[local-name() = 'p']">
11614
11626
  <xsl:param name="fo_element">block</xsl:param>
11615
11627
 
@@ -12132,9 +12144,10 @@
12132
12144
  <label level="2">—</label><!-- em dash -->
12133
12145
  </xsl:when>
12134
12146
  <xsl:otherwise>
12135
- <label level="1">–</label>
12147
+ <label>–</label>
12148
+ <!-- <label level="1">–</label>
12136
12149
  <label level="2">•</label>
12137
- <label level="3" font-size="75%">o</label> <!-- white circle -->
12150
+ <label level="3" font-size="75%">o</label> --> <!-- white circle -->
12138
12151
  </xsl:otherwise>
12139
12152
  </xsl:choose>
12140
12153
 
@@ -12182,6 +12195,9 @@
12182
12195
  <xsl:otherwise><xsl:call-template name="setULLabel"/></xsl:otherwise>
12183
12196
  </xsl:choose>
12184
12197
  </xsl:when>
12198
+ <xsl:when test="local-name(..) = 'ol' and @label"> <!-- for ordered lists 'ol', and if there is @label, for instance label="1.1.2" -->
12199
+ <xsl:value-of select="@label"/>
12200
+ </xsl:when>
12185
12201
  <xsl:otherwise> <!-- for ordered lists 'ol' -->
12186
12202
 
12187
12203
  <!-- Example: for BSI <?list-start 2?> -->
@@ -12239,10 +12255,10 @@
12239
12255
  <xsl:when test="$type = 'arabic'">
12240
12256
  1)
12241
12257
  </xsl:when>
12242
- <xsl:when test="$type = 'alphabet'">
12258
+ <xsl:when test="$type = 'alphabet' or $type = 'alphabetic'">
12243
12259
  a)
12244
12260
  </xsl:when>
12245
- <xsl:when test="$type = 'alphabet_upper'">
12261
+ <xsl:when test="$type = 'alphabet_upper' or $type = 'alphabetic_upper'">
12246
12262
  A.
12247
12263
  </xsl:when>
12248
12264
  <xsl:when test="$type = 'roman'">
@@ -5724,7 +5724,7 @@
5724
5724
  </xsl:attribute>
5725
5725
  </xsl:for-each>
5726
5726
 
5727
- <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name'] or ./*[local-name()='source']"/>
5727
+ <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or ./*[local-name()='example'] or .//*[local-name()='fn'][local-name(..) != 'name'] or ./*[local-name()='source']"/>
5728
5728
  <xsl:if test="$isNoteOrFnExist = 'true'">
5729
5729
  <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
5730
5730
  </xsl:if>
@@ -5768,7 +5768,7 @@
5768
5768
  <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
5769
5769
  </xsl:when>
5770
5770
  <xsl:otherwise>
5771
- <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note') and not(local-name() = 'dl') and not(local-name() = 'source') and not(local-name() = 'p') and not(local-name() = 'thead') and not(local-name() = 'tfoot')]"/> <!-- process all table' elements, except name, header, footer, note, source and dl which render separaterely -->
5771
+ <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note') and not(local-name() = 'example') and not(local-name() = 'dl') and not(local-name() = 'source') and not(local-name() = 'p') and not(local-name() = 'thead') and not(local-name() = 'tfoot')]"/> <!-- process all table' elements, except name, header, footer, note, source and dl which render separaterely -->
5772
5772
  </xsl:otherwise>
5773
5773
  </xsl:choose>
5774
5774
 
@@ -6270,7 +6270,7 @@
6270
6270
  <xsl:param name="colwidths"/>
6271
6271
  <xsl:param name="colgroup"/>
6272
6272
 
6273
- <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name'] or ../*[local-name()='source'] or ../*[local-name()='p']"/>
6273
+ <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ../*[local-name()='example'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name'] or ../*[local-name()='source'] or ../*[local-name()='p']"/>
6274
6274
 
6275
6275
  <xsl:variable name="isNoteOrFnExistShowAfterTable">
6276
6276
 
@@ -6343,6 +6343,7 @@
6343
6343
  <xsl:apply-templates select="../*[local-name()='p']"/>
6344
6344
  <xsl:apply-templates select="../*[local-name()='dl']"/>
6345
6345
  <xsl:apply-templates select="../*[local-name()='note']"/>
6346
+ <xsl:apply-templates select="../*[local-name()='example']"/>
6346
6347
  <xsl:apply-templates select="../*[local-name()='source']"/>
6347
6348
 
6348
6349
  <xsl:variable name="isDisplayRowSeparator">
@@ -6351,7 +6352,7 @@
6351
6352
 
6352
6353
  <!-- horizontal row separator -->
6353
6354
  <xsl:if test="normalize-space($isDisplayRowSeparator) = 'true'">
6354
- <xsl:if test="../*[local-name()='note'] and normalize-space($table_fn_block) != ''">
6355
+ <xsl:if test="(../*[local-name()='note'] or ../*[local-name()='example']) and normalize-space($table_fn_block) != ''">
6355
6356
  <fo:block-container border-top="0.5pt solid black" padding-left="1mm" padding-right="1mm">
6356
6357
 
6357
6358
  <xsl:call-template name="setBordersTableArray"/>
@@ -6654,13 +6655,13 @@
6654
6655
  </fo:table-cell>
6655
6656
  </xsl:template> <!-- td -->
6656
6657
 
6657
- <xsl:template match="*[local-name()='table']/*[local-name()='note']" priority="2">
6658
+ <xsl:template match="*[local-name()='table']/*[local-name()='note' or local-name() = 'example']" priority="2">
6658
6659
 
6659
6660
  <fo:block xsl:use-attribute-sets="table-note-style">
6660
6661
 
6661
6662
  <xsl:call-template name="refine_table-note-style"/>
6662
6663
 
6663
- <!-- Table's note name (NOTE, for example) -->
6664
+ <!-- Table's note/example name (NOTE, for example) -->
6664
6665
  <fo:inline xsl:use-attribute-sets="table-note-name-style">
6665
6666
 
6666
6667
  <xsl:call-template name="refine_table-note-name-style"/>
@@ -6674,7 +6675,7 @@
6674
6675
 
6675
6676
  </xsl:template> <!-- table/note -->
6676
6677
 
6677
- <xsl:template match="*[local-name()='table']/*[local-name()='note']/*[local-name()='p']" priority="2">
6678
+ <xsl:template match="*[local-name()='table']/*[local-name()='note' or local-name()='example']/*[local-name()='p']" priority="2">
6678
6679
  <xsl:apply-templates/>
6679
6680
  </xsl:template>
6680
6681
 
@@ -7740,10 +7741,15 @@
7740
7741
  <!-- ========================= -->
7741
7742
  <xsl:template match="*[local-name()='em']">
7742
7743
  <fo:inline font-style="italic">
7744
+ <xsl:call-template name="refine_italic_style"/>
7743
7745
  <xsl:apply-templates/>
7744
7746
  </fo:inline>
7745
7747
  </xsl:template>
7746
7748
 
7749
+ <xsl:template name="refine_italic_style">
7750
+
7751
+ </xsl:template>
7752
+
7747
7753
  <xsl:template match="*[local-name()='strong'] | *[local-name()='b']">
7748
7754
  <xsl:param name="split_keep-within-line"/>
7749
7755
  <fo:inline font-weight="bold">
@@ -11610,6 +11616,12 @@
11610
11616
 
11611
11617
  </xsl:template>
11612
11618
 
11619
+ <xsl:template match="*[local-name() = 'table']/*[local-name() = 'example']/*[local-name() = 'name']">
11620
+ <fo:inline xsl:use-attribute-sets="example-name-style">
11621
+ <xsl:apply-templates/>
11622
+ </fo:inline>
11623
+ </xsl:template>
11624
+
11613
11625
  <xsl:template match="*[local-name() = 'example']/*[local-name() = 'p']">
11614
11626
  <xsl:param name="fo_element">block</xsl:param>
11615
11627
 
@@ -12132,9 +12144,10 @@
12132
12144
  <label level="2">—</label><!-- em dash -->
12133
12145
  </xsl:when>
12134
12146
  <xsl:otherwise>
12135
- <label level="1">–</label>
12147
+ <label>–</label>
12148
+ <!-- <label level="1">–</label>
12136
12149
  <label level="2">•</label>
12137
- <label level="3" font-size="75%">o</label> <!-- white circle -->
12150
+ <label level="3" font-size="75%">o</label> --> <!-- white circle -->
12138
12151
  </xsl:otherwise>
12139
12152
  </xsl:choose>
12140
12153
 
@@ -12182,6 +12195,9 @@
12182
12195
  <xsl:otherwise><xsl:call-template name="setULLabel"/></xsl:otherwise>
12183
12196
  </xsl:choose>
12184
12197
  </xsl:when>
12198
+ <xsl:when test="local-name(..) = 'ol' and @label"> <!-- for ordered lists 'ol', and if there is @label, for instance label="1.1.2" -->
12199
+ <xsl:value-of select="@label"/>
12200
+ </xsl:when>
12185
12201
  <xsl:otherwise> <!-- for ordered lists 'ol' -->
12186
12202
 
12187
12203
  <!-- Example: for BSI <?list-start 2?> -->
@@ -12239,10 +12255,10 @@
12239
12255
  <xsl:when test="$type = 'arabic'">
12240
12256
  1)
12241
12257
  </xsl:when>
12242
- <xsl:when test="$type = 'alphabet'">
12258
+ <xsl:when test="$type = 'alphabet' or $type = 'alphabetic'">
12243
12259
  a)
12244
12260
  </xsl:when>
12245
- <xsl:when test="$type = 'alphabet_upper'">
12261
+ <xsl:when test="$type = 'alphabet_upper' or $type = 'alphabetic_upper'">
12246
12262
  A.
12247
12263
  </xsl:when>
12248
12264
  <xsl:when test="$type = 'roman'">
@@ -236,6 +236,36 @@ module IsoDoc
236
236
  dlist["class"] = "formula_dl"
237
237
  end
238
238
 
239
+ def ol(docxml)
240
+ ol_numbering(docxml)
241
+ @xrefs.list_anchor_names(docxml.xpath(ns(@xrefs.sections_xpath)))
242
+ docxml.xpath(ns("//ol/li")).each { |f| ol_label(f) }
243
+ end
244
+
245
+ def ol_numbering(docxml)
246
+ docxml.xpath(ns("//clause | //annex | //foreword | //acknowledgements | //introduction | //preface/abstract | //appendix | //terms | //term | //definitions | //references | //colophon")).each do |_c|
247
+ (docxml.xpath(ns(".//ol")) -
248
+ docxml.xpath(ns("./clause//ol | ./appendix//ol | ./term//ol | ./terms//ol | ./definitions//ol | /references//ol | ./colophon//ol"))).each_with_index do |o, i|
249
+ ol_numbering1(o, i)
250
+ end
251
+ end
252
+ end
253
+
254
+ def ol_numbering1(elem, idx)
255
+ elem["type"] = ol_depth_rotate(elem, idx).to_s
256
+ elem.xpath(ns("./li")).each do |li|
257
+ li["id"] ||= "_#{UUIDTools::UUID.random_create}"
258
+ end
259
+ end
260
+
261
+ def ol_depth_rotate(node, idx)
262
+ depth = node.ancestors("ol").size + idx
263
+ type = :alphabet
264
+ type = :arabic if [2, 5, 8].include? depth
265
+ type = :roman if [3, 6, 9].include? depth
266
+ type
267
+ end
268
+
239
269
  include Init
240
270
  end
241
271
  end
@@ -1012,6 +1012,7 @@
1012
1012
  <ref name="del"/>
1013
1013
  <ref name="span"/>
1014
1014
  <ref name="erefstack"/>
1015
+ <ref name="date_inline"/>
1015
1016
  </choice>
1016
1017
  </define>
1017
1018
  <define name="add">
@@ -1053,6 +1054,23 @@
1053
1054
  </oneOrMore>
1054
1055
  </element>
1055
1056
  </define>
1057
+ <define name="date_inline">
1058
+ <element name="date">
1059
+ <attribute name="value"/>
1060
+ <optional>
1061
+ <attribute name="format"/>
1062
+ </optional>
1063
+ <optional>
1064
+ <attribute name="language"/>
1065
+ </optional>
1066
+ <optional>
1067
+ <attribute name="script"/>
1068
+ </optional>
1069
+ <optional>
1070
+ <attribute name="locale"/>
1071
+ </optional>
1072
+ </element>
1073
+ </define>
1056
1074
  <define name="concept">
1057
1075
  <element name="concept">
1058
1076
  <optional>
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module IEEE
3
- VERSION = "1.0.11".freeze
3
+ VERSION = "1.0.12".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-ieee
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.11
4
+ version: 1.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-05-22 00:00:00.000000000 Z
11
+ date: 2023-06-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-standoc