metanorma-iec 2.2.14 → 2.3.0

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: 0dcfbfc355ea835e896c3efa463647098bc8ad0c10d79ace8de627e15c1b8a3e
4
- data.tar.gz: '054086032be92eea2f17e511ca544c283dd2d33892a1626929da7dc918bf7d34'
3
+ metadata.gz: 6bbf4100356359c06914283c42cdc828b4af82024174d93a4d49d5a9f2b12902
4
+ data.tar.gz: 96c9f82aa720dfe3786e18737580b5634deedd70fca154442bbdab16b1620875
5
5
  SHA512:
6
- metadata.gz: 8dbca0f48f61bbcac0645919b6fb8748efa855929b6d5487b62bb8cfe254693f4e083cce53d0bdeec4a736a50d3589372321529c4a2e543ee4b24b1e2e0931fc
7
- data.tar.gz: 2e0688e57610d42458e70ca71cd3d1a90b749791d4f5261171a3981b8411c2eb9518fbab082c07e7176526b0e4ff1d66cfa5da09fdbacdc5c42da1183c55dde1
6
+ metadata.gz: a1b41a266e6b3a83a7be27392f8d0e3dcbe52767039b781b72f0a12424ee96f9ce35eb7450e6f02082b45927b044d03c1323cbaf12024f661155f3ac8a67d9f8
7
+ data.tar.gz: 370bc7e84e79e71194530fe5e9238da8ce89e55ad4babf7517bc57417268a6be5ccc443adba5859a1a3d297282a44581178691bd20d5508109bc838bef2ca6d6
@@ -15,35 +15,7 @@ module IsoDoc
15
15
  end
16
16
  end
17
17
 
18
- def middle_title(_isoxml, out)
19
- title1, title2 = middle_title_parts(out)
20
- out.p(class: "zzSTDTitle1") do |p|
21
- p.b { |b| b << title1 }
22
- end
23
- if title2
24
- out.p(class: "zzSTDTitle1") { |p| p << "&#xa0;" }
25
- out.p(class: "zzSTDTitle2") do |p|
26
- p.b { |b| b << title2 }
27
- end
28
- end
29
- out.p(class: "zzSTDTitle1") { |p| p << "&#xa0;" }
30
- end
31
-
32
- def middle_title_parts(_out)
33
- title1 = @meta.get[:doctitlemain]&.sub(/\s+$/, "")
34
- @meta.get[:doctitleintro] and
35
- title1 = "#{@meta.get[:doctitleintro]} &#x2014; #{title1}"
36
- title2 = nil
37
- if @meta.get[:doctitlepart]
38
- title1 += " &#x2014;"
39
- title2 = @meta.get[:doctitlepart]&.sub(/\s+$/, "")
40
- @meta.get[:doctitlepartlabel] and
41
- title2 = "#{@meta.get[:doctitlepartlabel]}: #{title2}"
42
- end
43
- [title1, title2]
44
- end
45
-
46
- def bibliography(isoxml, out)
18
+ def bibliography(node, out)
47
19
  return super unless @is_iev
48
20
  end
49
21
 
@@ -1350,10 +1350,13 @@
1350
1350
  <fo:block break-after="page"/>
1351
1351
  </xsl:template>
1352
1352
 
1353
- <xsl:template match="*[local-name() = 'preface' or local-name() = 'sections']/iec:p[starts-with(@class, 'zzSTDTitle')]" priority="3">
1353
+ <xsl:template match="*[local-name() = 'preface' or local-name() = 'sections']/iec:p[starts-with(@class, 'zzSTDTitle')]" priority="4">
1354
1354
  <fo:block-container font-size="12pt" text-align="center">
1355
1355
  <xsl:if test="following-sibling::*[1][not(self::iec:p[starts-with(@class, 'zzSTDTitle')])]">
1356
1356
  <xsl:attribute name="margin-bottom">18pt</xsl:attribute>
1357
+ <xsl:if test="ancestor::*[local-name() = 'sections']">
1358
+ <xsl:attribute name="margin-bottom">30pt</xsl:attribute>
1359
+ </xsl:if>
1357
1360
  </xsl:if>
1358
1361
  <fo:block>
1359
1362
  <xsl:if test="iec:strong"> <!-- title -->
@@ -1364,6 +1367,10 @@
1364
1367
  </fo:block-container>
1365
1368
  </xsl:template>
1366
1369
 
1370
+ <xsl:template match="*[local-name() = 'sections']/iec:p[@class = 'zzSTDTitle1']//text()" priority="4">
1371
+ <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(.))"/>
1372
+ </xsl:template>
1373
+
1367
1374
  <xsl:template name="insertPrefacepages">
1368
1375
  <xsl:param name="lang" select="$lang"/>
1369
1376
  <fo:block break-after="page"/>
@@ -1408,17 +1415,17 @@
1408
1415
  <xsl:call-template name="insertHeaderFooter"/>
1409
1416
  <fo:flow flow-name="xsl-region-body">
1410
1417
 
1411
- <fo:block-container font-size="12pt" text-align="center" margin-bottom="36pt">
1412
-
1413
- <fo:block font-weight="bold" role="H1">
1414
-
1418
+ <!-- <fo:block-container font-size="12pt" text-align="center" margin-bottom="36pt">
1419
+
1420
+ <fo:block font-weight="bold" role="H1">
1421
+
1415
1422
  <xsl:call-template name="printTitles">
1416
1423
  <xsl:with-param name="lang" select="$lang"/>
1417
1424
  </xsl:call-template>
1418
-
1419
- <fo:block> </fo:block>
1425
+
1426
+ <fo:block>&#xa0;</fo:block>
1420
1427
  </fo:block>
1421
- </fo:block-container>
1428
+ </fo:block-container> -->
1422
1429
 
1423
1430
  <!-- Main sections -->
1424
1431
  <fo:block>
@@ -6161,6 +6168,9 @@
6161
6168
  <!-- END Definition List -->
6162
6169
  <!-- ===================== -->
6163
6170
 
6171
+ <!-- default: ignore title in sections/p -->
6172
+ <xsl:template match="*[local-name() = 'sections']/*[local-name() = 'p'][starts-with(@class, 'zzSTDTitle')]" priority="3"/>
6173
+
6164
6174
  <!-- ========================= -->
6165
6175
  <!-- Rich text formatting -->
6166
6176
  <!-- ========================= -->
@@ -8316,25 +8326,45 @@
8316
8326
  <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style">
8317
8327
  <xsl:if test="not(@mimetype = 'image/svg+xml') and ../*[local-name() = 'name'] and not(ancestor::*[local-name() = 'table'])">
8318
8328
 
8319
- <xsl:variable name="img_src">
8320
- <xsl:choose>
8321
- <xsl:when test="not(starts-with(@src, 'data:'))"><xsl:value-of select="concat($basepath, @src)"/></xsl:when>
8322
- <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
8323
- </xsl:choose>
8324
- </xsl:variable>
8329
+ <xsl:if test="@width != '' and @width != 'auto'">
8330
+ <xsl:attribute name="width">
8331
+ <xsl:value-of select="@width"/>
8332
+ </xsl:attribute>
8333
+ </xsl:if>
8325
8334
 
8326
- <xsl:variable name="image_width_effective">
8335
+ <xsl:if test="@height != '' and @height != 'auto'">
8336
+ <xsl:attribute name="height">
8337
+ <xsl:value-of select="@height"/>
8338
+ </xsl:attribute>
8339
+ </xsl:if>
8327
8340
 
8328
- <xsl:value-of select="$width_effective"/>
8341
+ <xsl:choose>
8342
+ <xsl:when test="@width != '' and @width != 'auto' and @height != '' and @height != 'auto'">
8343
+ <xsl:attribute name="scaling">non-uniform</xsl:attribute>
8344
+ </xsl:when>
8345
+ <xsl:otherwise>
8329
8346
 
8330
- </xsl:variable>
8347
+ <xsl:variable name="img_src">
8348
+ <xsl:choose>
8349
+ <xsl:when test="not(starts-with(@src, 'data:'))"><xsl:value-of select="concat($basepath, @src)"/></xsl:when>
8350
+ <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
8351
+ </xsl:choose>
8352
+ </xsl:variable>
8331
8353
 
8332
- <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $image_width_effective, $height_effective)"/>
8333
- <xsl:if test="number($scale) &lt; 100">
8354
+ <xsl:variable name="image_width_effective">
8334
8355
 
8335
- <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
8356
+ <xsl:value-of select="$width_effective"/>
8336
8357
 
8337
- </xsl:if>
8358
+ </xsl:variable>
8359
+
8360
+ <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $image_width_effective, $height_effective)"/>
8361
+ <xsl:if test="number($scale) &lt; 100">
8362
+
8363
+ <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
8364
+
8365
+ </xsl:if>
8366
+ </xsl:otherwise>
8367
+ </xsl:choose>
8338
8368
 
8339
8369
  </xsl:if>
8340
8370
 
@@ -12011,7 +12041,7 @@
12011
12041
  <xsl:template match="*[local-name() = 'span']" mode="update_xml_step1">
12012
12042
  <xsl:apply-templates mode="update_xml_step1"/>
12013
12043
  </xsl:template>
12014
- <xsl:template match="*[local-name() = 'sourcecode']//*[local-name() = 'span'][@class]" mode="update_xml_step1" priority="2">
12044
+ <xsl:template match="*[local-name() = 'sections']/*[local-name() = 'p'][starts-with(@class, 'zzSTDTitle')]/*[local-name() = 'span'][@class] | *[local-name() = 'sourcecode']//*[local-name() = 'span'][@class]" mode="update_xml_step1" priority="2">
12015
12045
  <xsl:copy>
12016
12046
  <xsl:copy-of select="@*"/>
12017
12047
  <xsl:apply-templates mode="update_xml_step1"/>
@@ -0,0 +1,185 @@
1
+ module IsoDoc
2
+ module Iec
3
+ class PresentationXMLConvert < IsoDoc::Iso::PresentationXMLConvert
4
+ def termclause1(elem)
5
+ @is_iev or return clause1(elem)
6
+ @suppressheadingnumbers || elem["unnumbered"] and return
7
+ lbl = @xrefs.anchor(elem["id"], :label, true) or return
8
+ prefix_name(elem, " ", "#{lbl}#{clausedelim}", "title")
9
+ end
10
+
11
+ def concept(docxml)
12
+ @is_iev and concept_iev(docxml)
13
+ super
14
+ end
15
+
16
+ def concept_iev(docxml)
17
+ labels = @xrefs.get_anchors.each_with_object({}) do |(k, v), m|
18
+ m[v[:label]] = k
19
+ end
20
+ docpart = docxml&.at(ns("//bibdata/ext/structuredidentifier/" \
21
+ "project-number/@part"))&.text or return
22
+ docxml.xpath(ns("//termref[@base = 'IEV']")).each do |t|
23
+ concept_iev1(t, docpart, labels)
24
+ end
25
+ end
26
+
27
+ def concept_iev1(termref, docpart, labels)
28
+ /^#{docpart}-/.match?(termref["target"]) or return
29
+ newtarget = labels[termref["target"]] or return
30
+ termref.name = "xref"
31
+ termref.delete("base")
32
+ termref["target"] = newtarget
33
+ end
34
+
35
+ def terms(docxml)
36
+ otherlang_designations(docxml)
37
+ super
38
+ merge_fr_into_en_term(docxml)
39
+ end
40
+
41
+ def merge_fr_into_en_term(docxml)
42
+ @is_iev or return
43
+ docxml.xpath(ns("//term[@language = 'en'][@tag]")).each do |en|
44
+ fr = docxml.at(ns("//term[@language = 'fr'][@tag = '#{en['tag']}']"))
45
+ merge_fr_into_en_term1(en, fr) if fr
46
+ end
47
+ @xrefs.parse_inclusions(clauses: true).parse docxml
48
+ docxml.xpath(ns("//term/name")).each(&:remove)
49
+ term(docxml)
50
+ end
51
+
52
+ def merge_fr_into_en_term1(en_term, fr_term)
53
+ dl = en_term&.at(ns("./dl[@type = 'other-lang']"))&.remove
54
+ en_term << fr_term.remove.children
55
+ en_term << dl if dl
56
+ en_term["language"] = "en,fr"
57
+ en_term.delete("tag")
58
+ end
59
+
60
+ def otherlang_designations(docxml)
61
+ @is_iev or return
62
+ docxml.xpath(ns("//term")).each do |t|
63
+ otherlang_designations1(t, t["language"]&.split(",") || %w(en fr))
64
+ end
65
+ end
66
+
67
+ def extract_otherlang_designations(term, lgs)
68
+ term.xpath(ns(".//preferred/expression[@language]"))
69
+ .each_with_object([]) do |d, m|
70
+ lg = d["language"]
71
+ d.delete("language")
72
+ next if lgs.include?(lg)
73
+
74
+ p = d.parent
75
+ designation_annotate(p, d.at(ns("./name")))
76
+ m << { lang: lg, script: Metanorma::Utils.default_script(lg),
77
+ designation: to_xml(l10n_recursive(p.remove, lg)).strip }
78
+ end
79
+ end
80
+
81
+ def l10n_recursive(xml, lang)
82
+ script = Metanorma::Utils.default_script(lang)
83
+ c = HTMLEntities.new
84
+ xml.traverse do |x|
85
+ x.text? or next
86
+ text = c.encode(c.decode(x.text), :hexadecimal)
87
+ x.replace(cleanup_entities(l10n(text, lang, script), is_xml: false))
88
+ end
89
+ xml
90
+ end
91
+
92
+ def merge_otherlang_designations(desgn)
93
+ h = desgn.each_with_object({}) do |e, m|
94
+ if m[e[:lang]]
95
+ m[e[:lang]][:designation] += e[:designation]
96
+ else m[e[:lang]] = e
97
+ end
98
+ end
99
+ h.keys.sort.each_with_object([]) { |k, m| m << h[k] }
100
+ end
101
+
102
+ def otherlang_designations1(term, lgs)
103
+ pr = merge_otherlang_designations(
104
+ extract_otherlang_designations(term, lgs),
105
+ )
106
+ pr.empty? and return
107
+ prefs = pr.map do |p|
108
+ "<dt>#{p[:lang]}</dt>" \
109
+ "<dd language='#{p[:lang]}' script='#{p[:script]}'>" \
110
+ "#{cleanup_entities(p[:designation])}</dd>"
111
+ end
112
+ term << "<dl type='other-lang'>#{prefs.join}</dl>"
113
+ end
114
+
115
+ def related(docxml)
116
+ docxml.xpath(ns("//term[related]")).each { |f| move_related(f) }
117
+ super
118
+ end
119
+
120
+ def move_related(term)
121
+ defn = term.at(ns("./definition")) or return
122
+ term.xpath(ns("./related")).reverse.each do |r|
123
+ defn.next = r.remove
124
+ end
125
+ end
126
+
127
+ def related1(node)
128
+ lg = node&.at("./ancestor::xmlns:term/@language")&.text
129
+ @i18n = @i18n_lg[lg] if lg && @i18n_lg[lg]
130
+ p = node.at(ns("./preferred"))
131
+ ref = node.at(ns("./xref | ./eref | ./termref"))
132
+ label = @i18n.relatedterms[node["type"]].upcase
133
+ node.replace(l10n("<p>#{label}: " \
134
+ "#{to_xml(p.children)} (#{to_xml(ref)})</p>"))
135
+ @i18n = @i18n_lg["default"]
136
+ end
137
+
138
+ def termsource_modification(node)
139
+ lg = node&.at("./ancestor::xmlns:term/@language")&.text
140
+ @i18n = @i18n_lg[lg] if lg && @i18n_lg[lg]
141
+ super
142
+ @i18n = @i18n_lg["default"]
143
+ end
144
+
145
+ def termsource1(node)
146
+ lg = node&.at("./ancestor::xmlns:term/@language")&.text
147
+ @i18n = @i18n_lg[lg] if lg && @i18n_lg[lg]
148
+ if @is_iev then termsource1_iev(node)
149
+ else super
150
+ end
151
+ @i18n = @i18n_lg["default"]
152
+ end
153
+
154
+ def termsource1_iev(elem)
155
+ while elem&.next_element&.name == "termsource"
156
+ elem << "; #{to_xml(elem.next_element.remove.children)}"
157
+ end
158
+ elem.children = l10n("#{@i18n.source}: #{to_xml(elem.children).strip}")
159
+ end
160
+
161
+ def termexample(docxml)
162
+ docxml.xpath(ns("//termexample")).each do |f|
163
+ termexample1(f)
164
+ end
165
+ end
166
+
167
+ def termexample1(elem)
168
+ lg = elem&.at("./ancestor::xmlns:term/@language")&.text
169
+ @i18n = @i18n_lg[lg] if lg && @i18n_lg[lg]
170
+ example1(elem)
171
+ @i18n = @i18n_lg["default"]
172
+ end
173
+
174
+ def termnote1(elem)
175
+ lg = elem&.at("./ancestor::xmlns:term/@language")&.text
176
+ @i18n = @i18n_lg[lg] if lg && @i18n_lg[lg]
177
+
178
+ val = @xrefs.anchor(elem["id"], :value) || "???"
179
+ lbl = @i18n.termnote.gsub("%", val)
180
+ prefix_name(elem, "", lower2cap(lbl), "name")
181
+ @i18n = @i18n_lg["default"]
182
+ end
183
+ end
184
+ end
185
+ end
@@ -1,6 +1,7 @@
1
1
  require_relative "init"
2
2
  require "isodoc"
3
3
  require_relative "../../relaton/render-iec/general"
4
+ require_relative "presentation_terms"
4
5
 
5
6
  module IsoDoc
6
7
  module Iec
@@ -27,13 +28,6 @@ module IsoDoc
27
28
  end
28
29
  end
29
30
 
30
- def termclause1(elem)
31
- @is_iev or return clause1(elem)
32
- @suppressheadingnumbers || elem["unnumbered"] and return
33
- lbl = @xrefs.anchor(elem["id"], :label, true) or return
34
- prefix_name(elem, " ", "#{lbl}#{clausedelim}", "title")
35
- end
36
-
37
31
  def clause1(elem)
38
32
  IsoDoc::PresentationXMLConvert.instance_method(:clause1).bind(self)
39
33
  .call(elem)
@@ -56,179 +50,6 @@ module IsoDoc
56
50
  end
57
51
  end
58
52
 
59
- def concept(docxml)
60
- @is_iev and concept_iev(docxml)
61
- super
62
- end
63
-
64
- def concept_iev(docxml)
65
- labels = @xrefs.get_anchors.each_with_object({}) do |(k, v), m|
66
- m[v[:label]] = k
67
- end
68
- docpart = docxml&.at(ns("//bibdata/ext/structuredidentifier/" \
69
- "project-number/@part"))&.text or return
70
- docxml.xpath(ns("//termref[@base = 'IEV']")).each do |t|
71
- concept_iev1(t, docpart, labels)
72
- end
73
- end
74
-
75
- def concept_iev1(termref, docpart, labels)
76
- /^#{docpart}-/.match?(termref["target"]) or return
77
- newtarget = labels[termref["target"]] or return
78
- termref.name = "xref"
79
- termref.delete("base")
80
- termref["target"] = newtarget
81
- end
82
-
83
- def terms(docxml)
84
- otherlang_designations(docxml)
85
- super
86
- merge_fr_into_en_term(docxml)
87
- end
88
-
89
- def merge_fr_into_en_term(docxml)
90
- @is_iev or return
91
- docxml.xpath(ns("//term[@language = 'en'][@tag]")).each do |en|
92
- fr = docxml.at(ns("//term[@language = 'fr'][@tag = '#{en['tag']}']"))
93
- merge_fr_into_en_term1(en, fr) if fr
94
- end
95
- @xrefs.parse_inclusions(clauses: true).parse docxml
96
- docxml.xpath(ns("//term/name")).each(&:remove)
97
- term(docxml)
98
- end
99
-
100
- def merge_fr_into_en_term1(en_term, fr_term)
101
- dl = en_term&.at(ns("./dl[@type = 'other-lang']"))&.remove
102
- en_term << fr_term.remove.children
103
- en_term << dl if dl
104
- en_term["language"] = "en,fr"
105
- en_term.delete("tag")
106
- end
107
-
108
- def otherlang_designations(docxml)
109
- @is_iev or return
110
- docxml.xpath(ns("//term")).each do |t|
111
- otherlang_designations1(t, t["language"]&.split(/,/) || %w(en fr))
112
- end
113
- end
114
-
115
- def extract_otherlang_designations(term, lgs)
116
- term.xpath(ns(".//preferred/expression[@language]"))
117
- .each_with_object([]) do |d, m|
118
- lg = d["language"]
119
- d.delete("language")
120
- next if lgs.include?(lg)
121
-
122
- p = d.parent
123
- designation_annotate(p, d.at(ns("./name")))
124
- m << { lang: lg, script: Metanorma::Utils.default_script(lg),
125
- designation: to_xml(l10n_recursive(p.remove, lg)).strip }
126
- end
127
- end
128
-
129
- def l10n_recursive(xml, lang)
130
- script = Metanorma::Utils.default_script(lang)
131
- c = HTMLEntities.new
132
- xml.traverse do |x|
133
- x.text? or next
134
- text = c.encode(c.decode(x.text), :hexadecimal)
135
- x.replace(cleanup_entities(l10n(text, lang, script), is_xml: false))
136
- end
137
- xml
138
- end
139
-
140
- def merge_otherlang_designations(desgn)
141
- h = desgn.each_with_object({}) do |e, m|
142
- if m[e[:lang]]
143
- m[e[:lang]][:designation] += e[:designation]
144
- else m[e[:lang]] = e
145
- end
146
- end
147
- h.keys.sort.each_with_object([]) { |k, m| m << h[k] }
148
- end
149
-
150
- def otherlang_designations1(term, lgs)
151
- pr = merge_otherlang_designations(
152
- extract_otherlang_designations(term, lgs),
153
- )
154
- pr.empty? and return
155
- prefs = pr.map do |p|
156
- "<dt>#{p[:lang]}</dt>" \
157
- "<dd language='#{p[:lang]}' script='#{p[:script]}'>" \
158
- "#{cleanup_entities(p[:designation])}</dd>"
159
- end
160
- term << "<dl type='other-lang'>#{prefs.join}</dl>"
161
- end
162
-
163
- def related(docxml)
164
- docxml.xpath(ns("//term[related]")).each { |f| move_related(f) }
165
- super
166
- end
167
-
168
- def move_related(term)
169
- defn = term.at(ns("./definition")) or return
170
- term.xpath(ns("./related")).reverse.each do |r|
171
- defn.next = r.remove
172
- end
173
- end
174
-
175
- def related1(node)
176
- lg = node&.at("./ancestor::xmlns:term/@language")&.text
177
- @i18n = @i18n_lg[lg] if lg && @i18n_lg[lg]
178
- p = node.at(ns("./preferred"))
179
- ref = node.at(ns("./xref | ./eref | ./termref"))
180
- label = @i18n.relatedterms[node["type"]].upcase
181
- node.replace(l10n("<p>#{label}: " \
182
- "#{to_xml(p.children)} (#{to_xml(ref)})</p>"))
183
- @i18n = @i18n_lg["default"]
184
- end
185
-
186
- def termsource_modification(node)
187
- lg = node&.at("./ancestor::xmlns:term/@language")&.text
188
- @i18n = @i18n_lg[lg] if lg && @i18n_lg[lg]
189
- super
190
- @i18n = @i18n_lg["default"]
191
- end
192
-
193
- def termsource1(node)
194
- lg = node&.at("./ancestor::xmlns:term/@language")&.text
195
- @i18n = @i18n_lg[lg] if lg && @i18n_lg[lg]
196
- if @is_iev then termsource1_iev(node)
197
- else super
198
- end
199
- @i18n = @i18n_lg["default"]
200
- end
201
-
202
- def termsource1_iev(elem)
203
- while elem&.next_element&.name == "termsource"
204
- elem << "; #{to_xml(elem.next_element.remove.children)}"
205
- end
206
- elem.children = l10n("#{@i18n.source}: #{to_xml(elem.children).strip}")
207
- end
208
-
209
- def termexample(docxml)
210
- docxml.xpath(ns("//termexample")).each do |f|
211
- termexample1(f)
212
- end
213
- end
214
-
215
- def termexample1(elem)
216
- lg = elem&.at("./ancestor::xmlns:term/@language")&.text
217
- @i18n = @i18n_lg[lg] if lg && @i18n_lg[lg]
218
- example1(elem)
219
- @i18n = @i18n_lg["default"]
220
- end
221
-
222
- def termnote1(elem)
223
- lg = elem&.at("./ancestor::xmlns:term/@language")&.text
224
- @i18n = @i18n_lg[lg] if lg && @i18n_lg[lg]
225
-
226
- val = @xrefs.anchor(elem["id"], :value) || "???"
227
- lbl = @i18n.termnote.gsub(/%/, val)
228
- prefix_name(elem, "", lower2cap(lbl), "name")
229
- @i18n = @i18n_lg["default"]
230
- end
231
-
232
53
  def bibrenderer
233
54
  ::Relaton::Render::Iec::General.new(language: @lang,
234
55
  i18nhash: @i18n.get)
@@ -257,27 +78,30 @@ module IsoDoc
257
78
 
258
79
  def insert_middle_title(docxml)
259
80
  ins = docxml.at(ns("//preface/clause[@type = 'toc']")) or return
260
- title1, title2 = middle_title_parts(nil)
81
+ title1, title2 = middle_title_parts
261
82
  title2out = ""
262
83
  title2 and title2out = <<~OUTPUT
263
84
  <p class="zzSTDTitle1">&#xa0;</p>
264
85
  <p class="zzSTDTitle2"><strong>#{title2}</strong></p>
265
86
  OUTPUT
266
87
  ins.next = <<~OUTPUT
267
- <pagebreak/>
268
- <p class="zzSTDTitle1">#{@i18n.get['IEC']}</p>
269
- <p class="zzSTDTitle1">____________</p>
270
- <p class="zzSTDTitle1">&#xa0;</p>
271
- <p class="zzSTDTitle1"><strong>#{title1.upcase}</strong></p>#{title2out}
88
+ <pagebreak/><p class="zzSTDTitle1">#{@i18n.get['IEC']}</p>
89
+ <p class="zzSTDTitle1">____________</p><p class="zzSTDTitle1">&#xa0;</p>
90
+ <p class="zzSTDTitle1"><strong>#{title1&.upcase}</strong></p>#{title2out}
272
91
  <p class="zzSTDTitle1">&#xa0;</p>
273
92
  OUTPUT
274
93
  end
275
94
 
276
- def middle_title_parts(_out)
95
+ def middle_title_parts
277
96
  title1 = @meta.get[:doctitlemain]&.sub(/\s+$/, "")
278
97
  @meta.get[:doctitleintro] and
279
98
  title1 = "#{@meta.get[:doctitleintro]} \u2014 #{title1}"
280
- title2 = nil
99
+ title1, title2 = middle_title_part(title1, nil)
100
+ title1&.empty? and title1 = nil
101
+ [title1, title2]
102
+ end
103
+
104
+ def middle_title_part(title1, title2)
281
105
  if @meta.get[:doctitlepart]
282
106
  title1 += " \u2014"
283
107
  title2 = @meta.get[:doctitlepart]&.sub(/\s+$/, "")
@@ -287,6 +111,20 @@ module IsoDoc
287
111
  [title1, title2]
288
112
  end
289
113
 
114
+ def middle_title(docxml)
115
+ s = docxml.at(ns("//sections")) or return
116
+ title1, title2 = middle_title_parts
117
+ title1 || title2 or return
118
+ ret = ""
119
+ title1 and ret = "<p class='zzSTDTitle1'><strong>#{title1}</strong></p>"
120
+ title2 and ret += <<~TITLE
121
+ <p class='zzSTDTitle1'>&#xa0;</p>
122
+ <p class='zzSTDTitle2'><strong>#{title2}</strong><p>
123
+ TITLE
124
+ ret += "<p class='zzSTDTitle1'>&#xa0;</p>"
125
+ s.children.first.previous = ret
126
+ end
127
+
290
128
  include Init
291
129
  end
292
130
  end
@@ -202,19 +202,7 @@ module IsoDoc
202
202
  { class: "TableTitle", style: "text-align:center;" }
203
203
  end
204
204
 
205
- def para_class(node)
206
- case node["class"]
207
- when "zzSTDTitle1", "zzSTDTitle2" then node["class"]
208
- else
209
- classtype = nil
210
- classtype = "MsoCommentText" if @in_comment
211
- classtype = "Sourcecode" if @annotation
212
- classtype
213
- end
214
- end
215
-
216
205
  def annex_name(_annex, name, div)
217
- preceding_floating_titles(name, div)
218
206
  return if name.nil?
219
207
 
220
208
  div.h1 class: "Annex" do |t|
@@ -105,7 +105,7 @@
105
105
  <p>More than 55 000 electrotechnical terminology entries in English and French extracted from the Terms and Definitions clause of IEC publications issued since 2002. Some entries have been collected from earlier publications of IEC TC 37, 77, 86 and CISPR.</p>
106
106
  </clause>
107
107
  <clause><title>IEC Customer Service Centre - <link target="https://webstore.iec.ch/csc">webstore.iec.ch/csc</link></title>
108
- <p>If you wish to give us your feedback on this publication or need further assistance, please contact the Customer Service Centre: <link target="mailto://csc@iec.ch">csc@iec.ch</link>.</p>
108
+ <p>If you wish to give us your feedback on this publication or need further assistance, please contact the Customer Service Centre: <link target="mailto:csc@iec.ch">csc@iec.ch</link>.</p>
109
109
  </clause>
110
110
  </clause>
111
111
  {% endif %}
@@ -108,7 +108,7 @@ les coordonnées ci-après ou contactez le Comité national de l'IEC de votre pa
108
108
  <p>Plus de 55 000 entrées terminologiques électrotechniques, en anglais et en français, extraites des articles Termes et Définitions des publications IEC parues depuis 2002. Plus certaines entrées antérieures extraites des publications des CE 37, 77, 86 et CISPR de l'IEC.</p>
109
109
  </clause>
110
110
  <clause><title>Service Clients - <link target="https://webstore.iec.ch/csc">webstore.iec.ch/csc</link></title>
111
- <p>Si vous désirez nous donner des commentaires sur cette publication ou si vous avez des questions contactez-nous: <link target="mailto://csc@iec.ch">csc@iec.ch</link>.</p>
111
+ <p>Si vous désirez nous donner des commentaires sur cette publication ou si vous avez des questions contactez-nous: <link target="mailto:csc@iec.ch">csc@iec.ch</link>.</p>
112
112
  </clause>
113
113
  </clause>
114
114
  {% endif %}
@@ -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.2 -->
20
+ <!-- VERSION v1.2.3 -->
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">
@@ -192,9 +192,11 @@
192
192
  </attribute>
193
193
  </optional>
194
194
  <attribute name="citeas"/>
195
- <attribute name="type">
196
- <ref name="ReferenceFormat"/>
197
- </attribute>
195
+ <optional>
196
+ <attribute name="type">
197
+ <ref name="ReferenceFormat"/>
198
+ </attribute>
199
+ </optional>
198
200
  <optional>
199
201
  <attribute name="alt"/>
200
202
  </optional>
@@ -836,6 +838,26 @@
836
838
  <ref name="paragraph"/>
837
839
  </element>
838
840
  </define>
841
+ <define name="stem">
842
+ <element name="stem">
843
+ <attribute name="type">
844
+ <choice>
845
+ <value>MathML</value>
846
+ <value>AsciiMath</value>
847
+ <value>LatexMath</value>
848
+ </choice>
849
+ </attribute>
850
+ <attribute name="block">
851
+ <data type="boolean"/>
852
+ </attribute>
853
+ <oneOrMore>
854
+ <choice>
855
+ <text/>
856
+ <ref name="AnyElement"/>
857
+ </choice>
858
+ </oneOrMore>
859
+ </element>
860
+ </define>
839
861
  <define name="em">
840
862
  <element name="em">
841
863
  <zeroOrMore>
@@ -1,6 +1,6 @@
1
1
  module Metanorma
2
2
  module Iec
3
- VERSION = "2.2.14".freeze
3
+ VERSION = "2.3.0".freeze
4
4
  end
5
5
  end
6
6
 
@@ -30,7 +30,7 @@ Gem::Specification.new do |spec|
30
30
  spec.test_files = `git ls-files -- {spec}/*`.split("\n")
31
31
  spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
32
32
 
33
- spec.add_dependency "metanorma-iso", "~> 2.4.2"
33
+ spec.add_dependency "metanorma-iso", "~> 2.5.0"
34
34
  spec.add_dependency "pubid-iec"
35
35
  spec.add_dependency "ruby-jing"
36
36
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-iec
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.14
4
+ version: 2.3.0
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-07-24 00:00:00.000000000 Z
11
+ date: 2023-08-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-iso
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 2.4.2
19
+ version: 2.5.0
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.4.2
26
+ version: 2.5.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: pubid-iec
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -245,6 +245,7 @@ files:
245
245
  - lib/isodoc/iec/init.rb
246
246
  - lib/isodoc/iec/metadata.rb
247
247
  - lib/isodoc/iec/pdf_convert.rb
248
+ - lib/isodoc/iec/presentation_terms.rb
248
249
  - lib/isodoc/iec/presentation_xml_convert.rb
249
250
  - lib/isodoc/iec/word_convert.rb
250
251
  - lib/isodoc/iec/xref.rb