metanorma-ieee 1.5.3 → 1.5.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.
- checksums.yaml +4 -4
- data/lib/isodoc/ieee/html/header.html +3 -3
- data/lib/isodoc/ieee/html/html_ieee_titlepage.html +15 -2
- data/lib/isodoc/ieee/html/htmlstyle.css +160 -46
- data/lib/isodoc/ieee/html/htmlstyle.scss +96 -0
- data/lib/isodoc/ieee/html/ieee.css +46 -1
- data/lib/isodoc/ieee/html/ieee.scss +42 -1
- data/lib/isodoc/ieee/html/word_ieee_titlepage.html +10 -2
- data/lib/isodoc/ieee/html/wordstyle.css +48 -0
- data/lib/isodoc/ieee/html/wordstyle.scss +44 -0
- data/lib/isodoc/ieee/html/wordstyle_wp.css +47 -0
- data/lib/isodoc/ieee/html/wordstyle_wp.scss +43 -0
- data/lib/isodoc/ieee/html_convert.rb +5 -0
- data/lib/isodoc/ieee/i18n-en.yaml +3 -0
- data/lib/isodoc/ieee/ieee.amendment.xsl +1526 -964
- data/lib/isodoc/ieee/ieee.standard.xsl +1526 -964
- data/lib/isodoc/ieee/metadata.rb +22 -11
- data/lib/isodoc/ieee/presentation_bibitem.rb +103 -0
- data/lib/isodoc/ieee/presentation_ref.rb +169 -97
- data/lib/isodoc/ieee/presentation_terms.rb +52 -12
- data/lib/isodoc/ieee/presentation_xml_convert.rb +24 -75
- data/lib/isodoc/ieee/word_authority.rb +37 -59
- data/lib/isodoc/ieee/word_cleanup.rb +83 -35
- data/lib/isodoc/ieee/word_cleanup_blocks.rb +0 -1
- data/lib/isodoc/ieee/word_convert.rb +19 -16
- data/lib/isodoc/ieee/word_toc.rb +46 -0
- data/lib/metanorma/ieee/boilerplate.adoc +6 -5
- data/lib/metanorma/ieee/boilerplate_wp.adoc +1 -2
- data/lib/metanorma/ieee/cleanup.rb +69 -15
- data/lib/metanorma/ieee/cleanup_boilerplate.rb +1 -4
- data/lib/metanorma/ieee/cleanup_ref.rb +33 -106
- data/lib/metanorma/ieee/cleanup_ref_fn.rb +117 -0
- data/lib/metanorma/ieee/front.rb +14 -0
- data/lib/metanorma/ieee/isodoc.rng +44 -19
- data/lib/metanorma/ieee/processor.rb +1 -0
- data/lib/metanorma/ieee/relaton-ieee.rng +4 -0
- data/lib/metanorma/ieee/validate.rb +1 -1
- data/lib/metanorma/ieee/version.rb +1 -1
- data/lib/relaton/render/config.yml +10 -3
- metadata +5 -2
@@ -1,4 +1,5 @@
|
|
1
1
|
require_relative "cleanup_ref"
|
2
|
+
require_relative "cleanup_ref_fn"
|
2
3
|
require_relative "cleanup_boilerplate"
|
3
4
|
require_relative "term_lookup_cleanup"
|
4
5
|
|
@@ -45,13 +46,13 @@ module Metanorma
|
|
45
46
|
|
46
47
|
def note_cleanup(xmldoc)
|
47
48
|
super
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
"//
|
52
|
-
|
49
|
+
type = "[not(@type = 'boilerplate' or @type = 'Availability' or " \
|
50
|
+
"@type = 'license')]"
|
51
|
+
n = xmldoc.at("//preface//note#{type}[not(./ancestor::abstract)] | " \
|
52
|
+
"//sections//note#{type} | //termnote#{type} | " \
|
53
|
+
"//annex//note#{type}") or return
|
53
54
|
ins = n.at("./p[last()]")
|
54
|
-
ins << "<fn reference='
|
55
|
+
ins << "<fn reference='_note_cleanup1'>" \
|
55
56
|
"<p>#{@i18n.note_inform_fn}</p></fn>"
|
56
57
|
add_id(ins.last_element_child)
|
57
58
|
end
|
@@ -94,13 +95,13 @@ module Metanorma
|
|
94
95
|
end
|
95
96
|
|
96
97
|
def boilerplate_isodoc(xmldoc)
|
97
|
-
x = xmldoc.
|
98
|
-
x.root.add_namespace(nil, xml_namespace)
|
98
|
+
x = dup_with_namespace(xmldoc.root)
|
99
99
|
xml = Nokogiri::XML(x.to_xml)
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
100
|
+
@isodoc ||= isodoc(@lang, @script, @locale)
|
101
|
+
@isodoc.bibdata_i18n(xml.at("//xmlns:bibdata"))
|
102
|
+
@isodoc.localdir = @localdir
|
103
|
+
@isodoc.info(xml, nil)
|
104
|
+
@isodoc
|
104
105
|
end
|
105
106
|
|
106
107
|
def text_from_paras(node)
|
@@ -110,17 +111,56 @@ module Metanorma
|
|
110
111
|
|
111
112
|
def bibdata_cleanup(xmldoc)
|
112
113
|
super
|
114
|
+
draft_id(xmldoc)
|
115
|
+
main_title(xmldoc)
|
116
|
+
prefixed_title(xmldoc)
|
113
117
|
provenance_title(xmldoc)
|
114
118
|
end
|
115
119
|
|
120
|
+
def main_title(xmldoc)
|
121
|
+
t = xmldoc.at("//bibdata/title[@type = 'main']") and
|
122
|
+
t["type"] = "title-main"
|
123
|
+
t = xmldoc.at("//bibdata/title[@type = 'title-full']") and
|
124
|
+
t["type"] = "main"
|
125
|
+
end
|
126
|
+
|
127
|
+
def prefixed_title(xmldoc)
|
128
|
+
t, stage, trial = prefixed_title_prep(xmldoc)
|
129
|
+
%w(main title-abbrev).reverse_each do |type|
|
130
|
+
xmldoc.at("//bibdata/title[@type = '#{type}']") and next
|
131
|
+
p = prefixed_title1(stage, trial, type)
|
132
|
+
t.previous = <<~XML
|
133
|
+
<title type='#{type}' language='en'>#{p}#{to_xml(t.children)}</title>
|
134
|
+
XML
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
def prefixed_title1(stage, trial, type)
|
139
|
+
m = []
|
140
|
+
m << (stage == "draft" ? "Draft" : "IEEE")
|
141
|
+
trial and m << "Trial-Use"
|
142
|
+
doctype = @doctype.split(/[- ]/).map(&:capitalize).join(" ")
|
143
|
+
type == "title-abbrev" && a = @i18n.get["doctype_abbrev"][@doctype] and
|
144
|
+
doctype = a
|
145
|
+
m << doctype
|
146
|
+
m << "for"
|
147
|
+
"#{m.join(' ')} "
|
148
|
+
end
|
149
|
+
|
150
|
+
def prefixed_title_prep(xmldoc)
|
151
|
+
t = xmldoc.at("//bibdata/title[@type = 'title-main']")
|
152
|
+
stage = xmldoc.at("//status/stage")&.text
|
153
|
+
trial = xmldoc.at("//bibdata/ext/trial-use[text() = 'true']")
|
154
|
+
[t, stage, trial]
|
155
|
+
end
|
156
|
+
|
116
157
|
def provenance_title(xmldoc)
|
117
158
|
u = xmldoc.xpath("//bibdata/relation[@type = 'updates']")
|
118
159
|
m = xmldoc.xpath("//bibdata/relation[@type = 'merges']")
|
119
160
|
u.empty? and m.empty? and return
|
120
|
-
ins = xmldoc.at("//bibdata/title")
|
161
|
+
ins = xmldoc.at("//bibdata/title[@type = 'title-main']")
|
121
162
|
t = provenance_title1(u, m)
|
122
|
-
ins.next = "<title type='provenance' language='en'
|
123
|
-
"format='application/xml'>#{t}</title>"
|
163
|
+
ins.next = "<title type='provenance' language='en'>#{t}</title>"
|
124
164
|
end
|
125
165
|
|
126
166
|
def provenance_title1(updates, merges)
|
@@ -142,6 +182,20 @@ module Metanorma
|
|
142
182
|
u.at("./bibitem/docidentifier")
|
143
183
|
end.map(&:text)
|
144
184
|
end
|
185
|
+
|
186
|
+
def published?(stage, _xmldoc)
|
187
|
+
%w(approved superseded withdrawn).include?(stage&.downcase)
|
188
|
+
end
|
189
|
+
|
190
|
+
# IEEE Draft Std 10000-2025/D1.2 => P10000/D1.2
|
191
|
+
# TODO: this needs to go to pubid-ieee
|
192
|
+
def draft_id(xmldoc)
|
193
|
+
published?(xmldoc.at("//bibdata/status/stage")&.text, xmldoc) and return
|
194
|
+
id = xmldoc.at("//bibdata/docidentifier[@type = 'IEEE']") or return
|
195
|
+
id.text.start_with?("IEEE Draft Std ") or return
|
196
|
+
n = id.text.sub(/^IEEE Draft Std /, "P").sub(/(\d)-(\d\d\d\d)/, "\\1")
|
197
|
+
id.next = %(<docidentifier type="IEEE-draft">#{n}</docidentifier>)
|
198
|
+
end
|
145
199
|
end
|
146
200
|
end
|
147
201
|
end
|
@@ -19,10 +19,7 @@ module Metanorma
|
|
19
19
|
|
20
20
|
def intro_boilerplate(xml, isodoc)
|
21
21
|
intro = xml.at("//introduction/title") or return
|
22
|
-
|
23
|
-
This introduction is not part of P{{ docnumeric }}{% if draft %}/D{{ draft }}{% endif %}, {{ full_doctitle }}
|
24
|
-
ADM
|
25
|
-
adm = isodoc.populate_template(template)
|
22
|
+
adm = isodoc.populate_template(@i18n.introduction_disclaimer)
|
26
23
|
intro.next = "<admonition>#{adm}</admonition>"
|
27
24
|
add_id(intro.next)
|
28
25
|
end
|
@@ -40,15 +40,15 @@ module Metanorma
|
|
40
40
|
|
41
41
|
def designator_or_name(bib)
|
42
42
|
id = designator_docid(bib)
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
43
|
+
if %w(standard techreport).include?(bib["type"]) && id != "ZZZZ" &&
|
44
|
+
id != bib.at("./docidentifier[@type='metanorma']")&.text
|
45
|
+
ret = id
|
46
|
+
else
|
47
|
+
bib1 = dup_with_namespace(bib)
|
48
|
+
n = @i.creatornames(bib1)
|
49
|
+
n.nil? && bib["type"].nil? and n = id
|
50
|
+
ret = n
|
51
|
+
end
|
52
52
|
[ret, id]
|
53
53
|
end
|
54
54
|
|
@@ -121,6 +121,10 @@ module Metanorma
|
|
121
121
|
"@type = 'metanorma-ordinal']")
|
122
122
|
if /^\[?\d+\]?$/.match?(docid&.text)
|
123
123
|
docid.children = "[B#{idx}]"
|
124
|
+
# fix metanorma to metanorma-ordinal if designation supplied
|
125
|
+
if bib.at("./docidentifier[@type = 'title']")
|
126
|
+
docid["type"] = "metanorma-ordinal"
|
127
|
+
end
|
124
128
|
elsif docid = bib.at("./docidentifier") || bib.at("./title[last()]") ||
|
125
129
|
bib.at("./formattedref")
|
126
130
|
docid.next =
|
@@ -130,7 +134,7 @@ module Metanorma
|
|
130
134
|
|
131
135
|
def select_docid(ref, type = nil)
|
132
136
|
ret = super
|
133
|
-
if %w(standard
|
137
|
+
if %w(standard).include?(ref["type"]) then ret
|
134
138
|
else
|
135
139
|
ref.at("./docidentifier[@type = 'metanorma-ordinal']") || ret
|
136
140
|
end
|
@@ -143,6 +147,22 @@ module Metanorma
|
|
143
147
|
|
144
148
|
def bibitem_cleanup(xmldoc)
|
145
149
|
super
|
150
|
+
supply_designations(xmldoc)
|
151
|
+
supply_withdrawn_notes(xmldoc)
|
152
|
+
end
|
153
|
+
|
154
|
+
# force existence of a designation for standards
|
155
|
+
def supply_designations(xmldoc)
|
156
|
+
xmldoc.xpath("//references/bibitem[@type = 'standard']").each do |b|
|
157
|
+
b.at("./docidentifier[not(@type = 'metanorma' or @type = 'DOI' or " \
|
158
|
+
"@type = 'metanorma-ordinal')]") and next
|
159
|
+
t = b.at("./title") or next
|
160
|
+
b.at("./title[last()]").next =
|
161
|
+
"<docidentifier type='title' primary='true'>#{t.text}</docidentifier>"
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
def supply_withdrawn_notes(xmldoc)
|
146
166
|
f = File.join(File.dirname(__FILE__), "ieee-footnotes.yaml")
|
147
167
|
@provenance_notes = YAML.safe_load(File.read(f))
|
148
168
|
withdrawn_note(xmldoc, @provenance_notes)
|
@@ -158,102 +178,9 @@ module Metanorma
|
|
158
178
|
.map(&:text)
|
159
179
|
end
|
160
180
|
|
161
|
-
|
162
|
-
"
|
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
|
181
|
+
def reference_names(xmldoc)
|
182
|
+
#require "debug"; binding.b
|
183
|
+
super
|
257
184
|
end
|
258
185
|
end
|
259
186
|
end
|
@@ -0,0 +1,117 @@
|
|
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']/" \
|
11
|
+
"bibitem[not(note[@type = 'Availability'])]")
|
12
|
+
# Get non-normative references second, maintaining their order
|
13
|
+
non_normative_bibitems = xmldoc.xpath("//references[@normative='false']/" \
|
14
|
+
"bibitem[not(note[@type = 'Availability'])]")
|
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,
|
41
|
+
true)
|
42
|
+
iso_iec_available_note(bibitems, provenance_notes["iso"], true, false)
|
43
|
+
iso_iec_available_note(bibitems, provenance_notes["iec"], false, true)
|
44
|
+
itu_available_note(bibitems, provenance_notes["itut"], true)
|
45
|
+
itu_available_note(bibitems, provenance_notes["itur"], false)
|
46
|
+
nist_available_note(bibitems, provenance_notes["fips"], true)
|
47
|
+
nist_available_note(bibitems, provenance_notes["nist"], false)
|
48
|
+
ietf_available_note(bibitems, provenance_notes["ietf"])
|
49
|
+
AVAIL_PUBS.each do |k, v|
|
50
|
+
sdo_available_note(bibitems, provenance_notes[k.to_s], v)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def sdo_available_note(bibitems, note, publisher)
|
55
|
+
ret = bibitems.detect do |b|
|
56
|
+
bib_pubs(b).include?(publisher)
|
57
|
+
end
|
58
|
+
insert_availability_note(ret, note)
|
59
|
+
end
|
60
|
+
|
61
|
+
def iso_iec_available_note(bibitems, note, iso, iec)
|
62
|
+
ret = bibitems.detect do |b|
|
63
|
+
pubs = bib_pubs(b)
|
64
|
+
has_iec = pubs.include?("International Electrotechnical Commission")
|
65
|
+
has_iso = pubs.include?("International Organization for Standardization")
|
66
|
+
((has_iec && iec) || (!has_iec && !iec)) &&
|
67
|
+
((has_iso && iso) || (!has_iso && !iso))
|
68
|
+
end
|
69
|
+
insert_availability_note(ret, note)
|
70
|
+
end
|
71
|
+
|
72
|
+
def ietf_available_note(bibitems, note)
|
73
|
+
ret = bibitems.detect do |b|
|
74
|
+
b.at("./docidentifier[@type = 'IETF']")
|
75
|
+
end
|
76
|
+
insert_availability_note(ret, note)
|
77
|
+
end
|
78
|
+
|
79
|
+
def itu_available_note(bibitems, note, itu_t)
|
80
|
+
ret = bibitems.detect do |b|
|
81
|
+
has_itu_t = /^ITU-T/.match?(b.at("./docidentifier[@type = 'ITU']")&.text)
|
82
|
+
bib_pubs(b).include?("International Telecommunication Union") &&
|
83
|
+
!has_itu_t && !itu_t || (has_itu_t && itu_t)
|
84
|
+
end
|
85
|
+
insert_availability_note(ret, note)
|
86
|
+
end
|
87
|
+
|
88
|
+
def nist_available_note(bibitems, note, fips)
|
89
|
+
ret = bibitems.detect do |b|
|
90
|
+
id = b.at("./docidentifier[@type = 'NIST']")
|
91
|
+
has_fips = /\bFIPS\b/.match?(id&.text)
|
92
|
+
id && ((has_fips && !fips) || (!has_fips && fips))
|
93
|
+
end
|
94
|
+
insert_availability_note(ret, note)
|
95
|
+
end
|
96
|
+
|
97
|
+
def insert_availability_note(bib, msg)
|
98
|
+
bib or return
|
99
|
+
Array(msg).each do |msg1|
|
100
|
+
note = %(<note type="Availability"><p>#{msg1}</p></note>)
|
101
|
+
if b = insert_availability_note_ins(bib)
|
102
|
+
b.next = note
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
def insert_availability_note_ins(bib)
|
108
|
+
if b = bib.at("./language | ./script | ./abstract | ./status")
|
109
|
+
b.previous
|
110
|
+
else bib.at("./contributor") || bib.at("./date") ||
|
111
|
+
bib.at("./docnumber") || bib.at("./docidentifier") ||
|
112
|
+
bib.at("./title")
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
data/lib/metanorma/ieee/front.rb
CHANGED
@@ -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,13 @@ module Metanorma
|
|
186
193
|
a = node.attr("copyright-year") and i.year a
|
187
194
|
end
|
188
195
|
end
|
196
|
+
|
197
|
+
def title_other(node, xml)
|
198
|
+
t = node.attr("title-full") and
|
199
|
+
add_title_xml(xml, t, @lang, "title-full")
|
200
|
+
t = node.attr("title-abbrev") and
|
201
|
+
add_title_xml(xml, t, @lang, "title-abbrev")
|
202
|
+
end
|
189
203
|
end
|
190
204
|
end
|
191
205
|
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.
|
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
|
@@ -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">
|
@@ -443,14 +455,7 @@ normative or informative references, some split references into sections organiz
|
|
443
455
|
</ref>
|
444
456
|
</zeroOrMore>
|
445
457
|
<zeroOrMore>
|
446
|
-
<ref name="
|
447
|
-
<a:documentation>Bibliographic item cited in the document</a:documentation>
|
448
|
-
</ref>
|
449
|
-
<zeroOrMore>
|
450
|
-
<ref name="note">
|
451
|
-
<a:documentation>Annotation of the bibliographic item</a:documentation>
|
452
|
-
</ref>
|
453
|
-
</zeroOrMore>
|
458
|
+
<ref name="ReferenceEntry"/>
|
454
459
|
</zeroOrMore>
|
455
460
|
<zeroOrMore>
|
456
461
|
<ref name="references">
|
@@ -592,18 +597,21 @@ gives an explicit page orientation</a:documentation>
|
|
592
597
|
</element>
|
593
598
|
</optional>
|
594
599
|
</define>
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
<attribute name="hiddenref">
|
601
|
-
<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.
|
602
605
|
This is done if the footnote reference is already presented in some other form, e.g. within a figure image.</a:documentation>
|
603
|
-
|
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>
|
604
611
|
</attribute>
|
605
|
-
</
|
606
|
-
</
|
612
|
+
</define>
|
613
|
+
</include>
|
614
|
+
<!-- end overrides -->
|
607
615
|
<define name="TdAttributes" combine="interleave">
|
608
616
|
<ref name="RequiredId"/>
|
609
617
|
<optional>
|
@@ -841,6 +849,17 @@ titlecase, or lowercase</a:documentation>
|
|
841
849
|
<value>informative</value>
|
842
850
|
</choice>
|
843
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>
|
844
863
|
<define name="doc_bibitem">
|
845
864
|
<a:documentation>Standardisation document representation of bibliographic entry</a:documentation>
|
846
865
|
<element name="bibitem">
|
@@ -871,6 +890,12 @@ titlecase, or lowercase</a:documentation>
|
|
871
890
|
</oneOrMore>
|
872
891
|
</element>
|
873
892
|
</define>
|
893
|
+
<define name="ParagraphFnBody" combine="interleave">
|
894
|
+
<ref name="BlockSource">
|
895
|
+
<a:documentation>Bibliographic source for the information in the paragraph
|
896
|
+
parargaph sources are currently only rendered in metanorma-plateau</a:documentation>
|
897
|
+
</ref>
|
898
|
+
</define>
|
874
899
|
<define name="BasicBlock" combine="choice">
|
875
900
|
<ref name="columnbreak"/>
|
876
901
|
</define>
|
@@ -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})
|
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")
|
@@ -3,13 +3,20 @@ nametemplate:
|
|
3
3
|
two: "{% if nonpersonal[0] %}{{ nonpersonal[0] }}{% else %}{{surname[0] }} ,_{{initials[0] | join: '. '}}.{% endif %} , {{ labels['and'] }} {% if nonpersonal[1] %}{{ nonpersonal[1] }}{% else %}{{initials[1] | join: '. '}}. {{surname[1] }}{% endif %}"
|
4
4
|
more: "{% if nonpersonal[0] %}{{ nonpersonal[0] }}{% else %}{{surname[0] }} ,_{{initials[0] | join: '. '}}.{% endif %} , {% if nonpersonal[1] %}{{ nonpersonal[1] }}{% else %}{{initials[1] | join: '. '}}. {{surname[1] }}{% endif %} , {{ labels['and'] }} {% if nonpersonal[2] %}{{ nonpersonal[2] }}{% else %}{{initials[2] | join: '. '}}. {{surname[2] }}{% endif %}"
|
5
5
|
etal: "{% if nonpersonal[0] %}{{ nonpersonal[0] }}{% else %}{{surname[0] }} ,_{{initials[0] | join: '. '}}.{% endif %} , {% if nonpersonal[1] %}{{ nonpersonal[1] }}{% else %}{{initials[1] | join: '. '}}. {{surname[1] }}{% endif %} , {% if nonpersonal[2] %}{{ nonpersonal[2] }}{% else %}{{initials[2] | join: '. '}}. {{surname[2] }}{% endif %} <em>et al.</em>"
|
6
|
-
etal_count:
|
7
|
-
|
6
|
+
etal_count: 6
|
7
|
+
etal_display: 3
|
8
|
+
authorcitetemplate:
|
9
|
+
one: "{% if nonpersonal[0] %}{{ nonpersonal[0] }}{% else %}{{surname[0] }} {% endif %}"
|
10
|
+
two: "{% if nonpersonal[0] %}{{ nonpersonal[0] }}{% else %}{{surname[0] }}{% endif %} , {{ labels['and'] }} {% if nonpersonal[1] %}{{ nonpersonal[1] }}{% else %}{{surname[1] }}{% endif %}"
|
11
|
+
more: "{% if nonpersonal[0] %}{{ nonpersonal[0] }}{% else %}{{surname[0] }}{% endif %} , {% if nonpersonal[1] %}{{ nonpersonal[1] }}{% else %}{{surname[1] }}{% endif %} , {{ labels['and'] }} {% if nonpersonal[2] %}{{ nonpersonal[2] }}{% else %}{{surname[2] }}{% endif %}"
|
12
|
+
etal: "{% if nonpersonal[0] %}{{ nonpersonal[0] }}{% else %}{{surname[0] }}{% endif %} , {% if nonpersonal[1] %}{{ nonpersonal[1] }}{% else %}{{surname[1] }}{% endif %} , {% if nonpersonal[2] %}{{ nonpersonal[2] }}{% else %}{{surname[2] }}{% endif %} <em>et al.</em>"
|
13
|
+
etal_count: 3
|
14
|
+
etal_display: 1
|
8
15
|
extenttemplate:
|
9
16
|
misc: "{{ volume }}, {{issue}}, {{ page }}, {{ duration }}"
|
10
17
|
template:
|
11
18
|
# skip authoritative_identifier, it is inserted in front of formattedref within metanorma
|
12
|
-
standard: "{
|
19
|
+
standard: "{{ title }}{% if home_standard %}{%else%}, {% if uri %}{{ uri }}{% else %}{% if doi %}DOI: {{ doi | join: ', ' }}{% endif %}{% endif %}{% endif %}."
|
13
20
|
article: "{{creatornames}}, “{{title}},” <em>{{ series }}</em>, {{ extent }}, {{ date }}, {{ labels['viewed'] }}_{{date_accessed}}, {% if uri %}{{ uri }}{% else %}{% if doi %}DOI: {{ doi | join: ', ' }}{% endif %}{% endif %} ."
|
14
21
|
book: "{{creatornames}}, <em>{{title}}</em>, {{ edition }}, {{place}}: {{publisher}}, {{date}}, {{ labels['viewed'] }}_{{date_accessed}}, {% if uri %}{{ uri }}{% else %}{% if doi %}DOI: {{ doi | join: ', ' }}{% endif %}{% endif %} ."
|
15
22
|
techreport: book
|