metanorma-iso 2.5.2 → 2.5.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 66e717f4c41d2cda0aa92bc42985e6f12d420e9bcdb2b0410fe085bca689a549
4
- data.tar.gz: 33d5e0b9f67c9c76afcbd0feff13a81e21919c3cb48dc56524bfa34203725ae1
3
+ metadata.gz: 27078d397dbb62231ecac33bc066b23fe72a3f878144556b3856f54a9860201c
4
+ data.tar.gz: 75d0a641ea5a5b968b876f67392b35498273f1b574ef0ac9560444c151b4ad3b
5
5
  SHA512:
6
- metadata.gz: a5249f0f6147e52c1ef81b7c32a3a431a74478a7727e8bde1842e411f20d1e56311fb41755828f93dc626e94ea14b5d661a5e4fbd6a17c41619131fe1a4d60eb
7
- data.tar.gz: a97203b198a7e9baa2e28f5597f53c9cd60ab79cc0de989f5e3dcc7671d5199e9047abdf0eb0b02401d05d48317dbae45781475642275b4c15fa8a6aaf0f446d
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
+
@@ -125,8 +125,9 @@ module IsoDoc
125
125
  end
126
126
 
127
127
  def figure_name_parse(_node, div, name)
128
+ name.nil? and return
128
129
  div.p class: "FigureTitle", style: "text-align:center;" do |p|
129
- name&.children&.each { |n| parse(n, p) }
130
+ name.children.each { |n| parse(n, p) }
130
131
  end
131
132
  end
132
133
 
@@ -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: 技术规格
@@ -8,7 +8,7 @@ module IsoDoc
8
8
  def index(xml)
9
9
  if xml.at(ns("//index"))
10
10
  i = xml.at(ns("//indexsect")) ||
11
- xml.root.add_child("<indexsect #{add_id}><title>#{@i18n.index}"\
11
+ xml.root.add_child("<indexsect #{add_id}><title>#{@i18n.index}" \
12
12
  "</title></indexsect>").first
13
13
  index = sort_indexterms(xml.xpath(ns("//index")),
14
14
  xml.xpath(ns("//index-xref[@also = 'false']")),
@@ -147,7 +147,7 @@ module IsoDoc
147
147
  index2bookmark(t)
148
148
  term_hash_init(v, term, term2, term3, :xref)
149
149
  to = t["to"] ? "to='#{t['to']}' " : ""
150
- v[term][term2][term3][:xref] << "<xref target='#{t['id']}' "\
150
+ v[term][term2][term3][:xref] << "<xref target='#{t['id']}' " \
151
151
  "#{to}pagenumber='true'/>"
152
152
  end
153
153
  end
@@ -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