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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3e45ecf864f0b42669794eec9b18c1ae434315fa26884f8f50845ab24a4ccc6e
4
- data.tar.gz: a232f5193d979b9cba430bf07b90475c230a7c6732064363d153bc9d89514b34
3
+ metadata.gz: 574db02f5abb1907a736ad1477d3796edb04fadf781b6745487785e8757b2abc
4
+ data.tar.gz: 70a2cebbfa301983e53d3844571976cd1eab46e25f52b67e94eb0a2a277c6780
5
5
  SHA512:
6
- metadata.gz: 8e42bdf9cc060ab2e68e80bc33e61c697e98ffc931552a603153e843fda40e4e6d43abecddec2baa9b59708a0ea487ddbc90df5063f523d8c07f0b77ad096b46
7
- data.tar.gz: 2fbddcf7e8a77d87201792d70f258d866c4c409f6217b10f1ff94803e886f03a5d341af41c3f63a2fa15408f63f9acf0763eb82212e28649ae19596a9323e59d
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
- standard_citation(ref, bib)
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
@@ -66,6 +66,8 @@
66
66
  </div>
67
67
  {% endif %}
68
68
 
69
+ <div class="coverpage-warning" id="coverpage-note-destination"/>
70
+
69
71
  <div class="info-section">
70
72
  <div class="copyright">
71
73
  <div class="year">
@@ -885,4 +885,5 @@ AAAPAAAAAAAAAAAAAAAAAAcCAABkcnMvZG93bnJldi54bWxQSwUGAAAAAAMAAwC3AAAA/AIAAAAA
885
885
  </v:shape>
886
886
  <w:wrap type="square" anchorx="margin" anchory="margin"/>
887
887
  </v:group></p>
888
+ <div class="coverpage-warning" id="coverpage-note-destination"/>
888
889