metanorma-iso 2.5.3 → 2.5.4

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: 30229a0ddab3a83837d4f79b713bd7fa693798e810afeeb1fcdd85169aef9921
4
- data.tar.gz: e09fbd0e70fbbe624ab4a82fb741715842e18f9a01d9e24fea986507a6b1710a
3
+ metadata.gz: 27078d397dbb62231ecac33bc066b23fe72a3f878144556b3856f54a9860201c
4
+ data.tar.gz: 75d0a641ea5a5b968b876f67392b35498273f1b574ef0ac9560444c151b4ad3b
5
5
  SHA512:
6
- metadata.gz: d34635dae39c8970d56bd3fb09c8366875c48ab705a3848ba52f3d61fb7b465788aa357ee5a31efd3a4088936fc1d46cfc3272892a8b1737ee7f0dcbbe0e2f9e
7
- data.tar.gz: 1c72a98e61841ba18ec4f63f48edf6d1f8554ebd8d88b3d5f1a7d96c907c2c87fe5e576a81ae6b3ea589cbe76ab383abe76b3e5a74052d18ef5307f7bc36693a
6
+ metadata.gz: d58426c8e269fa6da326020e37b5ddd72511b4dad56a1411c6a6510d358fd3a8ac67db48f29bcc1d50c2fa8df3f92f07a293da5c971a9a566ab2e46479c5c1a5
7
+ data.tar.gz: f3dc0240af1378db3c923ea986c15217c146ca7b869593ccb3fb2db3594cf1fc82b9593905f73bd7864cf8551765d4ac340b130e09a725b47e23f94e6c8fcde8
data/Gemfile.devel ADDED
@@ -0,0 +1,3 @@
1
+ gem "metanorma-standoc", git: "https://github.com/metanorma/metanorma-standoc", branch: "main"
2
+ gem "isodoc", git: "https://github.com/metanorma/isodoc", branch: "main"
3
+
@@ -11,6 +11,10 @@
11
11
  <p class="coverpage_docnumber">{{ edition_display | capitalize }}</p>
12
12
  {% endif %}
13
13
 
14
+ {% if correcteddate != "XXX" %}
15
+ <p class="coverpage_docnumber">{{ labels["corrected_version"] }} : {{ correcteddate }}</p>
16
+ {% endif %}
17
+
14
18
  {% if revdate %}
15
19
  <p class="coverpage_docnumber">{{ labels["date"]}}: {{ revdate }}</p>
16
20
  {% endif %}
@@ -17,6 +17,9 @@
17
17
  {% if doc_date %}
18
18
  <p class="zzCover" align="right" style='text-align:right;font-weight:normal;'><span lang="EN-GB">Date: <span style='mso-no-proof:yes'>{{ doc_date }}</span></span></p>
19
19
  {% endif %}
20
+ {% if correcteddate %}
21
+ <p class="zzCover">{{ labels["corrected_version"] }}: {{ correcteddate }}</p>
22
+ {% endif %}
20
23
 
21
24
  <p class="zzCover" style='font-weight:normal;'><span lang="EN-GB">Reference number of project: {{ docnumber_undated }}{% if draftinfo %} {{ draftinfo }}{% endif %}</span></p>
22
25
 
@@ -13,6 +13,9 @@
13
13
  {% if doc_date %}
14
14
  <p class="zzCover" align="right" style='text-align:right'><span lang="EN-GB">Date: <span style='mso-no-proof:yes'><b>{{ doc_date }}</b></span></span></p>
15
15
  {% endif %}
16
+ {% if correcteddate %}
17
+ <p class="zzCover">{{ labels["corrected_version"] }}: {{ correcteddate }}</p>
18
+ {% endif %}
16
19
 
17
20
  <p class="zzCover" style='font-weight:normal;'><span lang="EN-GB">{{ editorialgroup}}</span></p>
18
21
 
@@ -33,6 +33,10 @@ style='mso-no-proof:yes'>{{ editorialgroup }}</span></p>
33
33
  <p class="MsoNormal" align="right" style='text-align:right'><span lang="EN-GB">{{ edition_display | capitalize }}</span></p>
34
34
  {% endif %}
35
35
 
36
+ {% if correcteddate %}
37
+ <p class="MsoNormal" align="right" style='text-align:right'>{{ labels["corrected_version"] }}: {{ correcteddate }}</p>
38
+ {% endif %}
39
+
36
40
  {% if revdate %}
37
41
  <p class="MsoNormal" align="right" style='text-align:right'><span lang="EN-GB">{{ labels["date"] }}: <span style='mso-no-proof:yes'>{{ revdate }}</span></span></p>
38
42
  {% endif %}
@@ -26,6 +26,7 @@ termsrelated: Terms related to
26
26
  availablefrom: Available from
27
27
  voting_begins_on: Voting begins on
28
28
  voting_terminates_on: Voting terminates on
29
+ corrected_version: Corrected version
29
30
  multiple_and: "%1 and %2"
30
31
  multiple_or: "%1 or %2"
31
32
  doctype_dict:
@@ -25,6 +25,7 @@ termsrelated: Termes liés
25
25
  availablefrom: Disponible sur
26
26
  voting_begins_on: Le vote commence le
27
27
  voting_terminates_on: Le vote se termine le
28
+ corrected_version: Version corrigée
28
29
  doctype_dict:
29
30
  international-standard: Norme internationale
30
31
  technical-specification: Spécification technique
@@ -26,6 +26,7 @@ termsrelated: Термины, связанные
26
26
  availablefrom: Доступна с
27
27
  voting_begins_on: Голосование начинается в
28
28
  voting_terminates_on: Голосование заканчивается в
29
+ corrected_version: Исправленная версия
29
30
  doctype_dict:
30
31
  international-standard: Международный Стандарт
31
32
  technical-specification: Техническая Спецификация
@@ -23,6 +23,7 @@ termsrelated: 相关术语
23
23
  availablefrom: 可从
24
24
  voting_begins_on: 投票开始于
25
25
  voting_terminates_on: 投票终止于
26
+ corrected_version: 修正版本
26
27
  doctype_dict:
27
28
  international-standard: 国际标准
28
29
  technical-specification: 技术规格
@@ -51,12 +51,12 @@ module IsoDoc
51
51
  elsif /\p{Zs}/.match?(i) then i
52
52
  else std_docid_semantic_full(i)
53
53
  end
54
- end.join
54
+ end.join.gsub(%r{</span>(\p{Zs}+)<}, "\\1</span><")
55
55
  end
56
56
 
57
57
  def std_docid_semantic_full(ident)
58
58
  ident
59
- .sub(/^([^0-9]+)(\s|$)/, "<span class='stdpublisher'>\\1</span>\\2")
59
+ .sub(/^([^0-9]+)(\p{Zs}|$)/, "<span class='stdpublisher'>\\1</span>\\2")
60
60
  .sub(/([0-9]+)/, "<span class='stddocNumber'>\\1</span>")
61
61
  .sub(/-([0-9]+)/, "-<span class='stddocPartNumber'>\\1</span>")
62
62
  .sub(/:([0-9]{4})(?!\d)/, ":<span class='stdyear'>\\1</span>")
@@ -919,6 +919,18 @@
919
919
  </fo:block>
920
920
  </fo:block>
921
921
  </xsl:if>
922
+ <xsl:variable name="date_corrected" select="normalize-space(/iso:iso-standard/iso:bibdata/iso:date[@type = 'corrected'])"/>
923
+ <xsl:if test="$date_corrected != ''">
924
+ <fo:block text-align="right" font-size="9.5pt">
925
+ <xsl:value-of select="$linebreak"/>
926
+ <xsl:value-of select="$linebreak"/>
927
+ <xsl:call-template name="getLocalizedString">
928
+ <xsl:with-param name="key">corrected_version</xsl:with-param>
929
+ </xsl:call-template>
930
+ <xsl:value-of select="$linebreak"/>
931
+ <xsl:value-of select="$date_corrected"/>
932
+ </fo:block>
933
+ </xsl:if>
922
934
  </fo:table-cell>
923
935
  </fo:table-row>
924
936
  <fo:table-row height="17mm" role="SKIP">
@@ -6867,8 +6879,17 @@
6867
6879
  <xsl:variable name="styles_">
6868
6880
  <xsl:for-each select="xalan:nodeset($styles__)/item">
6869
6881
  <xsl:variable name="key" select="normalize-space(substring-before(., ':'))"/>
6870
- <xsl:variable name="value" select="normalize-space(substring-after(translate(.,$quot,''), ':'))"/>
6871
- <xsl:if test="$key = 'font-family' or $key = 'color'">
6882
+ <xsl:variable name="value_" select="normalize-space(substring-after(translate(.,$quot,''), ':'))"/>
6883
+ <xsl:variable name="value">
6884
+ <xsl:choose>
6885
+ <!-- if font-size is digits only -->
6886
+ <xsl:when test="$key = 'font-size' and translate($value_, '0123456789', '') = ''"><xsl:value-of select="$value_"/>pt</xsl:when>
6887
+ <xsl:otherwise>
6888
+ <xsl:value-of select="$value_"/>
6889
+ </xsl:otherwise>
6890
+ </xsl:choose>
6891
+ </xsl:variable>
6892
+ <xsl:if test="$key = 'font-family' or $key = 'font-size' or $key = 'color'">
6872
6893
  <style name="{$key}"><xsl:value-of select="$value"/></style>
6873
6894
  </xsl:if>
6874
6895
  </xsl:for-each>
@@ -919,6 +919,18 @@
919
919
  </fo:block>
920
920
  </fo:block>
921
921
  </xsl:if>
922
+ <xsl:variable name="date_corrected" select="normalize-space(/iso:iso-standard/iso:bibdata/iso:date[@type = 'corrected'])"/>
923
+ <xsl:if test="$date_corrected != ''">
924
+ <fo:block text-align="right" font-size="9.5pt">
925
+ <xsl:value-of select="$linebreak"/>
926
+ <xsl:value-of select="$linebreak"/>
927
+ <xsl:call-template name="getLocalizedString">
928
+ <xsl:with-param name="key">corrected_version</xsl:with-param>
929
+ </xsl:call-template>
930
+ <xsl:value-of select="$linebreak"/>
931
+ <xsl:value-of select="$date_corrected"/>
932
+ </fo:block>
933
+ </xsl:if>
922
934
  </fo:table-cell>
923
935
  </fo:table-row>
924
936
  <fo:table-row height="17mm" role="SKIP">
@@ -6867,8 +6879,17 @@
6867
6879
  <xsl:variable name="styles_">
6868
6880
  <xsl:for-each select="xalan:nodeset($styles__)/item">
6869
6881
  <xsl:variable name="key" select="normalize-space(substring-before(., ':'))"/>
6870
- <xsl:variable name="value" select="normalize-space(substring-after(translate(.,$quot,''), ':'))"/>
6871
- <xsl:if test="$key = 'font-family' or $key = 'color'">
6882
+ <xsl:variable name="value_" select="normalize-space(substring-after(translate(.,$quot,''), ':'))"/>
6883
+ <xsl:variable name="value">
6884
+ <xsl:choose>
6885
+ <!-- if font-size is digits only -->
6886
+ <xsl:when test="$key = 'font-size' and translate($value_, '0123456789', '') = ''"><xsl:value-of select="$value_"/>pt</xsl:when>
6887
+ <xsl:otherwise>
6888
+ <xsl:value-of select="$value_"/>
6889
+ </xsl:otherwise>
6890
+ </xsl:choose>
6891
+ </xsl:variable>
6892
+ <xsl:if test="$key = 'font-family' or $key = 'font-size' or $key = 'color'">
6872
6893
  <style name="{$key}"><xsl:value-of select="$value"/></style>
6873
6894
  </xsl:if>
6874
6895
  </xsl:for-each>
@@ -1,127 +1,8 @@
1
+ require_relative "word_dis_styles"
2
+
1
3
  module IsoDoc
2
4
  module Iso
3
5
  class WordDISConvert < WordConvert
4
- STYLESMAP = {
5
- AltTerms: "AdmittedTerm",
6
- TableFootnote: "Tablefootnote",
7
- formula: "Formula",
8
- note: "Note",
9
- example: "Example",
10
- admonition: "Admonition",
11
- admonitiontitle: "AdmonitionTitle",
12
- sourcetitle: "SourceTitle",
13
- TableTitle: "Tabletitle",
14
- titlepagesbhead: "TablePageSubhead",
15
- NormRef: "RefNorm",
16
- Biblio: "BiblioEntry",
17
- MsoNormal: "MsoBodyText",
18
- FigureTitle: "Figuretitle",
19
- zzwarning: "zzWarning",
20
- zzwarninghdr: "zzWarningHdr",
21
- quoteattribution: "QuoteAttribution",
22
- Sourcecode: "Code",
23
- zzSTDTitle1: "zzSTDTitle",
24
- zzSTDTitle2: "zzSTDTitle",
25
- zzCopyright1: "zzCopyright",
26
- }.freeze
27
-
28
- def new_styles(docxml)
29
- STYLESMAP.each do |k, v|
30
- docxml.xpath("//*[@class = '#{k}']").each { |s| s["class"] = v }
31
- end
32
- docxml.xpath("//h1[@class = 'ForewordTitle' or @class = 'IntroTitle']")
33
- .each { |h| h.name = "p" }
34
- dis_styles1(docxml)
35
- docxml.xpath("//p[not(@class)]").each { |p| p["class"] = "MsoBodyText" }
36
- end
37
-
38
- def sourcecode_style
39
- "Code"
40
- end
41
-
42
- def dis_styles1(docxml)
43
- amd_style(docxml)
44
- middle_title_style(docxml)
45
- code_style(docxml)
46
- figure_style(docxml)
47
- formula_style(docxml)
48
- note_style(docxml)
49
- example_style(docxml)
50
- dis_style_interactions(docxml)
51
- quote_style(docxml)
52
- stripbgcolor(docxml)
53
- end
54
-
55
- def stripbgcolor(docxml)
56
- @bgstripcolor == "true" or return
57
- %w(aucollab audeg aufname aurole ausuffix ausurname bibarticle bibetal
58
- bibfname bibfpage bibissue bibjournal biblpage bibnumber
59
- biborganization bibsuppl bibsurname biburl bibvolume bibyear
60
- citebib citeen citefig citefn citetbl bibextlink citeeq citetfn
61
- auprefix citeapp citesec stddocNumber stddocPartNumber
62
- stddocTitle aumember stdfootnote stdpublisher stdsection stdyear
63
- stddocumentType bibalt-year bibbook bbichapterno bibchaptertitle
64
- bibed-etal bibed-fname bibeditionno bibed-organization bibed-suffix
65
- bibed-surname bibinstitution bibisbn biblocation bibpagecount
66
- bibpatent bibpublisher bibreportnum bibschool bibseries bibseriesno
67
- bibtrans stdsuppl citesection).each do |t|
68
- docxml.xpath("//span[@class = '#{t}']").each do |s|
69
- s["style"] ||= ""
70
- s["style"] = "mso-pattern:none;#{s['style']}"
71
- end
72
- end
73
- end
74
-
75
- def middle_title_style(docxml)
76
- docxml.xpath("//p[@class = 'zzSTDTitle2']").each do |p|
77
- p1 = p.previous_element && p1.name == p &&
78
- p1["class"] = "zzSTDTitle2" or next
79
- p1 << " #{p.remove.children.to_xml}"
80
- end
81
- end
82
-
83
- def dis_style_interactions(docxml)
84
- docxml.xpath("//p[@class = 'Code' or @class = 'Code-' or " \
85
- "@class = 'Code--']" \
86
- "[following::p[@class = 'Examplecontinued']]").each do |p|
87
- p["style"] ||= ""
88
- p["style"] = "margin-bottom:12pt;#{p['style']}"
89
- end
90
- end
91
-
92
- def amd_style(docxml)
93
- return unless @meta.get[:doctype] == "Amendment"
94
-
95
- docxml.xpath("//div[@class = 'WordSection3']//h1").each do |h|
96
- h.name = "p"
97
- h["style"] = "font-style:italic;page-break-after:avoid;"
98
- end
99
- end
100
-
101
- def para_style_change(div, class1, class2)
102
- s = class1 ? "@class = '#{class1}'" : "not(@class)"
103
- div.xpath(".//p[#{s}]").each do |p|
104
- p["class"] = class2
105
- end
106
- end
107
-
108
- def quote_style1(div)
109
- para_style_change(div, nil, "BodyTextindent1")
110
- para_style_change(div, "Code-", "Code--")
111
- para_style_change(div, "Code", "Code-")
112
- if div["class"] != "Example"
113
- para_style_change(div, "Example", "Exampleindent")
114
- para_style_change(div, "Examplecontinued", "Exampleindentcontinued")
115
- end
116
- if div["class"] != "Note"
117
- para_style_change(div, "Note", "Noteindent")
118
- para_style_change(div, "Notecontinued", "Noteindentcontinued")
119
- end
120
- div.xpath(".//table[@class = 'dl']").each do |t|
121
- t["style"] = "margin-left: 1cm;"
122
- end
123
- end
124
-
125
6
  def remove_note_label(doc)
126
7
  doc.xpath("//span[@class = 'note_label' or @class = 'example_label']")
127
8
  .each do |s|
@@ -129,83 +10,6 @@ module IsoDoc
129
10
  end
130
11
  end
131
12
 
132
- def note_style(docxml)
133
- remove_note_label(docxml)
134
- note_continued_style(docxml)
135
- end
136
-
137
- def example_style(docxml)
138
- example_continued_style(docxml)
139
- end
140
-
141
- def example_continued_style(docxml)
142
- docxml.xpath("//div[@class = 'Example']").each do |d|
143
- d.xpath("./p").each_with_index do |p, i|
144
- next if p["class"] && p["class"] != "Example"
145
-
146
- p["class"] = (i.zero? ? "Example" : "Examplecontinued")
147
- end
148
- end
149
- end
150
-
151
- def note_continued_style(docxml)
152
- docxml.xpath("//div[@class = 'Note']").each do |d|
153
- d.xpath("./p").each_with_index do |p, i|
154
- next if p["class"] && p["class"] != "Note"
155
-
156
- p["class"] = (i.zero? ? "Note" : "Notecontinued")
157
- end
158
- end
159
- end
160
-
161
- FIGURE_NESTED_STYLES =
162
- { Note: "Figurenote", example: "Figureexample" }.freeze
163
-
164
- def figure_style(docxml)
165
- docxml.xpath("//div[@class = 'figure']").each do |f|
166
- FIGURE_NESTED_STYLES.each do |k, v|
167
- f.xpath(".//*[@class = '#{k}']").each { |n| n["class"] = v }
168
- end
169
- f.xpath("./img").each do |i|
170
- i.replace("<p class='FigureGraphic'>#{i.to_xml}</p>")
171
- end
172
- end
173
- end
174
-
175
- def formula_style(docxml)
176
- docxml.xpath("//div[@class = 'Formula']").each do |f|
177
- f.xpath(".//p[not(@class)]").each do |p|
178
- p["class"] = "Formula"
179
- end
180
- end
181
- end
182
-
183
- def code_style(doc)
184
- span_style((doc.xpath("//tt//b") - doc.xpath("//tt//i//b")),
185
- "ISOCodebold")
186
- span_style((doc.xpath("//tt//i") - doc.xpath("//tt//b//i")),
187
- "ISOCodeitalic")
188
- span_style((doc.xpath("//b//tt") - doc.xpath("//b//i//tt")),
189
- "ISOCodebold")
190
- span_style((doc.xpath("//i//tt") - doc.xpath("//i//b//tt")),
191
- "ISOCodeitalic")
192
- span_style(doc.xpath("//tt"), "ISOCode")
193
- end
194
-
195
- def span_style(xpath, style)
196
- xpath.each do |elem|
197
- elem.name = "span"
198
- elem["class"] = style
199
- end
200
- end
201
-
202
- def word_annex_cleanup1(docxml, lvl)
203
- docxml.xpath("//h#{lvl}[ancestor::*[@class = 'Section3']]").each do |h2|
204
- h2.name = "p"
205
- h2["class"] = "a#{lvl}"
206
- end
207
- end
208
-
209
13
  def word_cleanup(docxml)
210
14
  word_table_cell_para(docxml)
211
15
  super
@@ -229,19 +33,24 @@ module IsoDoc
229
33
  end
230
34
  end
231
35
 
232
- def word_table_cell_para_style(cell)
233
- ret = cell["header"] == "true" ? "Tableheader" : "Tablebody"
234
- cell["class"] == "rouge-code" and ret = "Code"
235
- ret
236
- end
237
-
238
- def table_toc_class
239
- ["Table title", "Tabletitle", "Annex Table Title", "AnnexTableTitle"] +
240
- super
241
- end
242
-
243
- def figure_toc_class
244
- ["Figure Title", "Annex Figure Title", "AnnexFigureTitle"] + super
36
+ def stripbgcolor(docxml)
37
+ @bgstripcolor == "true" or return
38
+ %w(aucollab audeg aufname aurole ausuffix ausurname bibarticle bibetal
39
+ bibfname bibfpage bibissue bibjournal biblpage bibnumber
40
+ biborganization bibsuppl bibsurname biburl bibvolume bibyear
41
+ citebib citeen citefig citefn citetbl bibextlink citeeq citetfn
42
+ auprefix citeapp citesec stddocNumber stddocPartNumber
43
+ stddocTitle aumember stdfootnote stdpublisher stdsection stdyear
44
+ stddocumentType bibalt-year bibbook bbichapterno bibchaptertitle
45
+ bibed-etal bibed-fname bibeditionno bibed-organization bibed-suffix
46
+ bibed-surname bibinstitution bibisbn biblocation bibpagecount
47
+ bibpatent bibpublisher bibreportnum bibschool bibseries bibseriesno
48
+ bibtrans stdsuppl citesection).each do |t|
49
+ docxml.xpath("//span[@class = '#{t}']").each do |s|
50
+ s["style"] ||= ""
51
+ s["style"] = "mso-pattern:none;#{s['style']}"
52
+ end
53
+ end
245
54
  end
246
55
  end
247
56
  end
@@ -0,0 +1,233 @@
1
+ module IsoDoc
2
+ module Iso
3
+ class WordDISConvert < WordConvert
4
+ STYLESMAP = {
5
+ AltTerms: "AdmittedTerm",
6
+ TableFootnote: "Tablefootnote",
7
+ formula: "Formula",
8
+ note: "Note",
9
+ example: "Example",
10
+ admonition: "Admonition",
11
+ admonitiontitle: "AdmonitionTitle",
12
+ sourcetitle: "SourceTitle",
13
+ TableTitle: "Tabletitle",
14
+ titlepagesbhead: "TablePageSubhead",
15
+ NormRef: "RefNorm",
16
+ Biblio: "BiblioEntry",
17
+ MsoNormal: "MsoBodyText",
18
+ FigureTitle: "Figuretitle",
19
+ zzwarning: "zzWarning",
20
+ zzwarninghdr: "zzWarningHdr",
21
+ quoteattribution: "QuoteAttribution",
22
+ Sourcecode: "Code",
23
+ zzSTDTitle1: "zzSTDTitle",
24
+ zzSTDTitle2: "zzSTDTitle",
25
+ zzCopyright1: "zzCopyright",
26
+ }.freeze
27
+
28
+ def new_styles(docxml)
29
+ STYLESMAP.each do |k, v|
30
+ docxml.xpath("//*[@class = '#{k}']").each { |s| s["class"] = v }
31
+ end
32
+ docxml.xpath("//h1[@class = 'ForewordTitle' or @class = 'IntroTitle']")
33
+ .each { |h| h.name = "p" }
34
+ dis_styles1(docxml)
35
+ docxml.xpath("//p[not(@class)]").each { |p| p["class"] = "MsoBodyText" }
36
+ stripbgcolor(docxml)
37
+ end
38
+
39
+ def sourcecode_style
40
+ "Code"
41
+ end
42
+
43
+ def dis_styles1(docxml)
44
+ amd_style(docxml)
45
+ middle_title_style(docxml)
46
+ code_style(docxml)
47
+ figure_style(docxml)
48
+ formula_style(docxml)
49
+ note_style(docxml)
50
+ example_style(docxml)
51
+ dis_style_interactions(docxml)
52
+ quote_style(docxml)
53
+ smaller_code_style(docxml)
54
+ end
55
+
56
+ def middle_title_style(docxml)
57
+ docxml.xpath("//p[@class = 'zzSTDTitle2']").each do |p|
58
+ p1 = p.previous_element && p1.name == p &&
59
+ p1["class"] = "zzSTDTitle2" or next
60
+ p1 << " #{p.remove.children.to_xml}"
61
+ end
62
+ end
63
+
64
+ def dis_style_interactions(docxml)
65
+ docxml.xpath("//p[@class = 'Code' or @class = 'Code-' or " \
66
+ "@class = 'Code--']" \
67
+ "[following::p[@class = 'Examplecontinued']]").each do |p|
68
+ p["style"] ||= ""
69
+ p["style"] = "margin-bottom:12pt;#{p['style']}"
70
+ end
71
+ end
72
+
73
+ def amd_style(docxml)
74
+ @meta.get[:doctype] == "Amendment" or return
75
+ docxml.xpath("//div[@class = 'WordSection3']//h1").each do |h|
76
+ h.name = "p"
77
+ h["style"] = "font-style:italic;page-break-after:avoid;"
78
+ end
79
+ end
80
+
81
+ def para_style_change(div, class1, class2)
82
+ s = class1 ? "@class = '#{class1}'" : "not(@class)"
83
+ div.xpath(".//p[#{s}]").each do |p|
84
+ p["class"] = class2
85
+ end
86
+ end
87
+
88
+ def quote_style1(div)
89
+ para_style_change(div, nil, "BodyTextindent1")
90
+ para_style_change(div, "Code-", "Code--")
91
+ para_style_change(div, "Code", "Code-")
92
+ if div["class"] != "Example"
93
+ para_style_change(div, "Example", "Exampleindent")
94
+ para_style_change(div, "Examplecontinued", "Exampleindentcontinued")
95
+ end
96
+ if div["class"] != "Note"
97
+ para_style_change(div, "Note", "Noteindent")
98
+ para_style_change(div, "Notecontinued", "Noteindentcontinued")
99
+ end
100
+ div.xpath(".//table[@class = 'dl']").each do |t|
101
+ t["style"] = "margin-left: 1cm;"
102
+ end
103
+ end
104
+
105
+ def note_style(docxml)
106
+ remove_note_label(docxml)
107
+ note_continued_style(docxml)
108
+ end
109
+
110
+ def example_style(docxml)
111
+ example_continued_style(docxml)
112
+ end
113
+
114
+ def example_continued_style(docxml)
115
+ docxml.xpath("//div[@class = 'Example']").each do |d|
116
+ d.xpath("./p").each_with_index do |p, i|
117
+ p["class"] && p["class"] != "Example" and next
118
+ p["class"] = (i.zero? ? "Example" : "Examplecontinued")
119
+ end
120
+ end
121
+ end
122
+
123
+ def note_continued_style(docxml)
124
+ docxml.xpath("//div[@class = 'Note']").each do |d|
125
+ d.xpath("./p").each_with_index do |p, i|
126
+ p["class"] && p["class"] != "Note" and next
127
+ p["class"] = (i.zero? ? "Note" : "Notecontinued")
128
+ end
129
+ end
130
+ end
131
+
132
+ FIGURE_NESTED_STYLES =
133
+ { Note: "Figurenote", example: "Figureexample" }.freeze
134
+
135
+ def figure_style(docxml)
136
+ docxml.xpath("//div[@class = 'figure']").each do |f|
137
+ FIGURE_NESTED_STYLES.each do |k, v|
138
+ f.xpath(".//*[@class = '#{k}']").each { |n| n["class"] = v }
139
+ end
140
+ f.xpath("./img").each do |i|
141
+ i.replace("<p class='FigureGraphic'>#{i.to_xml}</p>")
142
+ end
143
+ end
144
+ end
145
+
146
+ def formula_style(docxml)
147
+ docxml.xpath("//div[@class = 'Formula']").each do |f|
148
+ f.xpath(".//p[not(@class)]").each do |p|
149
+ p["class"] = "Formula"
150
+ end
151
+ end
152
+ end
153
+
154
+ def code_style(doc)
155
+ span_style((doc.xpath("//tt//b") - doc.xpath("//tt//i//b")),
156
+ "ISOCodebold")
157
+ span_style((doc.xpath("//tt//i") - doc.xpath("//tt//b//i")),
158
+ "ISOCodeitalic")
159
+ span_style((doc.xpath("//b//tt") - doc.xpath("//b//i//tt")),
160
+ "ISOCodebold")
161
+ span_style((doc.xpath("//i//tt") - doc.xpath("//i//b//tt")),
162
+ "ISOCodeitalic")
163
+ span_style(doc.xpath("//tt"), "ISOCode")
164
+ end
165
+
166
+ def span_style(xpath, style)
167
+ xpath.each do |elem|
168
+ elem.name = "span"
169
+ elem["class"] = style
170
+ end
171
+ end
172
+
173
+ def smaller_code_style(doc)
174
+ smaller_code_style_names(doc)
175
+ smaller_code_style_names2spans(doc)
176
+ end
177
+
178
+ # TODO read $smallerfonsize from CSS definitions
179
+ SMALL_FONT_CLASSES =
180
+ %w(pseudocode Note tablefootnote figdl MsoISOTable MsoTableGrid
181
+ TableISO Example Notecontinued Noteindent Noteindentcontinued
182
+ ListNumber5- ListContinue5- BodyTextIndent22 BodyTextIndent32
183
+ Exampleindent2 Exampleindent2continued Noteindent2continued
184
+ Noteindent2 example_label note_label Tablebody MsoNormalTable).freeze
185
+
186
+ INLINE_CODE_CLASSES = %w(ISOCodebold ISOCodeitalic ISOCode).freeze
187
+
188
+ def smaller_code_style_names(doc)
189
+ klass = SMALL_FONT_CLASSES.map { |x| "@class = '#{x}'" }.join(" or ")
190
+ doc.xpath("//*[#{klass}]") - doc.xpath("//*[#{klass}]//*[#{klass}]")
191
+ .each do |d|
192
+ INLINE_CODE_CLASSES.each do |n|
193
+ d.xpath(".//span[@class = '#{n}']").each do |s|
194
+ s["class"] += "-"
195
+ end
196
+ end
197
+ end
198
+ end
199
+
200
+ def smaller_code_style_names2spans(doc)
201
+ INLINE_CODE_CLASSES.each do |n|
202
+ doc.xpath("//span[@class = '#{n}-']").each do |s|
203
+ s["class"] = n
204
+ s.children =
205
+ "<span style='font-size: 9pt;'>#{s.children.to_xml}</span>"
206
+ end
207
+ end
208
+ end
209
+
210
+ def word_annex_cleanup1(docxml, lvl)
211
+ docxml.xpath("//h#{lvl}[ancestor::*[@class = 'Section3']]").each do |h2|
212
+ h2.name = "p"
213
+ h2["class"] = "a#{lvl}"
214
+ end
215
+ end
216
+
217
+ def word_table_cell_para_style(cell)
218
+ ret = cell["header"] == "true" ? "Tableheader" : "Tablebody"
219
+ cell["class"] == "rouge-code" and ret = "Code"
220
+ ret
221
+ end
222
+
223
+ def table_toc_class
224
+ ["Table title", "Tabletitle", "Annex Table Title", "AnnexTableTitle"] +
225
+ super
226
+ end
227
+
228
+ def figure_toc_class
229
+ ["Figure Title", "Annex Figure Title", "AnnexFigureTitle"] + super
230
+ end
231
+ end
232
+ end
233
+ end
@@ -7,10 +7,9 @@ module IsoDoc
7
7
  clause.at(ns("./clause")) and
8
8
  @anchors[clause["id"]] = { label: nil, level: 1, type: "clause",
9
9
  xref: clause.at(ns("./title"))&.text }
10
- i = Counter.new
10
+ i = Counter.new(0, prefix: "0.")
11
11
  clause.xpath(ns("./clause")).each do |c|
12
- i.increment(c)
13
- section_names1(c, "0.#{i.print}", 2)
12
+ section_names1(c, i.increment(c).print, 2)
14
13
  end
15
14
  end
16
15
 
@@ -27,10 +26,9 @@ module IsoDoc
27
26
  anchor_struct(i.print, nil, @labels["appendix"],
28
27
  "clause").merge(level: 2, subtype: "annex",
29
28
  container: clause["id"])
30
- j = Counter.new
29
+ j = Counter.new(0, prefix: "#{i.print}.")
31
30
  c.xpath(ns("./clause | ./references")).each do |c1|
32
- j.increment(c1)
33
- lbl = "#{@labels['appendix']} #{i.print}.#{j.print}"
31
+ lbl = "#{@labels['appendix']} #{j.increment(c1).print}"
34
32
  appendix_names1(c1, l10n(lbl), 3, clause["id"])
35
33
  end
36
34
  end
@@ -41,32 +39,29 @@ module IsoDoc
41
39
  def section_names1(clause, num, level)
42
40
  @anchors[clause["id"]] =
43
41
  { label: num, level: level, xref: num, subtype: "clause" }
44
- i = Counter.new
42
+ i = Counter.new(0, prefix: "#{num}.")
45
43
  clause.xpath(ns("./clause | ./terms | ./term | ./definitions | " \
46
44
  "./references"))
47
45
  .each do |c|
48
- i.increment(c)
49
- section_names1(c, "#{num}.#{i.print}", level + 1)
46
+ section_names1(c, i.increment(c).print, level + 1)
50
47
  end
51
48
  end
52
49
 
53
50
  def annex_names1(clause, num, level)
54
51
  @anchors[clause["id"]] = { label: num, xref: num, level: level,
55
52
  subtype: "annex" }
56
- i = Counter.new
53
+ i = Counter.new(0, prefix: "#{num}.")
57
54
  clause.xpath(ns("./clause | ./references")).each do |c|
58
- i.increment(c)
59
- annex_names1(c, "#{num}.#{i.print}", level + 1)
55
+ annex_names1(c, i.increment(c).print, level + 1)
60
56
  end
61
57
  end
62
58
 
63
59
  def appendix_names1(clause, num, level, container)
64
60
  @anchors[clause["id"]] = { label: num, xref: num, level: level,
65
61
  container: container }
66
- i = Counter.new
62
+ i = Counter.new(0, prefix: "#{num}.")
67
63
  clause.xpath(ns("./clause | ./references")).each do |c|
68
- i.increment(c)
69
- appendix_names1(c, "#{num}.#{i.print}", level + 1, container)
64
+ appendix_names1(c, i.increment(c).print, level + 1, container)
70
65
  end
71
66
  end
72
67
 
@@ -914,44 +914,47 @@
914
914
  -->
915
915
  <define name="image">
916
916
  <element name="image">
917
- <attribute name="id">
918
- <data type="ID"/>
917
+ <ref name="Image"/>
918
+ </element>
919
+ </define>
920
+ <define name="Image">
921
+ <attribute name="id">
922
+ <data type="ID"/>
923
+ </attribute>
924
+ <attribute name="src">
925
+ <data type="anyURI"/>
926
+ </attribute>
927
+ <attribute name="mimetype"/>
928
+ <optional>
929
+ <attribute name="filename"/>
930
+ </optional>
931
+ <optional>
932
+ <attribute name="width">
933
+ <choice>
934
+ <data type="int"/>
935
+ <value>auto</value>
936
+ </choice>
919
937
  </attribute>
920
- <attribute name="src">
938
+ </optional>
939
+ <optional>
940
+ <attribute name="height">
941
+ <choice>
942
+ <data type="int"/>
943
+ <value>auto</value>
944
+ </choice>
945
+ </attribute>
946
+ </optional>
947
+ <optional>
948
+ <attribute name="alt"/>
949
+ </optional>
950
+ <optional>
951
+ <attribute name="title"/>
952
+ </optional>
953
+ <optional>
954
+ <attribute name="longdesc">
921
955
  <data type="anyURI"/>
922
956
  </attribute>
923
- <attribute name="mimetype"/>
924
- <optional>
925
- <attribute name="filename"/>
926
- </optional>
927
- <optional>
928
- <attribute name="width">
929
- <choice>
930
- <data type="int"/>
931
- <value>auto</value>
932
- </choice>
933
- </attribute>
934
- </optional>
935
- <optional>
936
- <attribute name="height">
937
- <choice>
938
- <data type="int"/>
939
- <value>auto</value>
940
- </choice>
941
- </attribute>
942
- </optional>
943
- <optional>
944
- <attribute name="alt"/>
945
- </optional>
946
- <optional>
947
- <attribute name="title"/>
948
- </optional>
949
- <optional>
950
- <attribute name="longdesc">
951
- <data type="anyURI"/>
952
- </attribute>
953
- </optional>
954
- </element>
957
+ </optional>
955
958
  </define>
956
959
  <define name="video">
957
960
  <element name="video">
@@ -348,6 +348,9 @@
348
348
  <zeroOrMore>
349
349
  <ref name="contact"/>
350
350
  </zeroOrMore>
351
+ <optional>
352
+ <ref name="logo"/>
353
+ </optional>
351
354
  </element>
352
355
  </define>
353
356
  <define name="orgname">
@@ -366,6 +369,11 @@
366
369
  </choice>
367
370
  </element>
368
371
  </define>
372
+ <define name="logo">
373
+ <element name="logo">
374
+ <ref name="image"/>
375
+ </element>
376
+ </define>
369
377
  <define name="NameWithVariants">
370
378
  <element name="primary">
371
379
  <ref name="LocalizedString"/>
@@ -942,6 +950,7 @@
942
950
  <value>obsoleted</value>
943
951
  <value>confirmed</value>
944
952
  <value>updated</value>
953
+ <value>corrected</value>
945
954
  <value>issued</value>
946
955
  <value>transmitted</value>
947
956
  <value>copied</value>
@@ -17,7 +17,7 @@
17
17
  these elements; we just want one namespace for any child grammars
18
18
  of this.
19
19
  -->
20
- <!-- VERSION v1.2.6 -->
20
+ <!-- VERSION v1.2.8 -->
21
21
  <grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
22
22
  <include href="reqt.rng"/>
23
23
  <include href="basicdoc.rng">
@@ -1054,6 +1054,17 @@
1054
1054
  <ref name="date_inline"/>
1055
1055
  </choice>
1056
1056
  </define>
1057
+ <define name="PureTextElement" combine="choice">
1058
+ <ref name="passthrough_inline"/>
1059
+ </define>
1060
+ <define name="passthrough_inline">
1061
+ <element name="passthrough">
1062
+ <optional>
1063
+ <attribute name="formats"/>
1064
+ </optional>
1065
+ <text/>
1066
+ </element>
1067
+ </define>
1057
1068
  <define name="add">
1058
1069
  <element name="add">
1059
1070
  <choice>
@@ -1092,6 +1103,9 @@
1092
1103
  <optional>
1093
1104
  <attribute name="style"/>
1094
1105
  </optional>
1106
+ <optional>
1107
+ <attribute name="custom-charset"/>
1108
+ </optional>
1095
1109
  <oneOrMore>
1096
1110
  <ref name="TextElement"/>
1097
1111
  </oneOrMore>
@@ -1394,6 +1408,9 @@
1394
1408
  <optional>
1395
1409
  <attribute name="number"/>
1396
1410
  </optional>
1411
+ <optional>
1412
+ <attribute name="branch-number"/>
1413
+ </optional>
1397
1414
  <optional>
1398
1415
  <attribute name="obligation">
1399
1416
  <choice>
@@ -1617,6 +1634,9 @@
1617
1634
  <optional>
1618
1635
  <attribute name="number"/>
1619
1636
  </optional>
1637
+ <optional>
1638
+ <attribute name="branch-number"/>
1639
+ </optional>
1620
1640
  <optional>
1621
1641
  <attribute name="type"/>
1622
1642
  </optional>
@@ -1668,6 +1688,9 @@
1668
1688
  <optional>
1669
1689
  <attribute name="number"/>
1670
1690
  </optional>
1691
+ <optional>
1692
+ <attribute name="branch-number"/>
1693
+ </optional>
1671
1694
  <optional>
1672
1695
  <ref name="section-title"/>
1673
1696
  </optional>
@@ -1765,6 +1788,9 @@
1765
1788
  <optional>
1766
1789
  <attribute name="number"/>
1767
1790
  </optional>
1791
+ <optional>
1792
+ <attribute name="branch-number"/>
1793
+ </optional>
1768
1794
  <optional>
1769
1795
  <attribute name="obligation">
1770
1796
  <choice>
@@ -220,6 +220,9 @@
220
220
  <optional>
221
221
  <attribute name="number"/>
222
222
  </optional>
223
+ <optional>
224
+ <attribute name="branch-number"/>
225
+ </optional>
223
226
  <optional>
224
227
  <attribute name="type"/>
225
228
  </optional>
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module ISO
3
- VERSION = "2.5.3".freeze
3
+ VERSION = "2.5.4".freeze
4
4
  end
5
5
  end
@@ -32,7 +32,7 @@ Gem::Specification.new do |spec|
32
32
  spec.test_files = `git ls-files -- {spec}/*`.split("\n")
33
33
  spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
34
34
 
35
- spec.add_dependency "metanorma-standoc", "~> 2.6.0"
35
+ spec.add_dependency "metanorma-standoc", "~> 2.6.3"
36
36
  spec.add_dependency "mnconvert", "~> 1.14"
37
37
  spec.add_dependency "pubid-iso", "~> 0.6.0"
38
38
  spec.add_dependency "ruby-jing"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-iso
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.3
4
+ version: 2.5.4
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-10-23 00:00:00.000000000 Z
11
+ date: 2023-11-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-standoc
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 2.6.0
19
+ version: 2.6.3
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 2.6.0
26
+ version: 2.6.3
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: mnconvert
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -296,6 +296,7 @@ files:
296
296
  - ".rubocop.yml"
297
297
  - CODE_OF_CONDUCT.md
298
298
  - Gemfile
299
+ - Gemfile.devel
299
300
  - LICENSE
300
301
  - Makefile
301
302
  - README.adoc
@@ -361,6 +362,7 @@ files:
361
362
  - lib/isodoc/iso/word_convert.rb
362
363
  - lib/isodoc/iso/word_dis_cleanup.rb
363
364
  - lib/isodoc/iso/word_dis_convert.rb
365
+ - lib/isodoc/iso/word_dis_styles.rb
364
366
  - lib/isodoc/iso/xref.rb
365
367
  - lib/isodoc/iso/xref_section.rb
366
368
  - lib/metanorma-iso.rb