metanorma-itu 2.7.4 → 2.7.5

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.
@@ -55,7 +55,8 @@ module IsoDoc
55
55
  lbl)}<br/>#{subhead}</p>"
56
56
  end
57
57
 
58
- def middle_title(isoxml)
58
+ # KILL
59
+ def middle_titlex(isoxml)
59
60
  s = isoxml.at(ns("//sections")) or return
60
61
  # isoxml.at(ns("//note[@type = 'title-footnote']"))
61
62
  case @doctype
@@ -68,7 +69,18 @@ module IsoDoc
68
69
  # titfn and renumber_footnotes(isoxml)
69
70
  end
70
71
 
71
- def middle_title_resolution(isoxml, out)
72
+ def middle_title_template
73
+ case @doctype
74
+ when "resolution"
75
+ middle_title_resolution
76
+ when "contribution"
77
+ else
78
+ middle_title_recommendation
79
+ end
80
+ end
81
+
82
+ # KILL
83
+ def middle_title_resolutionx(isoxml, out)
72
84
  res = isoxml.at(ns("//bibdata/title[@type = 'resolution']"))
73
85
  out.previous =
74
86
  "<p class='zzSTDTitle1' align='center'>#{res.children.to_xml}</p>"
@@ -77,6 +89,15 @@ module IsoDoc
77
89
  middle_title_resolution_subtitle(isoxml, out)
78
90
  end
79
91
 
92
+ def middle_title_resolution
93
+ <<~OUTPUT
94
+ <p class='zzSTDTitle1' align='center'>{{ resolutiontitle }}</p>
95
+ {% if doctitle %}<p class='zzSTDTitle2'>{{ doctitle }}</p>{% endif %}
96
+ <p align='center' class='zzSTDTitle2'><em>({{ resolutionplacedate }})</em><span id='_middle_title_footnotes'/></p>
97
+ OUTPUT
98
+ end
99
+
100
+ # KILL
80
101
  def middle_title_resolution_subtitle(isoxml, out)
81
102
  ret = "<p align='center' class='zzSTDTitle2'><em>("
82
103
  d = isoxml.at(ns("//bibdata/title[@type = 'resolution-placedate']"))
@@ -85,7 +106,8 @@ module IsoDoc
85
106
  out.previous = ret
86
107
  end
87
108
 
88
- def middle_title_recommendation(isoxml, out)
109
+ # KILL
110
+ def middle_title_recommendationx(isoxml, out)
89
111
  ret = ""
90
112
  id = @meta.get[:docnumber_iso] and ret += <<~XML
91
113
  <p class='zzSTDTitle1'>#{@i18n.international_standard} #{id}</p>
@@ -96,6 +118,19 @@ module IsoDoc
96
118
  out.previous = ret
97
119
  end
98
120
 
121
+ def middle_title_recommendation
122
+ <<~OUTPUT
123
+ {% if docnumber_iso %}<p class='zzSTDTitle1'>{{ labels["international_standard"] }}
124
+ {{ docnumber_iso }}</p>{% endif %}
125
+ {% if docnumber %}<p class='zzSTDTitle1'>
126
+ {%- if unpublished and draft_new_doctype %}{{ draft_new_doctype }}{% else %}{{ doctype_display }}{% endif %}
127
+ {{ docnumber }}</p>{% endif %}
128
+ {% if doctitle %}<p class='zzSTDTitle2'>{{ doctitle }}<span id='_middle_title_footnotes'/></p>{% endif %}
129
+ {% if docsubtitle %}<p class='zzSTDTitle3'>{{ docsubtitle }}</p>{% endif %}
130
+ OUTPUT
131
+ end
132
+
133
+ # KILL
99
134
  def middle_title_recommendation_first_line
100
135
  ret = ""
101
136
  type = @meta.get[:doctype_display]
@@ -106,6 +141,7 @@ module IsoDoc
106
141
  ret
107
142
  end
108
143
 
144
+ # KILL
109
145
  def middle_title_recommendation_second_line(isoxml)
110
146
  ret = ""
111
147
  t = @meta.get[:doctitle] or return ret
@@ -114,6 +150,15 @@ module IsoDoc
114
150
  ret
115
151
  end
116
152
 
153
+ def middle_title(docxml)
154
+ super
155
+ ins = docxml.at(ns("//span[@id = '_middle_title_footnotes']")) or return
156
+ if fn = title_footnotes(docxml)
157
+ ins.replace(fn)
158
+ else ins.remove
159
+ end
160
+ end
161
+
117
162
  def title_footnotes(isoxml)
118
163
  ret = ""
119
164
  isoxml.xpath(ns("//note[@type = 'title-footnote']"))
@@ -17,19 +17,12 @@ module Metanorma
17
17
  super + %w(complements)
18
18
  end
19
19
 
20
- def insert_title(xml, type, lang, content)
21
- attr = { language: lang, format: "text/plain", type: type }
22
- xml.title **attr_code(attr) do |t|
23
- t << Metanorma::Utils::asciidoc_sub(content)
24
- end
25
- end
26
-
27
20
  def title_defaultlang(node, xml)
28
21
  a = node.attr("title") || node.attr("title-#{@lang}") ||
29
22
  node.attr("doctitle")
30
- insert_title(xml, "main", @lang, a)
23
+ add_title_xml(xml, a, @lang, "main")
31
24
  if a = node.attr("annextitle") || node.attr("annextitle-#{@lang}")
32
- insert_title(xml, "annex", @lang, a)
25
+ add_title_xml(xml, a, @lang, "annex")
33
26
  end
34
27
  end
35
28
 
@@ -38,7 +31,7 @@ module Metanorma
38
31
  /^(?:annex)?title-(?<lang>.+)$/ =~ k or next
39
32
  lang == @lang and next
40
33
  type = /^annex/.match?(k) ? "annex" : "main"
41
- insert_title(xml, type, lang, v)
34
+ add_title_xml(xml, v, lang, type)
42
35
  end
43
36
  end
44
37
 
@@ -54,14 +47,14 @@ module Metanorma
54
47
 
55
48
  def other_title_defaultlang(node, xml, type)
56
49
  a = node.attr(type) || node.attr("#{type}-#{@lang}")
57
- insert_title(xml, type.sub(/-title/, ""), @lang, a)
50
+ add_title_xml(xml, a, @lang, type.sub(/-title/, ""))
58
51
  end
59
52
 
60
53
  def other_title_otherlangs(node, xml, type)
61
54
  node.attributes.each do |k, v|
62
55
  m = /^#{type}-(?<lang>.+)$/.match(k) or next
63
56
  m[:lang] == @lang and next
64
- insert_title(xml, type.sub(/-title/, ""), m[:lang], v)
57
+ add_title_xml(xml, v, m[:lang], type.sub(/-title/, ""))
65
58
  end
66
59
  end
67
60
 
@@ -1,6 +1,6 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <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">
3
- <!-- VERSION v2.1.2 -->
3
+ <!-- VERSION v2.1.3 -->
4
4
 
5
5
  <!--
6
6
  ALERT: cannot have root comments, because of https://github.com/metanorma/metanorma/issues/437
@@ -455,14 +455,7 @@ normative or informative references, some split references into sections organiz
455
455
  </ref>
456
456
  </zeroOrMore>
457
457
  <zeroOrMore>
458
- <ref name="doc_bibitem">
459
- <a:documentation>Bibliographic item cited in the document</a:documentation>
460
- </ref>
461
- <zeroOrMore>
462
- <ref name="note">
463
- <a:documentation>Annotation of the bibliographic item</a:documentation>
464
- </ref>
465
- </zeroOrMore>
458
+ <ref name="ReferenceEntry"/>
466
459
  </zeroOrMore>
467
460
  <zeroOrMore>
468
461
  <ref name="references">
@@ -604,18 +597,21 @@ gives an explicit page orientation</a:documentation>
604
597
  </element>
605
598
  </optional>
606
599
  </define>
607
- </include>
608
- <!-- end overrides -->
609
- <define name="FnAttributes" combine="interleave">
610
- <ref name="RequiredId"/>
611
- <optional>
612
- <attribute name="hiddenref">
613
- <a:documentation>If true, number the footnote as normal, but suppress display of the footnote reference in the document body.
600
+ <define name="FnAttributes">
601
+ <ref name="RequiredId"/>
602
+ <optional>
603
+ <attribute name="hiddenref">
604
+ <a:documentation>If true, number the footnote as normal, but suppress display of the footnote reference in the document body.
614
605
  This is done if the footnote reference is already presented in some other form, e.g. within a figure image.</a:documentation>
615
- <data type="boolean"/>
606
+ <data type="boolean"/>
607
+ </attribute>
608
+ </optional>
609
+ <attribute name="reference">
610
+ <a:documentation>The number of the footnote, used to identify it visually</a:documentation>
616
611
  </attribute>
617
- </optional>
618
- </define>
612
+ </define>
613
+ </include>
614
+ <!-- end overrides -->
619
615
  <define name="TdAttributes" combine="interleave">
620
616
  <ref name="RequiredId"/>
621
617
  <optional>
@@ -853,6 +849,17 @@ titlecase, or lowercase</a:documentation>
853
849
  <value>informative</value>
854
850
  </choice>
855
851
  </define>
852
+ <define name="ReferenceEntry">
853
+ <a:documentation>Entry in bibliography</a:documentation>
854
+ <ref name="doc_bibitem">
855
+ <a:documentation>Bibliographic item cited in the document</a:documentation>
856
+ </ref>
857
+ <zeroOrMore>
858
+ <ref name="note">
859
+ <a:documentation>Annotation of the bibliographic item</a:documentation>
860
+ </ref>
861
+ </zeroOrMore>
862
+ </define>
856
863
  <define name="doc_bibitem">
857
864
  <a:documentation>Standardisation document representation of bibliographic entry</a:documentation>
858
865
  <element name="bibitem">
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Itu
3
- VERSION = "2.7.4".freeze
3
+ VERSION = "2.7.5".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-itu
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.7.4
4
+ version: 2.7.5
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-09-01 00:00:00.000000000 Z
11
+ date: 2025-09-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-standoc