metanorma-ieee 1.5.3 → 1.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.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/lib/isodoc/ieee/html/header.html +3 -3
  3. data/lib/isodoc/ieee/html/html_ieee_titlepage.html +15 -2
  4. data/lib/isodoc/ieee/html/ieee.css +46 -1
  5. data/lib/isodoc/ieee/html/ieee.scss +42 -1
  6. data/lib/isodoc/ieee/html/word_ieee_titlepage.html +10 -2
  7. data/lib/isodoc/ieee/html/wordstyle.css +48 -0
  8. data/lib/isodoc/ieee/html/wordstyle.scss +44 -0
  9. data/lib/isodoc/ieee/html/wordstyle_wp.css +47 -0
  10. data/lib/isodoc/ieee/html/wordstyle_wp.scss +43 -0
  11. data/lib/isodoc/ieee/i18n-en.yaml +2 -0
  12. data/lib/isodoc/ieee/ieee.amendment.xsl +1131 -438
  13. data/lib/isodoc/ieee/ieee.standard.xsl +1131 -438
  14. data/lib/isodoc/ieee/metadata.rb +22 -11
  15. data/lib/isodoc/ieee/presentation_bibitem.rb +102 -0
  16. data/lib/isodoc/ieee/presentation_ref.rb +149 -96
  17. data/lib/isodoc/ieee/presentation_terms.rb +52 -12
  18. data/lib/isodoc/ieee/presentation_xml_convert.rb +15 -67
  19. data/lib/isodoc/ieee/word_authority.rb +37 -59
  20. data/lib/isodoc/ieee/word_cleanup.rb +83 -35
  21. data/lib/isodoc/ieee/word_cleanup_blocks.rb +0 -1
  22. data/lib/isodoc/ieee/word_convert.rb +19 -16
  23. data/lib/isodoc/ieee/word_toc.rb +46 -0
  24. data/lib/metanorma/ieee/boilerplate.adoc +6 -5
  25. data/lib/metanorma/ieee/boilerplate_wp.adoc +1 -2
  26. data/lib/metanorma/ieee/cleanup.rb +56 -9
  27. data/lib/metanorma/ieee/cleanup_boilerplate.rb +1 -4
  28. data/lib/metanorma/ieee/cleanup_ref.rb +0 -98
  29. data/lib/metanorma/ieee/cleanup_ref_fn.rb +116 -0
  30. data/lib/metanorma/ieee/front.rb +26 -0
  31. data/lib/metanorma/ieee/isodoc.rng +19 -1
  32. data/lib/metanorma/ieee/processor.rb +1 -0
  33. data/lib/metanorma/ieee/relaton-ieee.rng +4 -0
  34. data/lib/metanorma/ieee/validate.rb +1 -1
  35. data/lib/metanorma/ieee/version.rb +1 -1
  36. metadata +5 -2
@@ -157,104 +157,6 @@ module Metanorma
157
157
  bib.xpath("./contributor[role/@type = 'publisher']/organization/name")
158
158
  .map(&:text)
159
159
  end
160
-
161
- BIBITEM_NO_AVAIL =
162
- "//references/bibitem[not(note[@type = 'Availability'])]".freeze
163
-
164
- def withdrawn_note(xmldoc, provenance_notes)
165
- xmldoc.xpath(BIBITEM_NO_AVAIL).each do |b|
166
- bib_pubs(b).include?(IEEE) or next
167
- b.at("./status/stage")&.text == "withdrawn" or next
168
- docid = b.at("./docidentifier[@type = 'IEEE'][not(@scope)]")
169
- note = provenance_notes["ieee-withdrawn"].sub("%", docid.text)
170
- insert_availability_note(b, note)
171
- end
172
- end
173
-
174
- AVAIL_PUBS = {
175
- ieee: IEEE,
176
- cispr: "International special committee on radio interference",
177
- etsi: "European Telecommunications Standards Institute",
178
- oasis: "OASIS",
179
- "w3c": "World Wide Web Consortium",
180
- "3gpp": "3rd Generation Partnership Project",
181
- }.freeze
182
-
183
- def available_note(xmldoc, provenance_notes)
184
- iso_iec_available_note(xmldoc, provenance_notes["iso-iec"], true, true)
185
- iso_iec_available_note(xmldoc, provenance_notes["iso"], true, false)
186
- iso_iec_available_note(xmldoc, provenance_notes["iec"], false, true)
187
- itu_available_note(xmldoc, provenance_notes["itut"], true)
188
- itu_available_note(xmldoc, provenance_notes["itur"], false)
189
- nist_available_note(xmldoc, provenance_notes["fips"], true)
190
- nist_available_note(xmldoc, provenance_notes["nist"], false)
191
- ietf_available_note(xmldoc, provenance_notes["ietf"])
192
- AVAIL_PUBS.each do |k, v|
193
- sdo_available_note(xmldoc, provenance_notes[k.to_s], v)
194
- end
195
- end
196
-
197
- def sdo_available_note(xmldoc, note, publisher)
198
- ret = xmldoc.xpath(BIBITEM_NO_AVAIL).detect do |b|
199
- bib_pubs(b).include?(publisher)
200
- end
201
- insert_availability_note(ret, note)
202
- end
203
-
204
- def iso_iec_available_note(xmldoc, note, iso, iec)
205
- ret = xmldoc.xpath(BIBITEM_NO_AVAIL).detect do |b|
206
- pubs = bib_pubs(b)
207
- has_iec = pubs.include?("International Electrotechnical Commission")
208
- has_iso = pubs.include?("International Organization for Standardization")
209
- ((has_iec && iec) || (!has_iec && !iec)) &&
210
- ((has_iso && iso) || (!has_iso && !iso))
211
- end
212
- insert_availability_note(ret, note)
213
- end
214
-
215
- def ietf_available_note(xmldoc, note)
216
- ret = xmldoc.xpath(BIBITEM_NO_AVAIL).detect do |b|
217
- b.at("./docidentifier[@type = 'IETF']")
218
- end
219
- insert_availability_note(ret, note)
220
- end
221
-
222
- def itu_available_note(xmldoc, note, itu_t)
223
- ret = xmldoc.xpath(BIBITEM_NO_AVAIL).detect do |b|
224
- has_itu_t = /^ITU-T/.match?(b.at("./docidentifier[@type = 'ITU']")&.text)
225
- bib_pubs(b).include?("International Telecommunication Union") &&
226
- !has_itu_t && !itu_t || (has_itu_t && itu_t)
227
- end
228
- insert_availability_note(ret, note)
229
- end
230
-
231
- def nist_available_note(xmldoc, note, fips)
232
- ret = xmldoc.xpath(BIBITEM_NO_AVAIL).detect do |b|
233
- id = b.at("./docidentifier[@type = 'NIST']")
234
- has_fips = /\bFIPS\b/.match?(id&.text)
235
- id && ((has_fips && !fips) || (!has_fips && fips))
236
- end
237
- insert_availability_note(ret, note)
238
- end
239
-
240
- def insert_availability_note(bib, msg)
241
- bib or return
242
- Array(msg).each do |msg1|
243
- note = %(<note type="Availability"><p>#{msg1}</p></note>)
244
- if b = insert_availability_note_ins(bib)
245
- b.next = note
246
- end
247
- end
248
- end
249
-
250
- def insert_availability_note_ins(bib)
251
- if b = bib.at("./language | ./script | ./abstract | ./status")
252
- b.previous
253
- else bib.at("./contributor") || bib.at("./date") ||
254
- bib.at("./docnumber") || bib.at("./docidentifier") ||
255
- bib.at("./title")
256
- end
257
- end
258
160
  end
259
161
  end
260
162
  end
@@ -0,0 +1,116 @@
1
+ module Metanorma
2
+ module Ieee
3
+ class Converter < Standoc::Converter
4
+ BIBITEM_NO_AVAIL =
5
+ "//references[@normative='true']/bibitem[not(note[@type = 'Availability'])] | "\
6
+ "//references[@normative='false']/bibitem[not(note[@type = 'Availability'])]".freeze
7
+
8
+ def sorted_bibitem_no_avail(xmldoc)
9
+ # Get normative references first, maintaining their order
10
+ normative_bibitems = xmldoc.xpath("//references[@normative='true']/bibitem[not(note[@type = 'Availability'])]")
11
+
12
+ # Get non-normative references second, maintaining their order
13
+ non_normative_bibitems = xmldoc.xpath("//references[@normative='false']/bibitem[not(note[@type = 'Availability'])]")
14
+
15
+ # Return concatenated array with normative first
16
+ normative_bibitems.to_a + non_normative_bibitems.to_a
17
+ end
18
+
19
+ def withdrawn_note(xmldoc, provenance_notes)
20
+ sorted_bibitem_no_avail(xmldoc).each do |b|
21
+ bib_pubs(b).include?(IEEE) or next
22
+ b.at("./status/stage")&.text == "withdrawn" or next
23
+ docid = b.at("./docidentifier[@type = 'IEEE'][not(@scope)]")
24
+ note = provenance_notes["ieee-withdrawn"].sub("%", docid.text)
25
+ insert_availability_note(b, note)
26
+ end
27
+ end
28
+
29
+ AVAIL_PUBS = {
30
+ ieee: IEEE,
31
+ cispr: "International special committee on radio interference",
32
+ etsi: "European Telecommunications Standards Institute",
33
+ oasis: "OASIS",
34
+ "w3c": "World Wide Web Consortium",
35
+ "3gpp": "3rd Generation Partnership Project",
36
+ }.freeze
37
+
38
+ def available_note(xmldoc, provenance_notes)
39
+ bibitems = sorted_bibitem_no_avail(xmldoc)
40
+ iso_iec_available_note(bibitems, provenance_notes["iso-iec"], true, true)
41
+ iso_iec_available_note(bibitems, provenance_notes["iso"], true, false)
42
+ iso_iec_available_note(bibitems, provenance_notes["iec"], false, true)
43
+ itu_available_note(bibitems, provenance_notes["itut"], true)
44
+ itu_available_note(bibitems, provenance_notes["itur"], false)
45
+ nist_available_note(bibitems, provenance_notes["fips"], true)
46
+ nist_available_note(bibitems, provenance_notes["nist"], false)
47
+ ietf_available_note(bibitems, provenance_notes["ietf"])
48
+ AVAIL_PUBS.each do |k, v|
49
+ sdo_available_note(bibitems, provenance_notes[k.to_s], v)
50
+ end
51
+ end
52
+
53
+ def sdo_available_note(bibitems, note, publisher)
54
+ ret = bibitems.detect do |b|
55
+ bib_pubs(b).include?(publisher)
56
+ end
57
+ insert_availability_note(ret, note)
58
+ end
59
+
60
+ def iso_iec_available_note(bibitems, note, iso, iec)
61
+ ret = bibitems.detect do |b|
62
+ pubs = bib_pubs(b)
63
+ has_iec = pubs.include?("International Electrotechnical Commission")
64
+ has_iso = pubs.include?("International Organization for Standardization")
65
+ ((has_iec && iec) || (!has_iec && !iec)) &&
66
+ ((has_iso && iso) || (!has_iso && !iso))
67
+ end
68
+ insert_availability_note(ret, note)
69
+ end
70
+
71
+ def ietf_available_note(bibitems, note)
72
+ ret = bibitems.detect do |b|
73
+ b.at("./docidentifier[@type = 'IETF']")
74
+ end
75
+ insert_availability_note(ret, note)
76
+ end
77
+
78
+ def itu_available_note(bibitems, note, itu_t)
79
+ ret = bibitems.detect do |b|
80
+ has_itu_t = /^ITU-T/.match?(b.at("./docidentifier[@type = 'ITU']")&.text)
81
+ bib_pubs(b).include?("International Telecommunication Union") &&
82
+ !has_itu_t && !itu_t || (has_itu_t && itu_t)
83
+ end
84
+ insert_availability_note(ret, note)
85
+ end
86
+
87
+ def nist_available_note(bibitems, note, fips)
88
+ ret = bibitems.detect do |b|
89
+ id = b.at("./docidentifier[@type = 'NIST']")
90
+ has_fips = /\bFIPS\b/.match?(id&.text)
91
+ id && ((has_fips && !fips) || (!has_fips && fips))
92
+ end
93
+ insert_availability_note(ret, note)
94
+ end
95
+
96
+ def insert_availability_note(bib, msg)
97
+ bib or return
98
+ Array(msg).each do |msg1|
99
+ note = %(<note type="Availability"><p>#{msg1}</p></note>)
100
+ if b = insert_availability_note_ins(bib)
101
+ b.next = note
102
+ end
103
+ end
104
+ end
105
+
106
+ def insert_availability_note_ins(bib)
107
+ if b = bib.at("./language | ./script | ./abstract | ./status")
108
+ b.previous
109
+ else bib.at("./contributor") || bib.at("./date") ||
110
+ bib.at("./docnumber") || bib.at("./docidentifier") ||
111
+ bib.at("./title")
112
+ end
113
+ end
114
+ end
115
+ end
116
+ end
@@ -91,6 +91,7 @@ module Metanorma
91
91
  ret = { number: node.attr("docnumber"),
92
92
  part: node.attr("partnumber"),
93
93
  year: ieee_id_year(node, initial: true),
94
+ draft: ieee_draft_numbers(node),
94
95
  redline: @doctype == "redline",
95
96
  publisher: pub[0],
96
97
  copublisher: pub[1..-1] }
@@ -98,6 +99,12 @@ module Metanorma
98
99
  compact_blank(ret)
99
100
  end
100
101
 
102
+ def ieee_draft_numbers(node)
103
+ draft = node.attr("draft") or return nil
104
+ d = draft.split(".")
105
+ { version: d[0], revision: d[1] }.compact
106
+ end
107
+
101
108
  def ieee_id_params_amd(node, core)
102
109
  if a = node.attr("corrigendum-number")
103
110
  { corrigendum: { version: a,
@@ -186,6 +193,25 @@ module Metanorma
186
193
  a = node.attr("copyright-year") and i.year a
187
194
  end
188
195
  end
196
+
197
+ def title_english(node, xml)
198
+ title = node.attr("title") || node.attr("title-en") ||
199
+ node.attr("doctitle")
200
+ title_english1(title, "title-main", xml)
201
+ title_english1(node.attr("title-full"), "main", xml)
202
+ title_english1(node.attr("title-abbrev"), "title-abbrev", xml)
203
+ end
204
+
205
+ def title_english1(title, type, xml)
206
+ title.nil? and return
207
+ at = { language: "en", format: "text/plain" }
208
+ title = Metanorma::Utils::asciidoc_sub(title)
209
+ xml.title **attr_code(at.merge(type: type)) do |t|
210
+ t << title
211
+ end
212
+ end
213
+
214
+ def title_otherlangs(node, xml); end
189
215
  end
190
216
  end
191
217
  end
@@ -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.1 -->
3
+ <!-- VERSION v2.1.2 -->
4
4
 
5
5
  <!--
6
6
  ALERT: cannot have root comments, because of https://github.com/metanorma/metanorma/issues/437
@@ -123,6 +123,10 @@ the type attribute defaults to `review` for reviews</a:documentation>
123
123
  <a:documentation>Notes whose scope is the current block</a:documentation>
124
124
  </ref>
125
125
  </zeroOrMore>
126
+ <ref name="BlockSource">
127
+ <a:documentation>Bibliographic source for the information in the list.
128
+ Sources are currently only rendered in metanorma-plateau</a:documentation>
129
+ </ref>
126
130
  </define>
127
131
  <define name="OlBody">
128
132
  <optional>
@@ -140,6 +144,10 @@ the type attribute defaults to `review` for reviews</a:documentation>
140
144
  <a:documentation>Notes whose scope is the current block</a:documentation>
141
145
  </ref>
142
146
  </zeroOrMore>
147
+ <ref name="BlockSource">
148
+ <a:documentation>Bibliographic source for the information in the list.
149
+ Sources are currently only rendered in metanorma-plateau</a:documentation>
150
+ </ref>
143
151
  </define>
144
152
  <define name="OlAttributes">
145
153
  <a:documentation>NOTE: `start` attribute is not included by default, because of problems it raises with DOC output</a:documentation>
@@ -188,6 +196,10 @@ the type attribute defaults to `review` for reviews</a:documentation>
188
196
  <a:documentation>Notes whose scope is the current block</a:documentation>
189
197
  </ref>
190
198
  </zeroOrMore>
199
+ <ref name="BlockSource">
200
+ <a:documentation>Bibliographic source for the information in the list.
201
+ Sources are currently only rendered in metanorma-plateau</a:documentation>
202
+ </ref>
191
203
  </define>
192
204
  <define name="dt">
193
205
  <element name="dt">
@@ -871,6 +883,12 @@ titlecase, or lowercase</a:documentation>
871
883
  </oneOrMore>
872
884
  </element>
873
885
  </define>
886
+ <define name="ParagraphFnBody" combine="interleave">
887
+ <ref name="BlockSource">
888
+ <a:documentation>Bibliographic source for the information in the paragraph
889
+ parargaph sources are currently only rendered in metanorma-plateau</a:documentation>
890
+ </ref>
891
+ </define>
874
892
  <define name="BasicBlock" combine="choice">
875
893
  <ref name="columnbreak"/>
876
894
  </define>
@@ -26,6 +26,7 @@ module Metanorma
26
26
  "Source Han Sans" => nil,
27
27
  "Source Han Sans Normal" => nil,
28
28
  "STIX Two Math" => nil,
29
+ "Montserrat ExtraBold" => nil,
29
30
  }
30
31
  end
31
32
 
@@ -26,6 +26,10 @@
26
26
  <value>amendment</value>
27
27
  <value>corrigendum</value>
28
28
  <value>erratum</value>
29
+ <value>icap</value>
30
+ <value>document</value>
31
+ <value>industry-connections-report</value>
32
+ <value>industry-affiliate-network</value>
29
33
  </choice>
30
34
  </define>
31
35
  </include>
@@ -60,7 +60,7 @@ module Metanorma
60
60
  # Style manual 12.3.2
61
61
  def locality_erefs_validate(root)
62
62
  root.xpath("//eref[descendant::locality]").each do |t|
63
- if !/[:-](\d+{4})$/.match?(t["citeas"])
63
+ if !/[:-](\d+{4})($|-\d\d)/.match?(t["citeas"])
64
64
  @log.add("Style", t,
65
65
  "Undated reference #{t['citeas']} should not contain " \
66
66
  "specific elements")
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Ieee
3
- VERSION = "1.5.3".freeze
3
+ VERSION = "1.5.4".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.5.3
4
+ version: 1.5.4
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-08-18 00:00:00.000000000 Z
11
+ date: 2025-09-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-standoc
@@ -299,6 +299,7 @@ files:
299
299
  - lib/isodoc/ieee/metadata.rb
300
300
  - lib/isodoc/ieee/pdf_convert.rb
301
301
  - lib/isodoc/ieee/presentation_bibdata.rb
302
+ - lib/isodoc/ieee/presentation_bibitem.rb
302
303
  - lib/isodoc/ieee/presentation_concepts.rb
303
304
  - lib/isodoc/ieee/presentation_ref.rb
304
305
  - lib/isodoc/ieee/presentation_terms.rb
@@ -307,6 +308,7 @@ files:
307
308
  - lib/isodoc/ieee/word_cleanup.rb
308
309
  - lib/isodoc/ieee/word_cleanup_blocks.rb
309
310
  - lib/isodoc/ieee/word_convert.rb
311
+ - lib/isodoc/ieee/word_toc.rb
310
312
  - lib/isodoc/ieee/word_wp_cleanup.rb
311
313
  - lib/isodoc/ieee/word_wp_convert.rb
312
314
  - lib/isodoc/ieee/xref.rb
@@ -320,6 +322,7 @@ files:
320
322
  - lib/metanorma/ieee/cleanup.rb
321
323
  - lib/metanorma/ieee/cleanup_boilerplate.rb
322
324
  - lib/metanorma/ieee/cleanup_ref.rb
325
+ - lib/metanorma/ieee/cleanup_ref_fn.rb
323
326
  - lib/metanorma/ieee/converter.rb
324
327
  - lib/metanorma/ieee/front.rb
325
328
  - lib/metanorma/ieee/ieee-footnotes.yaml