metanorma-ieee 1.4.1 → 1.4.2

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.
@@ -45,18 +45,25 @@ module IsoDoc
45
45
  super
46
46
  end
47
47
 
48
- KEEP_BIBRENDER_XPATH =
49
- "./docidentifier | ./uri | ./note | ./title | ./biblio-tag".freeze
50
-
51
48
  def bibrender_relaton(xml, renderings)
52
- f = renderings[xml["id"]][:formattedref]
53
- fn = availability_note(xml)
54
- f &&= "<formattedref>#{f}#{fn}</formattedref>"
55
- xml.children = "#{f}#{xml.xpath(ns(KEEP_BIBRENDER_XPATH)).to_xml}"
49
+ bibrender_relaton1(xml, renderings)
56
50
  author_date(xml, renderings)
57
51
  @author[xml["id"]] = renderings[xml["id"]][:author]
58
52
  end
59
53
 
54
+ def bibrender_relaton1(xml, renderings)
55
+ f = renderings[xml["id"]][:formattedref] or return
56
+ fn = availability_note(xml)
57
+ f = "<formattedref>#{f}#{fn}</formattedref>"
58
+ if x = xml.at(ns("./formattedref"))
59
+ x.replace(f)
60
+ elsif xml.children.empty?
61
+ xml << f
62
+ else
63
+ xml.children.first.previous = f
64
+ end
65
+ end
66
+
60
67
  def author_date(xml, renderings)
61
68
  author_date?(xml) or return
62
69
  cit = renderings[xml["id"]][:citation]
@@ -86,7 +86,7 @@ module IsoDoc
86
86
  section_break(body, continuous: true)
87
87
  body.div class: "WordSectionMain" do |div3|
88
88
  content(div3, docxml, ns(self.class::MAIN_ELEMENTS))
89
- footnotes div3
89
+ footnotes docxml, div3
90
90
  comments div3
91
91
  end
92
92
  end
@@ -202,29 +202,35 @@ module IsoDoc
202
202
  end
203
203
  end
204
204
 
205
- # Figure 1— remove each of these
206
- def figure_name_parse(_node, div, name)
207
- name.nil? and return
208
- name.at(".//xmlns:semx[@element = 'autonum']/"\
209
- "preceding-sibling::*[normalize-space() = '']")&.remove
205
+ # "Figure 1—" remove each of these: strip elements in caption associated
206
+ # with autonumbering -- # but not in footnotes. The autonumber captions
207
+ # are provided by Word styles instead
208
+ def strip_caption_semx(name)
209
+ name.xpath(".//xmlns:semx[@element = 'autonum']/"\
210
+ "preceding-sibling::*[normalize-space() = '']").each do |s|
211
+ s.ancestors("fn").empty? and s.remove
212
+ end
210
213
  name.xpath(ns(".//span[@class = 'fmt-element-name'] | "\
211
214
  ".//span[@class = 'fmt-caption-delim'] | "\
212
- ".//semx[@element = 'autonum']")).each(&:remove)
215
+ ".//semx[@element = 'autonum']")).each do |s|
216
+ s.ancestors("fn").empty? and s.remove
217
+ end
218
+ end
219
+
220
+ def figure_name_parse(_node, div, name)
221
+ name.nil? and return
222
+ strip_caption_semx(name)
213
223
  super
214
224
  end
215
225
 
216
226
  def table_title_parse(node, out)
217
227
  name = node.at(ns("./fmt-name")) or return
218
- name.at(".//xmlns:semx[@element = 'autonum']/"\
219
- "preceding-sibling::*[normalize-space() = '']")&.remove
220
- name.xpath(ns(".//span[@class = 'fmt-element-name'] | "\
221
- ".//span[@class = 'fmt-caption-delim'] | "\
222
- ".//semx[@element = 'autonum']")).each(&:remove)
228
+ strip_caption_semx(name)
223
229
  super
224
230
  end
225
231
 
226
232
  include BaseConvert
227
233
  include Init
228
- end
229
- end
234
+ end
235
+ end
230
236
  end
@@ -45,7 +45,7 @@ module IsoDoc
45
45
  section_break(body)
46
46
  body.div class: "WordSection4" do |div3|
47
47
  backcover div3
48
- footnotes div3
48
+ footnotes docxml, div3
49
49
  comments div3
50
50
  end
51
51
  end
@@ -599,17 +599,9 @@ It is included for convenience, in case processing the citation to extract the a
599
599
  <a:documentation>The caption of the block</a:documentation>
600
600
  </ref>
601
601
  </optional>
602
- <oneOrMore>
603
- <choice>
604
- <text>
605
- <a:documentation>The computer code or other such text presented in the block, as a single unformatted string.
606
- (The string should be treated as pre-formatted text, with whitespace treated as significant)</a:documentation>
607
- </text>
608
- <ref name="callout">
609
- <a:documentation>Zero or more cross-references; these are intended to be embedded within the content string, and link to annotations</a:documentation>
610
- </ref>
611
- </choice>
612
- </oneOrMore>
602
+ <ref name="sourcecodebody">
603
+ <a:documentation>The sourcecode content</a:documentation>
604
+ </ref>
613
605
  <zeroOrMore>
614
606
  <ref name="annotation">
615
607
  <a:documentation>Annotations to the source code; each annotation consists of zero or more paragraphs,
@@ -628,17 +620,9 @@ and is intended to be referenced by a callout within the source code</a:document
628
620
  <a:documentation>The caption of the block</a:documentation>
629
621
  </ref>
630
622
  </optional>
631
- <oneOrMore>
632
- <choice>
633
- <text>
634
- <a:documentation>The computer code or other such text presented in the block, as a single unformatted string.
635
- (The string should be treated as pre-formatted text, with whitespace treated as significant)</a:documentation>
636
- </text>
637
- <ref name="callout">
638
- <a:documentation>Zero or more cross-references; these are intended to be embedded within the content string, and link to annotations</a:documentation>
639
- </ref>
640
- </choice>
641
- </oneOrMore>
623
+ <ref name="sourcecodebody">
624
+ <a:documentation>The sourcecode content</a:documentation>
625
+ </ref>
642
626
  <zeroOrMore>
643
627
  <ref name="annotation">
644
628
  <a:documentation>Annotations to the source code; each annotation consists of zero or more paragraphs,
@@ -651,6 +635,20 @@ and is intended to be referenced by a callout within the source code</a:document
651
635
  </ref>
652
636
  </zeroOrMore>
653
637
  </define>
638
+ <define name="sourcecodebody">
639
+ <a:documentation>The computer code or other such text presented in the block, as a single unformatted string.
640
+ (The string should be treated as pre-formatted text, with whitespace treated as significant)</a:documentation>
641
+ <element name="body">
642
+ <oneOrMore>
643
+ <choice>
644
+ <text/>
645
+ <ref name="callout">
646
+ <a:documentation>Zero or more cross-references; these are intended to be embedded within the content string, and link to annotations</a:documentation>
647
+ </ref>
648
+ </choice>
649
+ </oneOrMore>
650
+ </element>
651
+ </define>
654
652
  <define name="pre">
655
653
  <a:documentation>Pre-formatted block. Wrapper for text to be rendered with fixed-width typeface, and preserving spaces including line breaks.
656
654
  They are intended for a restricted number of functions, most typically ASCII Art (which is still in prominent use in some
@@ -1672,18 +1670,25 @@ which can be bookmarks as well as block or section references</a:documentation>
1672
1670
  </optional>
1673
1671
  </define>
1674
1672
  <define name="XrefBody">
1675
- <oneOrMore>
1676
- <ref name="PureTextElement">
1677
- <a:documentation>The textual content of the element. The `text` is what we wish to show the link as (e.g., the "content" of `&lt;xx&gt;my link text&lt;/xx&gt;`)</a:documentation>
1678
- </ref>
1679
- </oneOrMore>
1673
+ <a:documentation>The textual content of the element. The `text` is what we wish to show the link as (e.g., the "content" of `&lt;xx&gt;my link text&lt;/xx&gt;`)</a:documentation>
1674
+ <optional>
1675
+ <element name="display-text">
1676
+ <oneOrMore>
1677
+ <ref name="PureTextElement"/>
1678
+ </oneOrMore>
1679
+ </element>
1680
+ </optional>
1680
1681
  </define>
1681
1682
  <define name="ErefBody">
1682
- <oneOrMore>
1683
- <ref name="PureTextElement">
1684
- <a:documentation>The textual content of the element. The `text` is what we wish to show the link as (e.g., the "content" of `&lt;xx&gt;my link text&lt;/xx&gt;`)</a:documentation>
1685
- </ref>
1686
- </oneOrMore>
1683
+ <optional>
1684
+ <element name="display-text">
1685
+ <oneOrMore>
1686
+ <ref name="PureTextElement">
1687
+ <a:documentation>The textual content of the element. The `text` is what we wish to show the link as (e.g., the "content" of `&lt;xx&gt;my link text&lt;/xx&gt;`)</a:documentation>
1688
+ </ref>
1689
+ </oneOrMore>
1690
+ </element>
1691
+ </optional>
1687
1692
  </define>
1688
1693
  <define name="fn">
1689
1694
  <a:documentation>Inline reference to a paragraph or paragraphs, appearing as a footnote.
@@ -33,6 +33,15 @@
33
33
  </zeroOrMore>
34
34
  </element>
35
35
  </define>
36
+ <define name="fn" combine="interleave">
37
+ <optional>
38
+ <attribute name="hiddenref">
39
+ <a:documentation>If true, number the footnote as normal, but suppress display of the footnote reference in the document body.
40
+ This is done if the footnote reference is already presented in some other form, e.g. within a figure image.</a:documentation>
41
+ <data type="boolean"/>
42
+ </attribute>
43
+ </optional>
44
+ </define>
36
45
  <define name="index-primary">
37
46
  <element name="primary">
38
47
  <oneOrMore>
@@ -245,23 +254,9 @@
245
254
  <a:documentation>The caption of the block</a:documentation>
246
255
  </ref>
247
256
  </optional>
248
- <oneOrMore>
249
- <choice>
250
- <text>
251
- <a:documentation>The computer code or other such text presented in the block, as a single unformatted string.
252
- (The string should be treated as pre-formatted text, with whitespace treated as significant)</a:documentation>
253
- </text>
254
- <ref name="callout">
255
- <a:documentation>Zero or more cross-references; these are intended to be embedded within the content string, and link to annotations</a:documentation>
256
- </ref>
257
- <ref name="xref">
258
- <a:documentation>Hyperlink of code segment to another part of the document</a:documentation>
259
- </ref>
260
- <ref name="eref">
261
- <a:documentation>Hyperlink of code segment to external bibliographic resource</a:documentation>
262
- </ref>
263
- </choice>
264
- </oneOrMore>
257
+ <ref name="sourcecodebody">
258
+ <a:documentation>The sourcecode content</a:documentation>
259
+ </ref>
265
260
  <zeroOrMore>
266
261
  <ref name="annotation">
267
262
  <a:documentation>Annotations to the source code; each annotation consists of zero or more paragraphs,
@@ -277,6 +272,26 @@ and is intended to be referenced by a callout within the source code</a:document
277
272
  <a:documentation>A source for the block</a:documentation>
278
273
  </ref>
279
274
  </define>
275
+ <define name="sourcecodebody">
276
+ <a:documentation>The computer code or other such text presented in the block, as a single unformatted string.
277
+ (The string should be treated as pre-formatted text, with whitespace treated as significant)</a:documentation>
278
+ <element name="body">
279
+ <oneOrMore>
280
+ <choice>
281
+ <text/>
282
+ <ref name="callout">
283
+ <a:documentation>Zero or more cross-references; these are intended to be embedded within the content string, and link to annotations</a:documentation>
284
+ </ref>
285
+ <ref name="xref">
286
+ <a:documentation>Hyperlink of code segment to another part of the document</a:documentation>
287
+ </ref>
288
+ <ref name="eref">
289
+ <a:documentation>Hyperlink of code segment to external bibliographic resource</a:documentation>
290
+ </ref>
291
+ </choice>
292
+ </oneOrMore>
293
+ </element>
294
+ </define>
280
295
  <define name="sections">
281
296
  <element name="sections">
282
297
  <oneOrMore>
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Ieee
3
- VERSION = "1.4.1".freeze
3
+ VERSION = "1.4.2".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-ieee
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.1
4
+ version: 1.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-03-04 00:00:00.000000000 Z
11
+ date: 2025-03-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-standoc