metanorma-iho 0.5.8 → 0.6.0

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: 5fdf0696be05175e238e5926f6b67e87039e7b1bbb0446ff150b2460cc3a1f42
4
- data.tar.gz: 4ae00994e31e579045e33a1da2f6308f1b6d405414ef6edce683059b92819390
3
+ metadata.gz: d2cff547b03ecc70aec12998ad10bec0bf6ff613bfc9287d9a85301f13c3e653
4
+ data.tar.gz: b0fa1bd5bf299a0b01a821bdafcc6e89292b726bad76ad171b6f78f8ba25d289
5
5
  SHA512:
6
- metadata.gz: 4ed77af30eda911b772f889e4f05df483580a115ac4b9f31273aa20c3709f15536b71cee7f6fbe3e7280969cc507aa68f9311918d870a3ad91c7bc3129fccf45
7
- data.tar.gz: ba7cf27357fd7562d69ec19356436cdbe8f7eb5f98360bf302abba414cfa476169c11b8fabab87ffefb60c7a5f1fa0f16e4eddf8ac30a27704efaaee8bf63b95
6
+ metadata.gz: dc68dc888841c38bbece4f4fb3efe17f9bec41b706cf886be668323b218b2b42a513cda400813f4c3b254f3a318fd70e91a247a1e013a1b1000ee13ac9b5797b
7
+ data.tar.gz: 00dbf67eeefb94f12293843e81b516a318a7e8db5f1f7ec8c497c4d9027db2a8cb8ccf866bb572dc0d3af933d536c4d05597bc10eb37883d9737ce8ac0c62335
@@ -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