metanorma-jis 0.0.6 → 0.0.7

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: 2deb627472d547ff5755c88eccb3ed147fc90a448c9e5bd6119af4c581832070
4
- data.tar.gz: a7fb6ba59aca19da4ef1ad5cc0446df04594a59f0d52d98c737a646a99179768
3
+ metadata.gz: 574989410bb84b64ddf0f8d84a69835f2279d2127c305a1bd41176f58fb380c7
4
+ data.tar.gz: 0175b5c4a42e1a88ce815d34a88da818054fa90336a8452decc2392ecf8652c4
5
5
  SHA512:
6
- metadata.gz: 1d582ff1fd8d7bd736c7ffe34bf755c41d4e8a7a653712d1459f46c38c29a9075cb2678aed3f70e65ac799c95d7949d7c12f33eb1f23f72120a10ff26f182eca
7
- data.tar.gz: aa7135025671160bee74f3fbc51dc2edfd79d6b11bafa05fc5dae20924a918a4389871e8a0f6c8662caf7a9015466bfbd6601008b664d78520eac6ce6d5a705e
6
+ metadata.gz: 82be9f3e0d0f86c80b1ab7c8ec8fccc535a675a2213bb4491ba7ee8bcd34ac0acb2cac908963462678fa8a310cda82fef4c2d20d59f02c0d7ee62b2802b46fb3
7
+ data.tar.gz: a1bc7aa00489850f3ded8328f3cd2ce9d46438557ad6b9c977ed839806f6cec7a9ed77ab9bc5c551be6a07ff14642fb4498b60656954461178ff6c47acb45545
@@ -1011,9 +1011,19 @@
1011
1011
  <xsl:call-template name="append_add-style"/>
1012
1012
  </xsl:if>
1013
1013
 
1014
- <xsl:variable name="list_item_label">
1014
+ <xsl:variable name="list_item_label_">
1015
1015
  <xsl:call-template name="getListItemFormat"/>
1016
1016
  </xsl:variable>
1017
+
1018
+ <xsl:variable name="list_item_label">
1019
+ <xsl:choose>
1020
+ <xsl:when test="(../@type = 'arabic' or ../@type = 'alphabet' or ../@type = 'alphabetic' or ../@type = 'roman') and not(java:endsWith(java:java.lang.String.new($list_item_label_),')'))">
1021
+ <xsl:value-of select="concat($list_item_label_, ')')"/>
1022
+ </xsl:when>
1023
+ <xsl:otherwise><xsl:value-of select="$list_item_label_"/></xsl:otherwise>
1024
+ </xsl:choose>
1025
+ </xsl:variable>
1026
+
1017
1027
  <xsl:choose>
1018
1028
  <xsl:when test="contains($list_item_label, ')')">
1019
1029
  <xsl:value-of select="substring-before($list_item_label,')')"/>
@@ -3236,7 +3246,7 @@
3236
3246
  </xsl:attribute>
3237
3247
  </xsl:for-each>
3238
3248
 
3239
- <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name'] or ./*[local-name()='source']"/>
3249
+ <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or ./*[local-name()='example'] or .//*[local-name()='fn'][local-name(..) != 'name'] or ./*[local-name()='source']"/>
3240
3250
  <xsl:if test="$isNoteOrFnExist = 'true'">
3241
3251
  <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
3242
3252
  </xsl:if>
@@ -3280,7 +3290,7 @@
3280
3290
  <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
3281
3291
  </xsl:when>
3282
3292
  <xsl:otherwise>
3283
- <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 -->
3293
+ <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 -->
3284
3294
  </xsl:otherwise>
3285
3295
  </xsl:choose>
3286
3296
 
@@ -3778,7 +3788,7 @@
3778
3788
  <xsl:param name="colwidths"/>
3779
3789
  <xsl:param name="colgroup"/>
3780
3790
 
3781
- <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']"/>
3791
+ <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']"/>
3782
3792
 
3783
3793
  <xsl:variable name="isNoteOrFnExistShowAfterTable">
3784
3794
 
@@ -3851,6 +3861,7 @@
3851
3861
  <xsl:apply-templates select="../*[local-name()='p']"/>
3852
3862
  <xsl:apply-templates select="../*[local-name()='dl']"/>
3853
3863
  <xsl:apply-templates select="../*[local-name()='note']"/>
3864
+ <xsl:apply-templates select="../*[local-name()='example']"/>
3854
3865
  <xsl:apply-templates select="../*[local-name()='source']"/>
3855
3866
 
3856
3867
  <xsl:variable name="isDisplayRowSeparator">
@@ -3859,7 +3870,7 @@
3859
3870
 
3860
3871
  <!-- horizontal row separator -->
3861
3872
  <xsl:if test="normalize-space($isDisplayRowSeparator) = 'true'">
3862
- <xsl:if test="../*[local-name()='note'] and normalize-space($table_fn_block) != ''">
3873
+ <xsl:if test="(../*[local-name()='note'] or ../*[local-name()='example']) and normalize-space($table_fn_block) != ''">
3863
3874
  <fo:block-container border-top="0.5pt solid black" padding-left="1mm" padding-right="1mm">
3864
3875
 
3865
3876
  <xsl:call-template name="setBordersTableArray"/>
@@ -4120,13 +4131,13 @@
4120
4131
  </fo:table-cell>
4121
4132
  </xsl:template> <!-- td -->
4122
4133
 
4123
- <xsl:template match="*[local-name()='table']/*[local-name()='note']" priority="2">
4134
+ <xsl:template match="*[local-name()='table']/*[local-name()='note' or local-name() = 'example']" priority="2">
4124
4135
 
4125
4136
  <fo:block xsl:use-attribute-sets="table-note-style">
4126
4137
 
4127
4138
  <xsl:call-template name="refine_table-note-style"/>
4128
4139
 
4129
- <!-- Table's note name (NOTE, for example) -->
4140
+ <!-- Table's note/example name (NOTE, for example) -->
4130
4141
  <fo:inline xsl:use-attribute-sets="table-note-name-style">
4131
4142
 
4132
4143
  <xsl:call-template name="refine_table-note-name-style"/>
@@ -4140,7 +4151,7 @@
4140
4151
 
4141
4152
  </xsl:template> <!-- table/note -->
4142
4153
 
4143
- <xsl:template match="*[local-name()='table']/*[local-name()='note']/*[local-name()='p']" priority="2">
4154
+ <xsl:template match="*[local-name()='table']/*[local-name()='note' or local-name()='example']/*[local-name()='p']" priority="2">
4144
4155
  <xsl:apply-templates/>
4145
4156
  </xsl:template>
4146
4157
 
@@ -5222,10 +5233,15 @@
5222
5233
  <!-- ========================= -->
5223
5234
  <xsl:template match="*[local-name()='em']">
5224
5235
  <fo:inline font-style="italic">
5236
+ <xsl:call-template name="refine_italic_style"/>
5225
5237
  <xsl:apply-templates/>
5226
5238
  </fo:inline>
5227
5239
  </xsl:template>
5228
5240
 
5241
+ <xsl:template name="refine_italic_style">
5242
+
5243
+ </xsl:template>
5244
+
5229
5245
  <xsl:template match="*[local-name()='strong'] | *[local-name()='b']">
5230
5246
  <xsl:param name="split_keep-within-line"/>
5231
5247
  <fo:inline font-weight="bold">
@@ -9083,6 +9099,12 @@
9083
9099
 
9084
9100
  </xsl:template>
9085
9101
 
9102
+ <xsl:template match="*[local-name() = 'table']/*[local-name() = 'example']/*[local-name() = 'name']">
9103
+ <fo:inline xsl:use-attribute-sets="example-name-style">
9104
+ <xsl:apply-templates/>
9105
+ </fo:inline>
9106
+ </xsl:template>
9107
+
9086
9108
  <xsl:template match="*[local-name() = 'example']/*[local-name() = 'p']">
9087
9109
  <xsl:param name="fo_element">block</xsl:param>
9088
9110
 
@@ -9648,6 +9670,9 @@
9648
9670
  <xsl:otherwise><xsl:call-template name="setULLabel"/></xsl:otherwise>
9649
9671
  </xsl:choose>
9650
9672
  </xsl:when>
9673
+ <xsl:when test="local-name(..) = 'ol' and @label"> <!-- for ordered lists 'ol', and if there is @label, for instance label="1.1.2" -->
9674
+ <xsl:value-of select="@label"/>
9675
+ </xsl:when>
9651
9676
  <xsl:otherwise> <!-- for ordered lists 'ol' -->
9652
9677
 
9653
9678
  <!-- Example: for BSI <?list-start 2?> -->
@@ -9705,10 +9730,10 @@
9705
9730
  <xsl:when test="$type = 'arabic'">
9706
9731
  1)
9707
9732
  </xsl:when>
9708
- <xsl:when test="$type = 'alphabet'">
9733
+ <xsl:when test="$type = 'alphabet' or $type = 'alphabetic'">
9709
9734
  a)
9710
9735
  </xsl:when>
9711
- <xsl:when test="$type = 'alphabet_upper'">
9736
+ <xsl:when test="$type = 'alphabet_upper' or $type = 'alphabetic_upper'">
9712
9737
  A.
9713
9738
  </xsl:when>
9714
9739
  <xsl:when test="$type = 'roman'">
@@ -33,6 +33,12 @@ module IsoDoc
33
33
  ret
34
34
  end
35
35
 
36
+ def ol_depth(node)
37
+ depth = node.ancestors("ol").size + 1
38
+ depth == 1 and return :alphabetic
39
+ :arabic
40
+ end
41
+
36
42
  def admits(elem)
37
43
  elem.children.first.previous = @i18n.l10n("#{@i18n.admitted}: ")
38
44
  end
@@ -1,6 +1,19 @@
1
1
  module IsoDoc
2
2
  module JIS
3
3
  class Counter < IsoDoc::XrefGen::Counter
4
+ def ol_type(list, depth)
5
+ return list["type"].to_sym if list["type"]
6
+ return :alphabet if depth == 1
7
+
8
+ :arabic
9
+ end
10
+
11
+ def listlabel(_list, depth)
12
+ case depth
13
+ when 1 then (96 + @num).chr.to_s
14
+ else @num.to_s
15
+ end
16
+ end
4
17
  end
5
18
 
6
19
  class Xref < IsoDoc::Iso::Xref
@@ -53,6 +66,35 @@ module IsoDoc
53
66
  title: clause_title(clause), level: level, type: "clause",
54
67
  elem: @labels["clause"] }
55
68
  end
69
+
70
+ def list_item_anchor_names(list, list_anchor, depth, prev_label,
71
+ refer_list)
72
+ c = Counter.new(list["start"] ? list["start"].to_i - 1 : 0)
73
+ list.xpath(ns("./li")).each do |li|
74
+ bare_label, label = list_item_value(li, c, depth,
75
+ { list_anchor: list_anchor, prev_label: prev_label, refer_list: refer_list })
76
+ li["id"] and @anchors[li["id"]] =
77
+ { label: bare_label, bare_xref: "#{bare_label})",
78
+ xref: "#{label})", type: "listitem", refer_list:
79
+ refer_list, container: list_anchor[:container] }
80
+ (li.xpath(ns(".//ol")) - li.xpath(ns(".//ol//ol"))).each do |ol|
81
+ list_item_anchor_names(ol, list_anchor, depth + 1, label, false)
82
+ end
83
+ end
84
+ end
85
+
86
+ def list_item_value(entry, counter, depth, opts)
87
+ label1 = counter.increment(entry).listlabel(entry.parent, depth)
88
+ if depth > 2
89
+ base = opts[:prev_label].match(/^(.*?)([0-9.]+)$/) # a) 1.1.1
90
+ label1 = "#{base[2]}.#{label1}"
91
+ [label1, list_item_anchor_label(label1, opts[:list_anchor],
92
+ base[1].sub(/[^a-z0-9]*$/, ""), opts[:refer_list])]
93
+ else
94
+ [label1, list_item_anchor_label(label1, opts[:list_anchor], opts[:prev_label],
95
+ opts[:refer_list])]
96
+ end
97
+ end
56
98
  end
57
99
  end
58
100
  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,6 +1,6 @@
1
1
  module Metanorma
2
2
  module JIS
3
- VERSION = "0.0.6".freeze
3
+ VERSION = "0.0.7".freeze
4
4
  end
5
5
  end
6
6
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-jis
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
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-iso