metanorma-iho 0.5.7 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/isodoc/iho/base_convert.rb +1 -105
- data/lib/isodoc/iho/html/html_iho_titlepage.html +2 -0
- data/lib/isodoc/iho/html/word_iho_titlepage.html +1 -0
- data/lib/isodoc/iho/iho.specification.xsl +1574 -291
- data/lib/isodoc/iho/iho.standard.xsl +1574 -291
- data/lib/isodoc/iho/init.rb +1 -1
- data/lib/isodoc/iho/pdf_convert.rb +2 -3
- data/lib/isodoc/iho/presentation_xml_convert.rb +5 -1
- data/lib/isodoc/iho/xref.rb +16 -13
- data/lib/metanorma/iho/biblio.rng +62 -10
- data/lib/metanorma/iho/isodoc.rng +56 -0
- data/lib/metanorma/iho/version.rb +1 -1
- data/lib/relaton/render/config.yml +8 -0
- data/lib/relaton/render/fields.rb +23 -0
- data/lib/relaton/render/general.rb +25 -0
- data/lib/relaton/render/parse.rb +31 -0
- data/metanorma-iho.gemspec +1 -2
- metadata +8 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 574db02f5abb1907a736ad1477d3796edb04fadf781b6745487785e8757b2abc
|
4
|
+
data.tar.gz: 70a2cebbfa301983e53d3844571976cd1eab46e25f52b67e94eb0a2a277c6780
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a98323967490c75566d25ff09c284a5a5b23bd45ae95d59d1409e661f10143e5bacad1fc52681cd9b64f5fc302d3c75bbf4457e6686d318b9b0ad0f6cda7eed
|
7
|
+
data.tar.gz: 52ae31eba5c47a35c6b6a8c2ade3f2ca873367d5f1ea2bec34dad688610c3529035f6f773695e6b03166da5603c76ec4b7fe1d80e5591613bd1d1e28e2524a81
|
@@ -18,119 +18,15 @@ module IsoDoc
|
|
18
18
|
def std_bibitem_entry(list, bib, ordinal, biblio)
|
19
19
|
list.p **attr_code(iso_bibitem_entry_attrs(bib, biblio)) do |ref|
|
20
20
|
prefix_bracketed_ref(ref, "[#{ordinal}]")
|
21
|
-
|
21
|
+
reference_format(bib, ref)
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
def nodes_to_span(node)
|
26
|
-
noko do |xml|
|
27
|
-
xml.span do |s|
|
28
|
-
node&.children&.each { |x| parse(x, s) }
|
29
|
-
end
|
30
|
-
end.join
|
31
|
-
end
|
32
|
-
|
33
|
-
def multiplenames_and(names)
|
34
|
-
return "" if names.empty?
|
35
|
-
return names[0] if names.length == 1
|
36
|
-
return "#{names[0]} and #{names[1]}" if names.length == 2
|
37
|
-
|
38
|
-
names[0..-2].join(", ") + " and #{names[-1]}"
|
39
|
-
end
|
40
|
-
|
41
|
-
def extract_publisher(bib)
|
42
|
-
c = bib
|
43
|
-
.xpath(ns("./contributor[role/@type = 'publisher'][organization]"))
|
44
|
-
abbrs = []
|
45
|
-
names = []
|
46
|
-
c&.each do |c1|
|
47
|
-
n = c1.at(ns("./organization/name")) or next
|
48
|
-
abbrs << (c1.at(ns("./organization/abbreviation")) || n)
|
49
|
-
names << nodes_to_span(n)
|
50
|
-
end
|
51
|
-
return [nil, nil] if names.empty?
|
52
|
-
|
53
|
-
[multiplenames_and(names), abbrs.map(&:text).join("/")]
|
54
|
-
end
|
55
|
-
|
56
|
-
def inline_bibitem_ref_code(bib)
|
57
|
-
id = bib.at(ns("./docidentifier[not(@type = 'DOI' or "\
|
58
|
-
"@type = 'metanorma' or @type = 'ISSN' or "\
|
59
|
-
"@type = 'ISBN' or @type = 'rfc-anchor' or "\
|
60
|
-
"@type = 'metanorma-ordinal')]"))
|
61
|
-
id ||= bib.at(ns("./docidentifier[not(@type = 'metanorma' or "\
|
62
|
-
"@type = 'metanorma-ordinal')]"))
|
63
|
-
return [nil, id, nil, nil] if id
|
64
|
-
|
65
|
-
id = Nokogiri::XML::Node.new("docidentifier", bib.document)
|
66
|
-
id << "(NO ID)"
|
67
|
-
[nil, id, nil, nil]
|
68
|
-
end
|
69
|
-
|
70
|
-
def extract_edition(bib)
|
71
|
-
bib&.at(ns("./edition"))&.text
|
72
|
-
end
|
73
|
-
|
74
|
-
def extract_uri(bib)
|
75
|
-
bib.at(ns("./uri[@type = 'src']")) || bib.at(ns("./uri"))
|
76
|
-
end
|
77
|
-
|
78
25
|
def omit_docid_prefix(prefix)
|
79
26
|
return true if prefix == "IHO"
|
80
27
|
|
81
28
|
super
|
82
29
|
end
|
83
|
-
|
84
|
-
def render_identifier(id)
|
85
|
-
if !id[1].nil? && (id[1]["type"] == "IHO")
|
86
|
-
id[1].children = id[1].text.sub(/^IHO /, "")
|
87
|
-
end
|
88
|
-
super
|
89
|
-
end
|
90
|
-
|
91
|
-
def extract_author(bib)
|
92
|
-
c = bib.xpath(ns("./contributor[role/@type = 'author']"))
|
93
|
-
c = bib.xpath(ns("./contributor[role/@type = 'editor']")) if c.empty?
|
94
|
-
return extract_publisher(bib)[0] if c.empty?
|
95
|
-
|
96
|
-
c.map do |c1|
|
97
|
-
c1&.at(ns("./organization/name"))&.text || extract_person_name(c1)
|
98
|
-
end.reject { |e| e.nil? || e.empty? }.join(", ")
|
99
|
-
end
|
100
|
-
|
101
|
-
def extract_person_name(bib)
|
102
|
-
p = bib.at(ns("./person/name")) or return
|
103
|
-
c = p.at(ns("./completename")) and return c.text
|
104
|
-
s = p&.at(ns("./surname"))&.text or return
|
105
|
-
i = p.xpath(ns("./initial")) and
|
106
|
-
front = i.map { |e| e.text.gsub(/[^[:upper:]]/, "") }.join
|
107
|
-
i.empty? and f = p.xpath(ns("./forename")) and
|
108
|
-
front = f.map { |e| e.text[0].upcase }.join
|
109
|
-
front ? "#{s} #{front}" : s
|
110
|
-
end
|
111
|
-
|
112
|
-
def iho?(bib)
|
113
|
-
extract_publisher(bib)[1] == "IHO"
|
114
|
-
end
|
115
|
-
|
116
|
-
# [{number}] {docID} edition {edition}: {title}, {author/organization}
|
117
|
-
def standard_citation(out, bib)
|
118
|
-
if ftitle = bib.at(ns("./formattedref"))
|
119
|
-
ftitle&.children&.each { |n| parse(n, out) }
|
120
|
-
else
|
121
|
-
id = render_identifier(inline_bibitem_ref_code(bib))
|
122
|
-
out << id[:sdo] if id[:sdo]
|
123
|
-
ed = extract_edition(bib) if iho?(bib)
|
124
|
-
out << " edition #{ed}" if ed
|
125
|
-
out << ": " if id[:sdo] || ed
|
126
|
-
iso_title(bib)&.children&.each { |n| parse(n, out) }
|
127
|
-
out << ", "
|
128
|
-
author = extract_author(bib)
|
129
|
-
out << author
|
130
|
-
u = extract_uri(bib)
|
131
|
-
out << " (<a href='#{u.text}'>#{u.text}</a>)" if u
|
132
|
-
end
|
133
|
-
end
|
134
30
|
end
|
135
31
|
end
|
136
32
|
end
|