metanorma-ogc 1.4.0 → 1.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/asciidoctor/ogc/boilerplate.xml +6 -6
- data/lib/asciidoctor/ogc/converter.rb +91 -36
- data/lib/asciidoctor/ogc/front.rb +1 -1
- data/lib/asciidoctor/ogc/isodoc.rng +23 -9
- data/lib/isodoc/ogc/biblio.rb +57 -51
- data/lib/isodoc/ogc/i18n-en.yaml +17 -3
- data/lib/isodoc/ogc/metadata.rb +1 -1
- data/lib/isodoc/ogc/ogc.abstract-specification-topic.xsl +236 -97
- data/lib/isodoc/ogc/ogc.best-practice.xsl +236 -97
- data/lib/isodoc/ogc/ogc.change-request-supporting-document.xsl +236 -97
- data/lib/isodoc/ogc/ogc.community-practice.xsl +236 -97
- data/lib/isodoc/ogc/ogc.community-standard.xsl +236 -97
- data/lib/isodoc/ogc/ogc.discussion-paper.xsl +236 -97
- data/lib/isodoc/ogc/ogc.engineering-report.xsl +236 -97
- data/lib/isodoc/ogc/ogc.other.xsl +236 -97
- data/lib/isodoc/ogc/ogc.policy.xsl +236 -97
- data/lib/isodoc/ogc/ogc.reference-model.xsl +236 -97
- data/lib/isodoc/ogc/ogc.release-notes.xsl +236 -97
- data/lib/isodoc/ogc/ogc.standard.xsl +236 -97
- data/lib/isodoc/ogc/ogc.test-suite.xsl +236 -97
- data/lib/isodoc/ogc/ogc.user-guide.xsl +236 -97
- data/lib/isodoc/ogc/ogc.white-paper.xsl +191 -56
- data/lib/isodoc/ogc/presentation_xml_convert.rb +53 -46
- data/lib/isodoc/ogc/reqt.rb +16 -11
- data/lib/metanorma/ogc/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b06257175ed17babd9928b2e5fecaf8aef1ab4e70ba53d494244813e28180d5b
|
4
|
+
data.tar.gz: 7f6d69a86ba6427adeed77e5b47565a4a286278f6931cbf451ee8606fdc0cf5e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3396cd1cb78a0d014003913d57a4460b38b377b980441a98a1e453f125ea9b10636782ab6eff031e425518863cdcf5ef4c3228561cda5d4d6b0d720310b93fb4
|
7
|
+
data.tar.gz: 85705853508542c024f56181bd1ba871b8c869aa4e5b2f3df4689864fa0d7876193f08bb43638260ae5eff5d0eb4d9631892a13bf0a9a934b33af3e94793f1ae
|
@@ -95,13 +95,13 @@
|
|
95
95
|
{% if doctype == "Standard" or doctype == "Community Standard" or doctype == "Abstract Specification" %}
|
96
96
|
{% if stage == "Approved" or stage == "Withdrawn" %}
|
97
97
|
<clause>
|
98
|
-
<title>
|
98
|
+
<title>Notice</title>
|
99
99
|
<p>This document is an OGC Member approved international standard. This document is available on a royalty free, non-discriminatory basis. Recipients of this document are invited to submit, with their comments, notification of any relevant patent rights of which they are aware and to provide supporting documentation.
|
100
100
|
</p>
|
101
101
|
</clause>
|
102
102
|
{% else %}
|
103
103
|
<clause>
|
104
|
-
<title>
|
104
|
+
<title>Notice for Drafts</title>
|
105
105
|
<p>This document is not an OGC Standard. This document is distributed for review and comment. This document is subject to change without notice and may not be referred to as an OGC Standard.</p>
|
106
106
|
|
107
107
|
<p>Recipients of this document are invited to submit, with their comments, notification of any relevant patent rights of which they are aware and to provide supporting documentation.</p>
|
@@ -111,7 +111,7 @@
|
|
111
111
|
|
112
112
|
{% elsif doctype == "Engineering Report" %}
|
113
113
|
<clause>
|
114
|
-
<title>
|
114
|
+
<title>Notice</title>
|
115
115
|
<p>This document is not an OGC Standard. This document is an OGC Public Engineering Report created as a deliverable in an OGC Interoperability Initiative and is <em>not an official position</em> of the OGC membership. It is distributed for review and comment. It is subject to change without notice and may not be referred to as an OGC Standard.</p>
|
116
116
|
|
117
117
|
<p>Further, any OGC Engineering Report should not be referenced as required or mandatory technology in procurements. However, the discussions in this document could very well lead to the definition of an OGC Standard.</p>
|
@@ -120,7 +120,7 @@
|
|
120
120
|
|
121
121
|
{% elsif doctype == "Best Practice" %}
|
122
122
|
<clause>
|
123
|
-
<title>
|
123
|
+
<title>Notice</title>
|
124
124
|
<p>This document defines an OGC Best Practice on a particular technology or approach related to an OGC standard. This document is <em>not</em> an OGC Standard and may not be referred to as an OGC Standard. It is subject to change without notice. However, this document is an <em>official</em> position of the OGC membership on this particular technology topic.</p>
|
125
125
|
|
126
126
|
<p>Recipients of this document are invited to submit, with their comments, notification of any relevant patent rights of which they are aware and to provide supporting documentation.</p>
|
@@ -128,7 +128,7 @@
|
|
128
128
|
|
129
129
|
{% elsif doctype == "Release Notes" %}
|
130
130
|
<clause>
|
131
|
-
<title>
|
131
|
+
<title>Notice</title>
|
132
132
|
<p>This document is not an OGC standard. This document provides release notes for an OGC standard. This document is subject to change without notice and may not be referred to as an OGC Standard.</p>
|
133
133
|
|
134
134
|
<p>Recipients of this document are invited to submit, with their comments, notification of any relevant patent rights of which they are aware and to provide supporting documentation.</p>
|
@@ -137,7 +137,7 @@
|
|
137
137
|
|
138
138
|
{% else %}
|
139
139
|
<clause>
|
140
|
-
<title>
|
140
|
+
<title>Notice</title>
|
141
141
|
<p>This document is not an OGC Standard. This document is an OGC {{ doctype }} and is therefore not an official position of the OGC membership. It is distributed for review and comment. It is subject to change without notice and may not be referred to as an OGC Standard.</p>
|
142
142
|
<p>Further, an OGC {{ doctype }} should not be referenced as required or mandatory technology in procurements.</p>
|
143
143
|
</clause>
|
@@ -16,8 +16,7 @@ module Asciidoctor
|
|
16
16
|
register_for "ogc"
|
17
17
|
|
18
18
|
# ignore, we generate ToC outside of asciidoctor
|
19
|
-
def toc(value)
|
20
|
-
end
|
19
|
+
def toc(value); end
|
21
20
|
|
22
21
|
def makexml(node)
|
23
22
|
@draft = node.attributes.has_key?("draft")
|
@@ -27,11 +26,11 @@ module Asciidoctor
|
|
27
26
|
def doctype(node)
|
28
27
|
d = super
|
29
28
|
d1 = ::IsoDoc::Ogc::DOCTYPE_ABBR.invert[d] and d = d1
|
30
|
-
unless %w{abstract-specification-topic best-practice
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
29
|
+
unless %w{abstract-specification-topic best-practice other policy
|
30
|
+
change-request-supporting-document community-practice
|
31
|
+
community-standard discussion-paper engineering-report
|
32
|
+
reference-model release-notes standard user-guide white-paper
|
33
|
+
test-suite}.include? d
|
35
34
|
@warned_doctype or
|
36
35
|
@log.add("Document Attributes", nil,
|
37
36
|
"'#{d}' is not a legal document type: reverting to 'standard'")
|
@@ -44,69 +43,80 @@ module Asciidoctor
|
|
44
43
|
def sectiontype_streamline(ret)
|
45
44
|
case ret
|
46
45
|
when "preface" then "foreword"
|
47
|
-
when "foreword" then "donotrecognise-foreword"
|
48
|
-
when "introduction" then "donotrecognise-foreword"
|
46
|
+
when "foreword", "introduction" then "donotrecognise-foreword"
|
49
47
|
when "references" then "normative references"
|
48
|
+
when "glossary" then "terms and definitions"
|
50
49
|
else
|
51
50
|
super
|
52
51
|
end
|
53
52
|
end
|
54
53
|
|
55
54
|
def outputs(node, ret)
|
56
|
-
File.open(@filename
|
57
|
-
presentation_xml_converter(node).convert(@filename
|
58
|
-
html_converter(node).convert(@filename
|
59
|
-
|
60
|
-
|
55
|
+
File.open("#{@filename}.xml", "w:UTF-8") { |f| f.write(ret) }
|
56
|
+
presentation_xml_converter(node).convert("#{@filename}.xml")
|
57
|
+
html_converter(node).convert("#{@filename}.presentation.xml", nil,
|
58
|
+
false, "#{@filename}.html")
|
59
|
+
doc_converter(node).convert("#{@filename}.presentation.xml", nil,
|
60
|
+
false, "#{@filename}.doc")
|
61
|
+
pdf_converter(node)&.convert("#{@filename}.presentation.xml", nil,
|
62
|
+
false, "#{@filename}.pdf")
|
61
63
|
end
|
62
64
|
|
63
65
|
def validate(doc)
|
64
66
|
content_validate(doc)
|
65
|
-
schema_validate(formattedstr_strip(doc.dup),
|
67
|
+
schema_validate(formattedstr_strip(doc.dup),
|
68
|
+
File.join(File.dirname(__FILE__), "ogc.rng"))
|
66
69
|
end
|
67
70
|
|
68
|
-
def sections_cleanup(
|
71
|
+
def sections_cleanup(xml)
|
69
72
|
super
|
70
|
-
|
73
|
+
xml.xpath("//*[@inline-header]").each do |h|
|
71
74
|
h.delete("inline-header")
|
72
75
|
end
|
73
76
|
end
|
74
77
|
|
75
|
-
def make_preface(
|
78
|
+
def make_preface(xml, sect)
|
76
79
|
super
|
77
|
-
insert_security(
|
78
|
-
insert_submitters(
|
80
|
+
insert_security(xml, sect)
|
81
|
+
insert_submitters(xml, sect)
|
79
82
|
end
|
80
83
|
|
81
84
|
def add_id
|
82
85
|
%(id="_#{UUIDTools::UUID.random_create}")
|
83
86
|
end
|
84
87
|
|
85
|
-
def insert_security(
|
86
|
-
doctype =
|
87
|
-
description = %w(standard
|
88
|
-
|
89
|
-
|
88
|
+
def insert_security(xml, sect)
|
89
|
+
doctype = sect&.at("//bibdata/ext/doctype")&.text
|
90
|
+
description = if %w(standard
|
91
|
+
community-standard).include?(doctype)
|
92
|
+
"standard"
|
93
|
+
else
|
94
|
+
"document"
|
95
|
+
end
|
96
|
+
preface = sect.at("//preface") ||
|
97
|
+
sect.add_previous_sibling("<preface/>").first
|
98
|
+
sect = xml&.at("//clause[@type = 'security']")&.remove ||
|
90
99
|
"<clause type='security' #{add_id}>"\
|
91
100
|
"<title>Security Considerations</title>"\
|
92
101
|
"<p>#{@i18n.security_empty.sub(/%/, description)}</p></clause>"
|
93
|
-
preface.add_child
|
102
|
+
preface.add_child sect
|
94
103
|
end
|
95
104
|
|
96
|
-
def insert_submitters(
|
97
|
-
if
|
98
|
-
preface =
|
99
|
-
|
105
|
+
def insert_submitters(xml, sect)
|
106
|
+
if xml.at("//submitters")
|
107
|
+
preface = sect.at("//preface") ||
|
108
|
+
sect.add_previous_sibling("<preface/>").first
|
109
|
+
submitters = xml.at("//submitters").remove
|
100
110
|
preface.add_child submitters.remove
|
101
111
|
end
|
102
112
|
end
|
103
113
|
|
104
114
|
def clause_parse(attrs, xml, node)
|
105
|
-
case
|
115
|
+
case node&.attr("heading")&.downcase || node.title.downcase
|
106
116
|
when "submitters" then return submitters_parse(attrs, xml, node)
|
107
117
|
when "conformance" then attrs = attrs.merge(type: "conformance")
|
108
|
-
when "security considerations" then attrs =
|
109
|
-
|
118
|
+
when "security considerations" then attrs =
|
119
|
+
attrs.merge(type: "security")
|
110
120
|
end
|
111
121
|
super
|
112
122
|
end
|
@@ -118,11 +128,36 @@ module Asciidoctor
|
|
118
128
|
end
|
119
129
|
end
|
120
130
|
|
121
|
-
def style(
|
122
|
-
|
131
|
+
def style(_node, _text)
|
132
|
+
nil
|
133
|
+
end
|
134
|
+
|
135
|
+
def termdef_boilerplate_cleanup(xmldoc); end
|
136
|
+
|
137
|
+
def term_def_parse(attrs, xml, node, _toplevel)
|
138
|
+
if node.attr("style") == "appendix" && node.level == 1
|
139
|
+
terms_annex_parse(attrs, xml, node)
|
140
|
+
else
|
141
|
+
super
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
def table_cell(node, xml_tr, tblsec)
|
146
|
+
node.set_attr("valign", "middle")
|
147
|
+
super
|
123
148
|
end
|
124
149
|
|
125
|
-
def
|
150
|
+
def terms_annex_parse(attrs, xml, node)
|
151
|
+
attrs1 = attrs.merge(id: "_#{UUIDTools::UUID.random_create}")
|
152
|
+
xml.annex **attr_code(attrs1) do |xml_section|
|
153
|
+
xml_section.title { |name| name << node.title }
|
154
|
+
xml_section.terms **attr_code(attrs) do |terms|
|
155
|
+
(s = node.attr("source")) && s.split(",").each do |s1|
|
156
|
+
terms.termdocsource(nil, **attr_code(bibitemid: s1))
|
157
|
+
end
|
158
|
+
terms << node.content
|
159
|
+
end
|
160
|
+
end
|
126
161
|
end
|
127
162
|
|
128
163
|
def bibdata_cleanup(xmldoc)
|
@@ -131,6 +166,25 @@ module Asciidoctor
|
|
131
166
|
a.text == "published" and a.children = "approved"
|
132
167
|
end
|
133
168
|
|
169
|
+
def section_names_terms_cleanup(xml)
|
170
|
+
replace_title(xml, "//definitions[@type = 'symbols']", @i18n&.symbols)
|
171
|
+
replace_title(xml, "//definitions[@type = 'abbreviated_terms']",
|
172
|
+
@i18n&.abbrev)
|
173
|
+
replace_title(xml, "//definitions[not(@type)]", @i18n&.symbolsabbrev)
|
174
|
+
replace_title(xml, "//sections//terms#{SYMnoABBR} | //sections//clause[.//terms]#{SYMnoABBR}",
|
175
|
+
@i18n&.termsdefsymbols, true)
|
176
|
+
replace_title(xml, "//sections//terms#{ABBRnoSYM} | //sections//clause[.//terms]#{ABBRnoSYM}",
|
177
|
+
@i18n&.termsdefabbrev, true)
|
178
|
+
replace_title(xml, "//sections//terms#{SYMABBR} | //sections//clause[.//terms]#{SYMABBR}",
|
179
|
+
@i18n&.termsdefsymbolsabbrev, true)
|
180
|
+
replace_title(xml, "//sections//terms#{NO_SYMABBR} | //sections//clause[.//terms]#{NO_SYMABBR}",
|
181
|
+
@i18n&.termsdefsymbolsabbrev, true)
|
182
|
+
replace_title(
|
183
|
+
xml, "//sections//terms[not(.//definitions)] | //sections//clause[.//terms][not(.//definitions)]",
|
184
|
+
@i18n&.termsdef, true
|
185
|
+
)
|
186
|
+
end
|
187
|
+
|
134
188
|
def highlight_parse(text, xml)
|
135
189
|
xml.hi { |s| s << text }
|
136
190
|
end
|
@@ -145,6 +199,7 @@ module Asciidoctor
|
|
145
199
|
|
146
200
|
def pdf_converter(node)
|
147
201
|
return nil if node.attr("no-pdf")
|
202
|
+
|
148
203
|
IsoDoc::Ogc::PdfConvert.new(html_extract_attributes(node))
|
149
204
|
end
|
150
205
|
|
@@ -32,6 +32,18 @@
|
|
32
32
|
<ref name="DocumentType"/>
|
33
33
|
</element>
|
34
34
|
</define>
|
35
|
+
<define name="section-title">
|
36
|
+
<element name="title">
|
37
|
+
<zeroOrMore>
|
38
|
+
<ref name="TextElement"/>
|
39
|
+
</zeroOrMore>
|
40
|
+
</element>
|
41
|
+
<zeroOrMore>
|
42
|
+
<element name="variant-title">
|
43
|
+
<ref name="TypedTitleString"/>
|
44
|
+
</element>
|
45
|
+
</zeroOrMore>
|
46
|
+
</define>
|
35
47
|
<define name="hyperlink">
|
36
48
|
<element name="link">
|
37
49
|
<attribute name="target">
|
@@ -158,15 +170,17 @@
|
|
158
170
|
<data type="boolean"/>
|
159
171
|
</attribute>
|
160
172
|
</optional>
|
161
|
-
<
|
162
|
-
<
|
163
|
-
<
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
173
|
+
<optional>
|
174
|
+
<attribute name="type">
|
175
|
+
<choice>
|
176
|
+
<value>roman</value>
|
177
|
+
<value>alphabet</value>
|
178
|
+
<value>arabic</value>
|
179
|
+
<value>roman_upper</value>
|
180
|
+
<value>alphabet_upper</value>
|
181
|
+
</choice>
|
182
|
+
</attribute>
|
183
|
+
</optional>
|
170
184
|
<oneOrMore>
|
171
185
|
<ref name="li"/>
|
172
186
|
</oneOrMore>
|
data/lib/isodoc/ogc/biblio.rb
CHANGED
@@ -1,31 +1,31 @@
|
|
1
1
|
module IsoDoc
|
2
2
|
module Ogc
|
3
3
|
module BaseConvert
|
4
|
-
def std_bibitem_entry(list,
|
5
|
-
list.p **attr_code(iso_bibitem_entry_attrs(
|
4
|
+
def std_bibitem_entry(list, bib, ordinal, biblio)
|
5
|
+
list.p **attr_code(iso_bibitem_entry_attrs(bib, biblio)) do |ref|
|
6
6
|
prefix_bracketed_ref(ref, "[#{ordinal}]") if biblio
|
7
|
-
standard_citation(ref,
|
7
|
+
standard_citation(ref, bib)
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
|
-
def nonstd_bibitem(list,
|
12
|
-
list.p **attr_code(iso_bibitem_entry_attrs(
|
13
|
-
id = bibitem_ref_code(
|
11
|
+
def nonstd_bibitem(list, bib, ordinal, bibliography)
|
12
|
+
list.p **attr_code(iso_bibitem_entry_attrs(bib, bibliography)) do |r|
|
13
|
+
id = bibitem_ref_code(bib)
|
14
14
|
identifier = render_identifier(id)
|
15
15
|
identifier[1] = nil
|
16
16
|
if bibliography
|
17
17
|
ref_entry_code(r, ordinal, identifier, id)
|
18
18
|
end
|
19
|
-
reference_format(
|
19
|
+
reference_format(bib, r)
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
-
def reference_format(
|
24
|
-
if ftitle =
|
25
|
-
ftitle&.children&.each { |n| parse(n,
|
23
|
+
def reference_format(bib, ref)
|
24
|
+
if ftitle = bib.at(ns("./formattedref"))
|
25
|
+
ftitle&.children&.each { |n| parse(n, ref) }
|
26
26
|
else
|
27
27
|
# eventually will be full LNCS reference
|
28
|
-
standard_citation(
|
28
|
+
standard_citation(ref, bib)
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
@@ -34,97 +34,101 @@ module IsoDoc
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def multiplenames_and(names)
|
37
|
-
return "" if names.
|
37
|
+
return "" if names.empty?
|
38
38
|
return names[0] if names.length == 1
|
39
39
|
return "#{names[0]} and #{names[1]}" if names.length == 2
|
40
|
+
|
40
41
|
names[0..-2].join(", ") + " and #{names[-1]}"
|
41
42
|
end
|
42
43
|
|
43
|
-
def nodes_to_span(
|
44
|
+
def nodes_to_span(node)
|
44
45
|
noko do |xml|
|
45
46
|
xml.span do |s|
|
46
|
-
|
47
|
+
node&.children&.each { |x| parse(x, s) }
|
47
48
|
end
|
48
|
-
end.join
|
49
|
+
end.join
|
49
50
|
end
|
50
51
|
|
51
|
-
def extract_publisher(
|
52
|
-
c = b.xpath(ns("./contributor[role/@type = 'publisher'][organization]"))
|
52
|
+
def extract_publisher(bib)
|
53
53
|
abbrs = []
|
54
54
|
names = []
|
55
|
-
|
55
|
+
bib.xpath(ns("./contributor[role/@type = 'publisher']"\
|
56
|
+
"[organization]"))&.each do |c1|
|
56
57
|
n = c1.at(ns("./organization/name")) or next
|
57
58
|
abbrs << (c1.at(ns("./organization/abbreviation")) || n)
|
58
59
|
names << nodes_to_span(n)
|
59
60
|
end
|
60
61
|
return [nil, nil] if names.empty?
|
61
|
-
|
62
|
+
|
63
|
+
[multiplenames_and(names), abbrs.map(&:text).join("/")]
|
62
64
|
end
|
63
65
|
|
64
|
-
def extract_author(
|
65
|
-
c =
|
66
|
-
c =
|
66
|
+
def extract_author(bib)
|
67
|
+
c = bib.xpath(ns("./contributor[role/@type = 'author']"))
|
68
|
+
c = bib.xpath(ns("./contributor[role/@type = 'editor']")) if c.empty?
|
67
69
|
return nil if c.empty?
|
70
|
+
|
68
71
|
c.map do |c1|
|
69
72
|
c1&.at(ns("./organization/name"))&.text || extract_person_name(c1)
|
70
73
|
end.reject { |e| e.nil? || e.empty? }.join(", ")
|
71
74
|
end
|
72
75
|
|
73
|
-
def extract_person_name(
|
74
|
-
p =
|
76
|
+
def extract_person_name(bib)
|
77
|
+
p = bib.at(ns("./person/name")) or return
|
75
78
|
c = p.at(ns("./completename")) and return c.text
|
76
79
|
s = p&.at(ns("./surname"))&.text or return
|
77
80
|
i = p.xpath(ns("./initial")) and
|
78
|
-
front = i.map { |e| e.text.gsub(/[^[:upper:]]/, "") }.join
|
81
|
+
front = i.map { |e| e.text.gsub(/[^[:upper:]]/, "") }.join
|
79
82
|
i.empty? and f = p.xpath(ns("./forename")) and
|
80
|
-
front = f.map { |e| e.text[0].upcase }.join
|
83
|
+
front = f.map { |e| e.text[0].upcase }.join
|
81
84
|
front ? "#{s} #{front}" : s
|
82
85
|
end
|
83
86
|
|
84
|
-
|
85
87
|
def date_render(date)
|
86
88
|
return nil if date.nil?
|
89
|
+
|
87
90
|
on = date&.at(ns("./on"))&.text
|
88
91
|
from = date&.at(ns("./from"))&.text
|
89
92
|
to = date&.at(ns("./to"))&.text
|
90
93
|
return on if on && !on.empty?
|
91
94
|
return "#{from}–#{to}" if from && !from.empty?
|
95
|
+
|
92
96
|
nil
|
93
97
|
end
|
94
98
|
|
95
|
-
def extract_year(
|
96
|
-
d =
|
97
|
-
|
98
|
-
|
99
|
-
|
99
|
+
def extract_year(bib)
|
100
|
+
d = bib.at(ns("./date[@type = 'published']")) ||
|
101
|
+
bib.at(ns("./date[@type = 'issued']")) ||
|
102
|
+
bib.at(ns("./date[@type = 'circulated']")) ||
|
103
|
+
bib.at(ns("./date"))
|
100
104
|
date_render(d)
|
101
105
|
end
|
102
106
|
|
103
|
-
def extract_city(
|
104
|
-
|
107
|
+
def extract_city(bib)
|
108
|
+
bib.at(ns("./place"))
|
105
109
|
end
|
106
110
|
|
107
|
-
def extract_uri(
|
108
|
-
|
111
|
+
def extract_uri(bib)
|
112
|
+
bib.at(ns("./uri"))
|
109
113
|
end
|
110
114
|
|
111
115
|
# {author}: {document identifier}, {title}. {publisher}, {city} ({year})
|
112
|
-
def standard_citation(out,
|
113
|
-
if ftitle =
|
116
|
+
def standard_citation(out, bib)
|
117
|
+
if ftitle = bib.at(ns("./formattedref"))
|
114
118
|
ftitle&.children&.each { |n| parse(n, out) }
|
115
119
|
else
|
116
|
-
pub, pub_abbrev = extract_publisher(
|
117
|
-
author = extract_author(
|
118
|
-
c = extract_city(
|
119
|
-
y = extract_year(
|
120
|
-
u = extract_uri(
|
120
|
+
pub, pub_abbrev = extract_publisher(bib)
|
121
|
+
author = extract_author(bib)
|
122
|
+
c = extract_city(bib)
|
123
|
+
y = extract_year(bib)
|
124
|
+
u = extract_uri(bib)
|
121
125
|
out << "#{author || pub_abbrev}: " if author || pub_abbrev
|
122
|
-
id = render_identifier(inline_bibitem_ref_code(
|
126
|
+
id = render_identifier(inline_bibitem_ref_code(bib))
|
123
127
|
out << id[1] if id[1]
|
124
|
-
out << " (Draft)" if ogc_draft_ref?(
|
128
|
+
out << " (Draft)" if ogc_draft_ref?(bib)
|
125
129
|
out << ", "
|
126
130
|
out.i do |i|
|
127
|
-
iso_title(
|
131
|
+
iso_title(bib)&.children&.each { |n| parse(n, i) }
|
128
132
|
end
|
129
133
|
out << ". "
|
130
134
|
out << pub if pub
|
@@ -136,12 +140,14 @@ module IsoDoc
|
|
136
140
|
end
|
137
141
|
end
|
138
142
|
|
139
|
-
def inline_bibitem_ref_code(
|
140
|
-
id =
|
141
|
-
|
142
|
-
|
143
|
+
def inline_bibitem_ref_code(bib)
|
144
|
+
id = bib.at(ns("./docidentifier[not(@type = 'DOI' "\
|
145
|
+
"or @type = 'metanorma' or @type = 'ISSN' "\
|
146
|
+
"or @type = 'ISBN' or @type = 'rfc-anchor')]"))
|
147
|
+
id ||= bib.at(ns("./docidentifier[not(@type = 'metanorma')]"))
|
143
148
|
return [nil, id, nil] if id
|
144
|
-
|
149
|
+
|
150
|
+
id = Nokogiri::XML::Node.new("docidentifier", bib.document)
|
145
151
|
id << "(NO ID)"
|
146
152
|
[nil, id, nil]
|
147
153
|
end
|