metanorma-ieee 1.5.4 → 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/htmlstyle.css +160 -46
- data/lib/isodoc/ieee/html/htmlstyle.scss +96 -0
- data/lib/isodoc/ieee/html_convert.rb +5 -0
- data/lib/isodoc/ieee/i18n-en.yaml +1 -0
- data/lib/isodoc/ieee/ieee.amendment.xsl +427 -558
- data/lib/isodoc/ieee/ieee.standard.xsl +427 -558
- data/lib/isodoc/ieee/presentation_bibitem.rb +1 -0
- data/lib/isodoc/ieee/presentation_ref.rb +31 -12
- data/lib/isodoc/ieee/presentation_xml_convert.rb +9 -8
- data/lib/metanorma/ieee/cleanup.rb +14 -7
- data/lib/metanorma/ieee/cleanup_ref.rb +35 -10
- data/lib/metanorma/ieee/cleanup_ref_fn.rb +7 -6
- data/lib/metanorma/ieee/front.rb +5 -17
- data/lib/metanorma/ieee/isodoc.rng +26 -19
- data/lib/metanorma/ieee/version.rb +1 -1
- data/lib/relaton/render/config.yml +10 -3
- metadata +2 -2
@@ -18,7 +18,7 @@ module IsoDoc
|
|
18
18
|
# Style manual 19
|
19
19
|
def anchor_linkend(node, linkend)
|
20
20
|
if node["citeas"] && i = @bibanchors[node["bibitemid"]]
|
21
|
-
biblio_anchor_linkend(node, i)
|
21
|
+
biblio_anchor_linkend(node, i, linkend)
|
22
22
|
elsif node["citeas"] && (i = @normrefanchors[node["bibitemid"]])
|
23
23
|
cit = normref_anchor_linkend(node, i)
|
24
24
|
cit || super
|
@@ -28,28 +28,47 @@ module IsoDoc
|
|
28
28
|
|
29
29
|
# force Author-Date referencing on non-standards in norm ref
|
30
30
|
def normref_anchor_linkend(node, bib)
|
31
|
-
|
32
|
-
%w(
|
31
|
+
@ref_renderings or return nil
|
32
|
+
%w(standard).include?(bib[:type]) and return nil
|
33
33
|
cit = @ref_renderings[node["bibitemid"]][:citation]&.strip
|
34
34
|
cit.empty? and cit = nil
|
35
35
|
cit
|
36
36
|
end
|
37
37
|
|
38
|
-
def biblio_anchor_linkend(node, bib)
|
39
|
-
if %w(
|
40
|
-
|
41
|
-
to_xml(node.children).strip
|
42
|
-
elsif node["citeas"] == bib[:ord] then node["citeas"]
|
43
|
-
else [node["citeas"], bib[:ord]].compact.join(" ")
|
44
|
-
end
|
38
|
+
def biblio_anchor_linkend(node, bib, linkend)
|
39
|
+
if %w(standard).include?(bib[:type])
|
40
|
+
biblio_anchor_linkend_std(node, bib, linkend)
|
45
41
|
else biblio_anchor_linkend_nonstd(node, bib)
|
46
42
|
end
|
47
43
|
end
|
48
44
|
|
45
|
+
def linkend_content(node)
|
46
|
+
c1 = non_locality_elems(node).select { |c| !c.text? || /\S/.match(c) }
|
47
|
+
c2 = node.xpath(ns("./locality | ./localityStack"))
|
48
|
+
[c1, c2]
|
49
|
+
end
|
50
|
+
|
51
|
+
def biblio_anchor_linkend_std(node, bib, linkend)
|
52
|
+
c1, c2 = linkend_content(node)
|
53
|
+
node["style"] == "no-biblio-tag" or tag = bib[:ord]
|
54
|
+
if !c1.empty?
|
55
|
+
c2.each(&:remove)
|
56
|
+
c1.map(&:to_xml).join
|
57
|
+
elsif node.at(ns("./location"))
|
58
|
+
linkend
|
59
|
+
elsif node["citeas"] == bib[:ord] then node["citeas"]
|
60
|
+
else [linkend, tag].compact.join(" ")
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
49
64
|
def biblio_anchor_linkend_nonstd(node, bib)
|
65
|
+
c1, c2 = linkend_content(node)
|
50
66
|
node["style"] == "no-biblio-tag" or tag = node["citeas"]
|
51
|
-
if !
|
52
|
-
|
67
|
+
if !c1.empty?
|
68
|
+
c2.each(&:remove)
|
69
|
+
"#{c1.map(&:to_xml).join} #{tag}".strip
|
70
|
+
elsif node.at(ns("./location"))
|
71
|
+
tag
|
53
72
|
elsif node["style"] == "title" && bib[:title]
|
54
73
|
"#{bib[:title]} #{tag}".strip
|
55
74
|
elsif bib[:author] # default, also if node["style"] == "title"
|
@@ -125,11 +125,7 @@ module IsoDoc
|
|
125
125
|
end
|
126
126
|
end
|
127
127
|
|
128
|
-
|
129
|
-
s = middle_title_insert(docxml) or return
|
130
|
-
s.previous = middle_title_body
|
131
|
-
end
|
132
|
-
|
128
|
+
# KILL
|
133
129
|
def middle_title_body
|
134
130
|
ret = "<p class='zzSTDTitle1'>#{@meta.get[:full_doctitle]}"
|
135
131
|
@meta.get[:amd] || @meta.get[:corr] and ret += "<br/>"
|
@@ -140,9 +136,14 @@ module IsoDoc
|
|
140
136
|
ret
|
141
137
|
end
|
142
138
|
|
143
|
-
def
|
144
|
-
|
145
|
-
|
139
|
+
def middle_title_template
|
140
|
+
<<~OUTPUT
|
141
|
+
<p class='zzSTDTitle1'>{{ full_doctitle -}}
|
142
|
+
{% if amd or corr %}<br/>{% endif -%}
|
143
|
+
{% if amd %}Amendment {{ amd }}{% endif -%}
|
144
|
+
{% if amd and corr %} {% endif -%}
|
145
|
+
{% if corr %}Corrigenda {{ corr }}{% endif %}</p>
|
146
|
+
OUTPUT
|
146
147
|
end
|
147
148
|
|
148
149
|
def preface_rearrange(doc)
|
@@ -95,14 +95,13 @@ module Metanorma
|
|
95
95
|
end
|
96
96
|
|
97
97
|
def boilerplate_isodoc(xmldoc)
|
98
|
-
x = xmldoc.
|
99
|
-
x.root.add_namespace(nil, xml_namespace)
|
98
|
+
x = dup_with_namespace(xmldoc.root)
|
100
99
|
xml = Nokogiri::XML(x.to_xml)
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
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
|
106
105
|
end
|
107
106
|
|
108
107
|
def text_from_paras(node)
|
@@ -113,10 +112,18 @@ module Metanorma
|
|
113
112
|
def bibdata_cleanup(xmldoc)
|
114
113
|
super
|
115
114
|
draft_id(xmldoc)
|
115
|
+
main_title(xmldoc)
|
116
116
|
prefixed_title(xmldoc)
|
117
117
|
provenance_title(xmldoc)
|
118
118
|
end
|
119
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
|
+
|
120
127
|
def prefixed_title(xmldoc)
|
121
128
|
t, stage, trial = prefixed_title_prep(xmldoc)
|
122
129
|
%w(main title-abbrev).reverse_each do |type|
|
@@ -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)
|
@@ -157,6 +177,11 @@ module Metanorma
|
|
157
177
|
bib.xpath("./contributor[role/@type = 'publisher']/organization/name")
|
158
178
|
.map(&:text)
|
159
179
|
end
|
180
|
+
|
181
|
+
def reference_names(xmldoc)
|
182
|
+
#require "debug"; binding.b
|
183
|
+
super
|
184
|
+
end
|
160
185
|
end
|
161
186
|
end
|
162
187
|
end
|
@@ -7,11 +7,11 @@ module Metanorma
|
|
7
7
|
|
8
8
|
def sorted_bibitem_no_avail(xmldoc)
|
9
9
|
# Get normative references first, maintaining their order
|
10
|
-
normative_bibitems = xmldoc.xpath("//references[@normative='true']/
|
11
|
-
|
12
|
-
# Get non-normative references second, maintaining their order
|
13
|
-
non_normative_bibitems = xmldoc.xpath("//references[@normative='false']/
|
14
|
-
|
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
15
|
# Return concatenated array with normative first
|
16
16
|
normative_bibitems.to_a + non_normative_bibitems.to_a
|
17
17
|
end
|
@@ -37,7 +37,8 @@ module Metanorma
|
|
37
37
|
|
38
38
|
def available_note(xmldoc, provenance_notes)
|
39
39
|
bibitems = sorted_bibitem_no_avail(xmldoc)
|
40
|
-
iso_iec_available_note(bibitems, provenance_notes["iso-iec"], true,
|
40
|
+
iso_iec_available_note(bibitems, provenance_notes["iso-iec"], true,
|
41
|
+
true)
|
41
42
|
iso_iec_available_note(bibitems, provenance_notes["iso"], true, false)
|
42
43
|
iso_iec_available_note(bibitems, provenance_notes["iec"], false, true)
|
43
44
|
itu_available_note(bibitems, provenance_notes["itut"], true)
|
data/lib/metanorma/ieee/front.rb
CHANGED
@@ -194,24 +194,12 @@ module Metanorma
|
|
194
194
|
end
|
195
195
|
end
|
196
196
|
|
197
|
-
def
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
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
|
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")
|
212
202
|
end
|
213
|
-
|
214
|
-
def title_otherlangs(node, xml); end
|
215
203
|
end
|
216
204
|
end
|
217
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
|
@@ -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="
|
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
|
-
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
|
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
|
-
|
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
|
-
</
|
618
|
-
</
|
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">
|
@@ -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
|
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.
|
4
|
+
version: 1.5.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-
|
11
|
+
date: 2025-09-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: metanorma-standoc
|