metanorma-ietf 3.2.3 → 3.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +6 -4
- data/lib/isodoc/ietf/cleanup.rb +15 -5
- data/lib/isodoc/ietf/references.rb +0 -127
- data/lib/metanorma/ietf/basicdoc.rng +38 -35
- data/lib/metanorma/ietf/biblio.rng +9 -0
- data/lib/metanorma/ietf/front.rb +6 -0
- data/lib/metanorma/ietf/isodoc.rng +27 -1
- data/lib/metanorma/ietf/version.rb +1 -1
- data/lib/relaton/render/config.yml +4 -4
- data/lib/relaton/render/parse.rb +16 -1
- data/metanorma-ietf.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6f8f95517eaa67fc95cbe0ebbf7f54833c4e1b3b2cd43926613a6564c6dbd5fa
|
4
|
+
data.tar.gz: 8497233d7a4e03d5f70ee53e7e3f6fdf91c2af6d4ded543537f11c8fa5167d33
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4eadb338cb1289415cd8cfe9977386c57fc66e3e84ae77a88314ffffcf2da880540330f4d2d543cf5c724e0ae38f4fd5261b2a30a919ac3f6d700ce34e0fa557
|
7
|
+
data.tar.gz: bbeec104f704fd794a65444f2f9b3ab05dff67bf3fd721a64fb60277c25eee414555ac38bf500018d9c876444a5c7530522d027e53c95c8ee72141e3439bb8e6
|
data/Gemfile
CHANGED
@@ -4,10 +4,12 @@ Encoding.default_internal = Encoding::UTF_8
|
|
4
4
|
source "https://rubygems.org"
|
5
5
|
git_source(:github) { |repo| "https://github.com/#{repo}" }
|
6
6
|
|
7
|
-
|
7
|
+
group :development, :test do
|
8
|
+
gem "rspec"
|
9
|
+
end
|
8
10
|
|
9
|
-
if File.exist?
|
10
|
-
eval File.read(
|
11
|
+
if File.exist? "Gemfile.devel"
|
12
|
+
eval File.read("Gemfile.devel"), nil, "Gemfile.devel" # rubocop:disable Security/Eval
|
11
13
|
end
|
12
14
|
|
13
|
-
|
15
|
+
gemspec
|
data/lib/isodoc/ietf/cleanup.rb
CHANGED
@@ -23,6 +23,7 @@ module IsoDoc
|
|
23
23
|
def biblio_cleanup(xmldoc)
|
24
24
|
biblio_abstract_cleanup(xmldoc)
|
25
25
|
biblio_date_cleanup(xmldoc)
|
26
|
+
biblio_refcontent_cleanup(xmldoc)
|
26
27
|
annotation_cleanup(xmldoc)
|
27
28
|
end
|
28
29
|
|
@@ -49,6 +50,15 @@ module IsoDoc
|
|
49
50
|
end
|
50
51
|
end
|
51
52
|
|
53
|
+
def biblio_refcontent_cleanup(xmldoc)
|
54
|
+
xmldoc.xpath("//refcontent").each do |a|
|
55
|
+
val = a.text.strip
|
56
|
+
if val.empty? then a.remove
|
57
|
+
else a.children = val
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
52
62
|
def reparse_abstract(abstract)
|
53
63
|
a1 = Nokogiri::XML(abstract.dup.to_xml
|
54
64
|
.sub("<abstract>", "<abstract xmlns='http://www.example.com'>")).root
|
@@ -130,10 +140,10 @@ module IsoDoc
|
|
130
140
|
|
131
141
|
def make_postamble(docxml)
|
132
142
|
docxml.xpath("//figure").each do |f|
|
133
|
-
a = f
|
134
|
-
name = f
|
135
|
-
b = a
|
136
|
-
c = a
|
143
|
+
a = f.at("./artwork | ./sourcecode") || next
|
144
|
+
name = f.at("./name")&.remove
|
145
|
+
b = a.xpath("./preceding-sibling::*")&.remove
|
146
|
+
c = a.xpath("./following-sibling::*")&.remove
|
137
147
|
a = a.remove
|
138
148
|
name and f << name
|
139
149
|
b.empty? or f << "<preamble>#{to_xml(b)}</preamble>"
|
@@ -211,7 +221,7 @@ module IsoDoc
|
|
211
221
|
|
212
222
|
def dt_cleanup(docxml)
|
213
223
|
docxml.xpath("//dt").each do |d|
|
214
|
-
d
|
224
|
+
d.first_element_child&.name == "bookmark" and
|
215
225
|
d["anchor"] ||= d.first_element_child["anchor"]
|
216
226
|
d.xpath(".//t").each do |t|
|
217
227
|
d["anchor"] ||= t["anchor"]
|
@@ -67,133 +67,6 @@ module IsoDoc
|
|
67
67
|
bib1.namespace = nil
|
68
68
|
ref << @bibrenderer.render(bib1.to_xml, embedded: true)
|
69
69
|
end
|
70
|
-
|
71
|
-
=begin
|
72
|
-
|
73
|
-
def nonstd_bibitem(list, bib, _ordinal, _bibliography)
|
74
|
-
uris = bib.xpath(ns("./uri"))
|
75
|
-
target = nil
|
76
|
-
uris&.each { |u| target = u.text if u["type"] == "src" }
|
77
|
-
list.reference **attr_code(target: target,
|
78
|
-
anchor: bib["id"]) do |r|
|
79
|
-
nonstd_bibitem_front(r, bib)
|
80
|
-
uris&.each do |u|
|
81
|
-
r.format nil, **attr_code(target: u.text, type: u["type"])
|
82
|
-
end
|
83
|
-
docidentifier_render(bib, r)
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
87
|
-
def docidentifier_render(bib, out)
|
88
|
-
docidentifiers = bib.xpath(ns("./docidentifier"))
|
89
|
-
id = render_identifier(bibitem_ref_code(bib))
|
90
|
-
!id[:sdo].nil? && id[:sdo] != "(NO ID)" and out.refcontent id[:sdo]
|
91
|
-
docidentifiers&.each do |u|
|
92
|
-
u["type"] == "DOI" and
|
93
|
-
out.seriesInfo nil, **attr_code(value: u.text.sub(/^DOI[ ]/, ""),
|
94
|
-
name: "DOI")
|
95
|
-
%w(IETF RFC).include?(u["type"]) and docidentifier_ietf(u, out)
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
|
-
def docidentifier_ietf(ident, out)
|
100
|
-
if /^RFC[ ]/.match?(ident.text)
|
101
|
-
out.seriesInfo nil, **attr_code(value: ident.text.sub(/^RFC[ ]0*/, ""),
|
102
|
-
name: "RFC")
|
103
|
-
elsif /^I-D\./.match?(ident.text)
|
104
|
-
out.seriesInfo nil, **attr_code(value: ident.text.sub(/^I-D\./, ""),
|
105
|
-
name: "Internet-Draft")
|
106
|
-
end
|
107
|
-
end
|
108
|
-
|
109
|
-
def nonstd_bibitem_front(ref, bib)
|
110
|
-
ref.front do |f|
|
111
|
-
relaton_to_title(bib, f)
|
112
|
-
relaton_to_author(bib, f)
|
113
|
-
relaton_to_date(bib, f)
|
114
|
-
relaton_to_keyword(bib, f)
|
115
|
-
relaton_to_abstract(bib, f)
|
116
|
-
end
|
117
|
-
end
|
118
|
-
|
119
|
-
def relaton_to_title(bib, node)
|
120
|
-
title = bib&.at(ns("./title")) || bib&.at(ns("./formattedref")) or
|
121
|
-
return
|
122
|
-
node.title do |t|
|
123
|
-
title.children.each { |n| parse(n, t) }
|
124
|
-
end
|
125
|
-
end
|
126
|
-
|
127
|
-
def relaton_to_author(bib, node)
|
128
|
-
auths = bib.xpath(ns("./contributor[xmlns:role/@type = 'author' or " \
|
129
|
-
"xmlns:role/@type = 'editor']"))
|
130
|
-
auths.empty? and
|
131
|
-
auths = bib.xpath(ns("./contributor[xmlns:role/@type = " \
|
132
|
-
"'publisher']"))
|
133
|
-
auths.each do |a|
|
134
|
-
role = a.at(ns("./role[@type = 'editor']")) ? "editor" : nil
|
135
|
-
(p = a&.at(ns("./person/name")) and
|
136
|
-
relaton_person_to_author(p, role, node)) or
|
137
|
-
relaton_org_to_author(a&.at(ns("./organization")), role, node)
|
138
|
-
end
|
139
|
-
end
|
140
|
-
|
141
|
-
def relaton_person_to_author(pers, role, node)
|
142
|
-
full = pers.at(ns("./completename"))&.text
|
143
|
-
surname = pers.at(ns("./surname"))&.text
|
144
|
-
initials = pers.xpath(ns("./initial"))&.map(&:text)&.join(" ") ||
|
145
|
-
pers.xpath(ns("./forename"))&.map { |i| i.text[0] }&.join(" ")
|
146
|
-
initials = nil if initials.empty?
|
147
|
-
node.author nil, **attr_code(
|
148
|
-
fullname: full,
|
149
|
-
asciiFullname: full&.transliterate,
|
150
|
-
role: role, surname: surname,
|
151
|
-
initials: initials,
|
152
|
-
asciiSurname: full ? surname&.transliterate : nil,
|
153
|
-
asciiInitials: full ? initials&.transliterate : nil
|
154
|
-
)
|
155
|
-
end
|
156
|
-
|
157
|
-
def relaton_org_to_author(org, _role, node)
|
158
|
-
name = org&.at(ns("./name"))&.text
|
159
|
-
abbrev = org&.at(ns("./abbreviation"))&.text
|
160
|
-
node.author do |_a|
|
161
|
-
node.organization name, **attr_code(ascii: name&.transliterate,
|
162
|
-
abbrev: abbrev)
|
163
|
-
end
|
164
|
-
end
|
165
|
-
|
166
|
-
def relaton_to_date(bib, node)
|
167
|
-
date = bib.at(ns("./date[@type = 'published']")) ||
|
168
|
-
bib.at(ns("./date[@type = 'issued']")) ||
|
169
|
-
bib.at(ns("./date[@type = 'circulated']"))
|
170
|
-
date or return
|
171
|
-
attr = date_attr(date.at(ns("./on | ./from"))&.text) or return
|
172
|
-
node.date **attr_code(attr)
|
173
|
-
end
|
174
|
-
|
175
|
-
def relaton_to_keyword(bib, node)
|
176
|
-
bib.xpath(ns("./keyword")).each do |k|
|
177
|
-
node.keyword do |keyword|
|
178
|
-
k.children.each { |n| parse(n, keyword) }
|
179
|
-
end
|
180
|
-
end
|
181
|
-
end
|
182
|
-
|
183
|
-
def relaton_to_abstract(bib, node)
|
184
|
-
bib.xpath(ns("./abstract")).each do |k|
|
185
|
-
node.abstract do |abstract|
|
186
|
-
if k.at(ns("./p"))
|
187
|
-
k.children.each { |n| parse(n, abstract) }
|
188
|
-
else
|
189
|
-
abstract.t do |t|
|
190
|
-
k.children.each { |n| parse(n, t) }
|
191
|
-
end
|
192
|
-
end
|
193
|
-
end
|
194
|
-
end
|
195
|
-
end
|
196
|
-
=end
|
197
70
|
end
|
198
71
|
end
|
199
72
|
end
|
@@ -914,44 +914,47 @@
|
|
914
914
|
-->
|
915
915
|
<define name="image">
|
916
916
|
<element name="image">
|
917
|
-
<
|
918
|
-
|
917
|
+
<ref name="Image"/>
|
918
|
+
</element>
|
919
|
+
</define>
|
920
|
+
<define name="Image">
|
921
|
+
<attribute name="id">
|
922
|
+
<data type="ID"/>
|
923
|
+
</attribute>
|
924
|
+
<attribute name="src">
|
925
|
+
<data type="anyURI"/>
|
926
|
+
</attribute>
|
927
|
+
<attribute name="mimetype"/>
|
928
|
+
<optional>
|
929
|
+
<attribute name="filename"/>
|
930
|
+
</optional>
|
931
|
+
<optional>
|
932
|
+
<attribute name="width">
|
933
|
+
<choice>
|
934
|
+
<data type="int"/>
|
935
|
+
<value>auto</value>
|
936
|
+
</choice>
|
919
937
|
</attribute>
|
920
|
-
|
938
|
+
</optional>
|
939
|
+
<optional>
|
940
|
+
<attribute name="height">
|
941
|
+
<choice>
|
942
|
+
<data type="int"/>
|
943
|
+
<value>auto</value>
|
944
|
+
</choice>
|
945
|
+
</attribute>
|
946
|
+
</optional>
|
947
|
+
<optional>
|
948
|
+
<attribute name="alt"/>
|
949
|
+
</optional>
|
950
|
+
<optional>
|
951
|
+
<attribute name="title"/>
|
952
|
+
</optional>
|
953
|
+
<optional>
|
954
|
+
<attribute name="longdesc">
|
921
955
|
<data type="anyURI"/>
|
922
956
|
</attribute>
|
923
|
-
|
924
|
-
<optional>
|
925
|
-
<attribute name="filename"/>
|
926
|
-
</optional>
|
927
|
-
<optional>
|
928
|
-
<attribute name="width">
|
929
|
-
<choice>
|
930
|
-
<data type="int"/>
|
931
|
-
<value>auto</value>
|
932
|
-
</choice>
|
933
|
-
</attribute>
|
934
|
-
</optional>
|
935
|
-
<optional>
|
936
|
-
<attribute name="height">
|
937
|
-
<choice>
|
938
|
-
<data type="int"/>
|
939
|
-
<value>auto</value>
|
940
|
-
</choice>
|
941
|
-
</attribute>
|
942
|
-
</optional>
|
943
|
-
<optional>
|
944
|
-
<attribute name="alt"/>
|
945
|
-
</optional>
|
946
|
-
<optional>
|
947
|
-
<attribute name="title"/>
|
948
|
-
</optional>
|
949
|
-
<optional>
|
950
|
-
<attribute name="longdesc">
|
951
|
-
<data type="anyURI"/>
|
952
|
-
</attribute>
|
953
|
-
</optional>
|
954
|
-
</element>
|
957
|
+
</optional>
|
955
958
|
</define>
|
956
959
|
<define name="video">
|
957
960
|
<element name="video">
|
@@ -348,6 +348,9 @@
|
|
348
348
|
<zeroOrMore>
|
349
349
|
<ref name="contact"/>
|
350
350
|
</zeroOrMore>
|
351
|
+
<optional>
|
352
|
+
<ref name="logo"/>
|
353
|
+
</optional>
|
351
354
|
</element>
|
352
355
|
</define>
|
353
356
|
<define name="orgname">
|
@@ -366,6 +369,11 @@
|
|
366
369
|
</choice>
|
367
370
|
</element>
|
368
371
|
</define>
|
372
|
+
<define name="logo">
|
373
|
+
<element name="logo">
|
374
|
+
<ref name="image"/>
|
375
|
+
</element>
|
376
|
+
</define>
|
369
377
|
<define name="NameWithVariants">
|
370
378
|
<element name="primary">
|
371
379
|
<ref name="LocalizedString"/>
|
@@ -942,6 +950,7 @@
|
|
942
950
|
<value>obsoleted</value>
|
943
951
|
<value>confirmed</value>
|
944
952
|
<value>updated</value>
|
953
|
+
<value>corrected</value>
|
945
954
|
<value>issued</value>
|
946
955
|
<value>transmitted</value>
|
947
956
|
<value>copied</value>
|
data/lib/metanorma/ietf/front.rb
CHANGED
@@ -9,6 +9,7 @@ module Metanorma
|
|
9
9
|
personal_author(node, xml)
|
10
10
|
end
|
11
11
|
|
12
|
+
=begin
|
12
13
|
def metadata_publisher(node, xml)
|
13
14
|
publishers = node.attr("publisher") || "IETF"
|
14
15
|
csv_split(publishers)&.each do |p|
|
@@ -30,6 +31,11 @@ module Metanorma
|
|
30
31
|
end
|
31
32
|
end
|
32
33
|
end
|
34
|
+
=end
|
35
|
+
|
36
|
+
def default_publisher
|
37
|
+
"IETF"
|
38
|
+
end
|
33
39
|
|
34
40
|
def org_abbrev
|
35
41
|
{ "Internet Engineering Task Force" => "IETF" }
|
@@ -17,7 +17,7 @@
|
|
17
17
|
these elements; we just want one namespace for any child grammars
|
18
18
|
of this.
|
19
19
|
-->
|
20
|
-
<!-- VERSION v1.2.
|
20
|
+
<!-- VERSION v1.2.8 -->
|
21
21
|
<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">
|
22
22
|
<include href="reqt.rng"/>
|
23
23
|
<include href="basicdoc.rng">
|
@@ -1054,6 +1054,17 @@
|
|
1054
1054
|
<ref name="date_inline"/>
|
1055
1055
|
</choice>
|
1056
1056
|
</define>
|
1057
|
+
<define name="PureTextElement" combine="choice">
|
1058
|
+
<ref name="passthrough_inline"/>
|
1059
|
+
</define>
|
1060
|
+
<define name="passthrough_inline">
|
1061
|
+
<element name="passthrough">
|
1062
|
+
<optional>
|
1063
|
+
<attribute name="formats"/>
|
1064
|
+
</optional>
|
1065
|
+
<text/>
|
1066
|
+
</element>
|
1067
|
+
</define>
|
1057
1068
|
<define name="add">
|
1058
1069
|
<element name="add">
|
1059
1070
|
<choice>
|
@@ -1092,6 +1103,9 @@
|
|
1092
1103
|
<optional>
|
1093
1104
|
<attribute name="style"/>
|
1094
1105
|
</optional>
|
1106
|
+
<optional>
|
1107
|
+
<attribute name="custom-charset"/>
|
1108
|
+
</optional>
|
1095
1109
|
<oneOrMore>
|
1096
1110
|
<ref name="TextElement"/>
|
1097
1111
|
</oneOrMore>
|
@@ -1394,6 +1408,9 @@
|
|
1394
1408
|
<optional>
|
1395
1409
|
<attribute name="number"/>
|
1396
1410
|
</optional>
|
1411
|
+
<optional>
|
1412
|
+
<attribute name="branch-number"/>
|
1413
|
+
</optional>
|
1397
1414
|
<optional>
|
1398
1415
|
<attribute name="obligation">
|
1399
1416
|
<choice>
|
@@ -1617,6 +1634,9 @@
|
|
1617
1634
|
<optional>
|
1618
1635
|
<attribute name="number"/>
|
1619
1636
|
</optional>
|
1637
|
+
<optional>
|
1638
|
+
<attribute name="branch-number"/>
|
1639
|
+
</optional>
|
1620
1640
|
<optional>
|
1621
1641
|
<attribute name="type"/>
|
1622
1642
|
</optional>
|
@@ -1668,6 +1688,9 @@
|
|
1668
1688
|
<optional>
|
1669
1689
|
<attribute name="number"/>
|
1670
1690
|
</optional>
|
1691
|
+
<optional>
|
1692
|
+
<attribute name="branch-number"/>
|
1693
|
+
</optional>
|
1671
1694
|
<optional>
|
1672
1695
|
<ref name="section-title"/>
|
1673
1696
|
</optional>
|
@@ -1765,6 +1788,9 @@
|
|
1765
1788
|
<optional>
|
1766
1789
|
<attribute name="number"/>
|
1767
1790
|
</optional>
|
1791
|
+
<optional>
|
1792
|
+
<attribute name="branch-number"/>
|
1793
|
+
</optional>
|
1768
1794
|
<optional>
|
1769
1795
|
<attribute name="obligation">
|
1770
1796
|
<choice>
|
@@ -8,18 +8,18 @@ extenttemplate:
|
|
8
8
|
inbook: "{{ volume }} {{ page }}"
|
9
9
|
misc: "{{ volume }} {{issue}} {{ page }}, {{ duration }}"
|
10
10
|
nametemplate:
|
11
|
-
one: "{% if nonpersonal[0] %}<author><organization_ascii='{{nonpersonal[0] |
|
11
|
+
one: "{% if nonpersonal[0] %}<author><organization_ascii='{{nonpersonal[0] | ascii }}'{% if nonpersonalabbrev[0] %}_abbrev='{{ nonpersonalabbrev[0]}}'{% endif %}>{{ nonpersonal[0] }}</organization></author>{% else %}{% if surname[0] %}<author_surname='{{surname[0]}}'_asciiSurname='{{surname[0] | ascii }}'_initials='{{initials[0] | join: ''}}'_asciiInitials='{{initials[0] | join: '' | ascii}}'{%if role[0] %}_role='{{role[0]}}'{%endif%}/>{% else %}{% if completename[0] %}<author_fullname='{{completename[0]}}'_asciiFullname='{{completename[0] | ascii }}'{%if role[0] %}_role='{{role[0]}}'{%endif%}/>{% endif %}{% endif %}{% endif %}"
|
12
12
|
two: "{% if nonpersonal[0] %}<author><organization_ascii='{{nonpersonal[0] | ascii }}'_abbrev='{{ nonpersonalabbrev[0]}}'>{{ nonpersonal[0] }}</organization></author>{% else %}{% if surname[0] %}<author_surname='{{surname[0]}}'_asciiSurname='{{ surname[0] | ascii }}'_initials='{{initials[0] | join: ''}}'_asciiInitials='{{initials[0] | join: '' | ascii}}'{%if role[0] %}_role='{{role[0]}}'{%endif%}/>{% else %}{% if completename[0] %}<author_fullname='{{completename[0]}}'_asciiFullname='{{completename[0] | ascii }}'{%if role[0] %}_role='{{role[0]}}'{%endif%}/>{% endif %}{% endif %}{% endif %} {% if nonpersonal[1] %}<author><organization_ascii='{{nonpersonal[1] | ascii }}'_abbrev='{{ nonpersonalabbrev[1]}}'>{{ nonpersonal[1] }}</organization></author>{% else %}{% if surname[0] %}<author_surname='{{surname[1]}}'_asciiSurname='{{ surname[1] | ascii }}'_initials='{{initials[1] | join: ''}}'_asciiInitials='{{initials[1] | join: '' | ascii}}'{%if role[1] %}_role='{{role[1]}}'{%endif%}/>{% else %}{% if completename[1] %}<author_fullname='{{completename[1]}}'_asciiFullname='{{completename[1] | ascii }}'{%if role[1] %}_role='{{role[1]}}'{%endif%}/>{% endif %}{%endif%}{% endif %}"
|
13
13
|
more: "{% if nonpersonal[0] %}<author><organization_ascii='{{nonpersonal[0] | ascii }}'_abbrev='{{ nonpersonalabbrev[0]}}'>{{ nonpersonal[0] }}</organization></author>{% else %}{% if surname[0] %}<author_surname='{{surname[0]}}'_asciiSurname='{{ surname[0] | ascii }}'_initials='{{initials[0] | join: ''}}'_asciiInitials='{{initials[0] | join: '' | ascii}}'{%if role[0] %}_role='{{role[0]}}'{%endif%}/>{% else %}{% if completename[0] %}<author_fullname='{{completename[0]}}'_asciiFullname='{{completename[0] | ascii }}'{%if role[0] %}_role='{{role[0]}}'{%endif%}/>{% endif %}{% endif %}{%endif%} {% if nonpersonal[1] %}<author><organization_ascii='{{nonpersonal[1] | ascii }}'_abbrev='{{ nonpersonalabbrev[1]}}'>{{ nonpersonal[1] }}</organization></author>{% else %}{%if surname[1] %}<author_surname='{{surname[1]}}'_asciiSurname='{{ surname[1] | ascii }}'_initials='{{initials[1] | join: ''}}'_asciiInitials='{{initials[1] | join: '' | ascii}}'{%if role[1] %}_role='{{role[1]}}'{%endif%}/>{% else %}{% if completename[1] %}<author_fullname='{{completename[1]}}'_asciiFullname='{{completename[1] | ascii }}'{%if role[1] %}_role='{{role[1]}}'{%endif%}/>{% endif %}{% endif %}{% endif %} {% if nonpersonal[2] or nonpersonalabbrev[2] %}<author><organization_ascii='{{nonpersonal[2] | ascii }}'_abbrev='{{ nonpersonalabbrev[2]}}'>{{ nonpersonal[2] }}</organization></author>{% else %}{% if surname[2] %}<author_surname='{{surname[2]}}'_asciiSurname='{{ surname[2] | ascii }}'_initials='{{initials[2] | join: ''}}'_asciiInitials='{{initials[2] | join: '' | ascii}}'{%if role[2] %}_role='{{role[2]}}'{%endif%}/>{% else %}{% if completename[2] %}<author_fullname='{{completename[2]}}'_asciiFullname='{{completename[2] | ascii }}'{%if role[2] %}_role='{{role[2]}}'{%endif%}/>{% endif %}{% endif %}{% endif %}"
|
14
14
|
# disabled the following: they should be provided in inheriting calls
|
15
15
|
# etal: "{% if nonpersonal[0] %}{{ nonpersonal[0] }}{% else %}{{surname[0] | upcase}} ,_{%if given[0]%}{{given[0]}} {{middle[0]}}{%else%}{{initials[0] | join: ' '}}.{%endif%}{% endif %}, {% if nonpersonal[1] %}{{ nonpersonal[1] }}{% else %}{%if given[1]%}{{given[1]}} {{middle[1]}}{%else%}{{initials[1] | join: ' '}}.{%endif%} {{surname[1] | upcase}}{% endif %} <em>et al.</em>"
|
16
16
|
# etal_count: 5
|
17
|
-
seriestemplate: "{% if
|
18
|
-
journaltemplate: "
|
17
|
+
seriestemplate: "{% if series_title and series_num %}<seriesInfo_name='{{ series_title }}'_value='{{series_num}}'/>{% else %}{% if series_formatted %}<refcontent>{{ series_formatted }}</refcontent>{% else %}{% if series_title %}<refcontent> {{series_title}} {{ series_run }} ,_{{ series_org }} ,_{{ series_place }} ,_{{ series_dates }} </refcontent>{% endif %}{% endif %}{% endif %}"
|
18
|
+
journaltemplate: "{% if series_title and series_num %}<seriesInfo_name='{{ series_title }}'_value='{{series_num}}'/>{% else %}{% if series_formatted %}<refcontent>{{ series_formatted }}</refcontent>{% else %}{% if series_title %}<refcontent> {{series_title}} {{ series_run }} ,_{{ series_org }} ,_{{ series_place }} ,_{{ series_dates }} </refcontent>{% endif %}{% endif %}{% endif %}"
|
19
19
|
template:
|
20
20
|
# skip standardidentifier, it is inserted in front of formattedref within metanorma
|
21
21
|
# date is cleaned up into RFC XML formatting afterwards
|
22
|
-
standard: "<front><title>{{ title }}</title> {{ creatornames }} <date_cleanme='true'>{{date}}</date> {% for k in keywords %}<keyword>{{k}}</keyword>{%endfor%} <abstract_cleanme='true'>{{abstract}}</abstract> </front> {% for u in uris %}<format_target='{{u.content}}'_type='{%if u.type%}{{u.type}}{%else%}HTML{%endif%}'/>{% endfor %} {%for d in doi %}<
|
22
|
+
standard: "<front><title>{{ title }}</title> {{ creatornames }} <date_cleanme='true'>{{date}}</date> {% for k in keywords %}<keyword>{{k}}</keyword>{%endfor%} <abstract_cleanme='true'>{{abstract}}</abstract> </front> {% for u in uris %}<format_target='{{u.content}}'_type='{%if u.type%}{{u.type}}{%else%}HTML{%endif%}'/>{% endfor %} {{ series }} {%for d in doi %}<seriesInfo_value='{{ d | replace: ' ', ' ' | remove_first: 'DOI' | strip }}'_name='DOI'/>{% endfor %} {% if home_standard %}{% for i in authoritative_identifier %} <seriesInfo_value='{{ i | replace: ' ', ' ' | strip | split: ' ' | last | remove_first: 'I-D.'}}'_name='{%if i contains 'I-D.'%}Internet-Draft{% else %}{{ i | replace: ' ', ' ' | strip | split: ' ' | slice: -2 }}{%endif%}'/> {% endfor %} {% else %} <refcontent>{{authoritative_identifier | join: ', '}}</refcontent> {% endif %}"
|
23
23
|
website: standard
|
24
24
|
book: standard
|
25
25
|
booklet: standard
|
data/lib/relaton/render/parse.rb
CHANGED
@@ -11,7 +11,7 @@ module Relaton
|
|
11
11
|
|
12
12
|
def home_standard(_doc, pubs)
|
13
13
|
pubs&.any? do |r|
|
14
|
-
["Internet Engineering Task Force", "IETF"]
|
14
|
+
["Internet Engineering Task Force", "IETF", "RFC Publisher"]
|
15
15
|
.include?(r[:nonpersonal])
|
16
16
|
end
|
17
17
|
end
|
@@ -22,6 +22,12 @@ module Relaton
|
|
22
22
|
authorizer)
|
23
23
|
end
|
24
24
|
|
25
|
+
def series_xml2hash1(series, doc)
|
26
|
+
ret = super
|
27
|
+
%w(BCP RFC I-D. Internet-Draft).include?(ret[:series_title]) and return {}
|
28
|
+
ret
|
29
|
+
end
|
30
|
+
|
25
31
|
def uris(doc)
|
26
32
|
doc.link.map { |u| { content: u.content.to_s.strip, type: u.type } }
|
27
33
|
end
|
@@ -80,6 +86,15 @@ module Relaton
|
|
80
86
|
cr.empty? or return cr
|
81
87
|
super
|
82
88
|
end
|
89
|
+
|
90
|
+
# add BCP number
|
91
|
+
def authoritative_identifier(doc)
|
92
|
+
ret = super
|
93
|
+
if bcp = doc.series.detect { |s| s.title.title.content == "BCP" }
|
94
|
+
ret.unshift("BCP #{bcp.number}")
|
95
|
+
end
|
96
|
+
ret.reject { |x| /^(rfc-anchor|Internet-Draft)/.match? (x) }
|
97
|
+
end
|
83
98
|
end
|
84
99
|
end
|
85
100
|
end
|
data/metanorma-ietf.gemspec
CHANGED
@@ -37,7 +37,7 @@ Gem::Specification.new do |spec|
|
|
37
37
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
|
38
38
|
|
39
39
|
spec.add_dependency "metanorma-ietf-data"
|
40
|
-
spec.add_dependency "metanorma-standoc", "~> 2.
|
40
|
+
spec.add_dependency "metanorma-standoc", "~> 2.7.0"
|
41
41
|
spec.add_dependency "relaton-render"
|
42
42
|
|
43
43
|
spec.add_development_dependency "debug"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metanorma-ietf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.2.
|
4
|
+
version: 3.2.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: 2023-11-
|
11
|
+
date: 2023-11-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: metanorma-ietf-data
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 2.
|
33
|
+
version: 2.7.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 2.
|
40
|
+
version: 2.7.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: relaton-render
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|