isodoc 0.8.13 → 0.9.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: 3dcfbcdf85aacca4db89d1d07e4ec3f6e79ac4d28b9f45a5bf492c0140140738
4
- data.tar.gz: 83450383455cb7d112a2e01d511dcf67e3fccba73b83191561849d4e7160bb01
3
+ metadata.gz: 9a6782d0471fb7cd450a7dce15e825e76a86e4f3c8854ddc69faaa648f65974c
4
+ data.tar.gz: 8062dc310b20e6c1d13a41ac100489dff153be0152a543c20b1aa043093aa72c
5
5
  SHA512:
6
- metadata.gz: 7dd24994b056371af1e7f6df7163681b392cf87473200036bd61036244ca97fc62c3d1ee8cd5ab23dbd3e252e6cdcc73767921cb9d19cbea4264c20ca0408d44
7
- data.tar.gz: 9a56c3dc70f1139639749b11c875372447c53656705827d7450492f43476e9f4589953e7cc4a305d8e4523a80daa4be0c6bb8b6cbaa78917d2c2cf8c9ac9ee66
6
+ metadata.gz: fc34ddc8a06fd1632889c00b4a60641c33f983a5b6c3ac6c18c290992d7a8dee91d3074044513ce3608146488a710fa1a0099a09b2103bcc63355c7e570572be
7
+ data.tar.gz: f9977b4049756a609cc048e022aa138731182beb53a36be53dfb8a46b7285a48c836fa280782ea95f10d06196c05e6bf5a99a5b02dee0c50b6b190e4f2f74f83
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- isodoc (0.8.11)
4
+ isodoc (0.9.0)
5
5
  asciimath
6
6
  html2doc (~> 0.8.1)
7
7
  htmlentities (~> 4.3.4)
@@ -5,17 +5,28 @@ module IsoDoc::Function
5
5
  # references anyway; keeping here instead of in IsoDoc::Iso for now
6
6
  def docid_l10n(x)
7
7
  return x if x.nil?
8
- x.gsub(/All Parts/, @all_parts_lbl.downcase)
8
+ x.gsub(/All Parts/i, @all_parts_lbl.downcase)
9
9
  end
10
10
 
11
11
  def iso_bibitem_ref_code(b)
12
12
  isocode = b.at(ns("./docidentifier")).text
13
- isodate = b.at(ns("./date[@type = 'published']"))
14
- allparts = b.at(ns("./allparts"))
13
+ prefix = b&.at(ns("./docidentifier/@type"))&.text
14
+ #isodate = b.at(ns("./date[@type = 'published']"))
15
+ #allparts = b.at(ns("./allparts"))
15
16
  reference = docid_l10n(isocode)
16
- reference += ":#{date_range(isodate)}" if isodate
17
- reference += " (#{@all_parts_lbl.downcase})" if allparts&.text == "true"
18
- reference
17
+ #reference += ":#{date_range(isodate)}" if isodate
18
+ #reference += " (#{@all_parts_lbl.downcase})" if allparts&.text == "true"
19
+ docid_prefix(prefix, reference)
20
+ end
21
+
22
+ def docid_prefix(prefix, docid)
23
+ docid = "#{prefix} #{docid}" unless omit_docid_prefix(prefix)
24
+ docid
25
+ end
26
+
27
+ def omit_docid_prefix(prefix)
28
+ return true if prefix.nil? || prefix.empty?
29
+ return ["ISO"].include? prefix
19
30
  end
20
31
 
21
32
  def date_note_process(b, ref)
@@ -58,8 +69,9 @@ module IsoDoc::Function
58
69
  end
59
70
  end
60
71
 
61
- def ref_entry_code(r, ordinal, t)
62
- if /^\d+$/.match(t)
72
+ def ref_entry_code(r, ordinal, prefix, t)
73
+ t = docid_prefix(prefix, t)
74
+ if /^\d+$/.match(t) && !prefix
63
75
  prefix_bracketed_ref(r, t)
64
76
  else
65
77
  prefix_bracketed_ref(r, ordinal)
@@ -78,7 +90,8 @@ module IsoDoc::Function
78
90
  list.p **attr_code(iso_bibitem_entry_attrs(b, bibliography)) do |r|
79
91
  if bibliography
80
92
  id = docid_l10n(b.at(ns("./docidentifier")).text.gsub(/[\[\]]/, ""))
81
- ref_entry_code(r, ordinal, id)
93
+ prefix = b&.at(ns("./docidentifier/@type"))&.text
94
+ ref_entry_code(r, ordinal, prefix, id)
82
95
  else
83
96
  r << "#{iso_bibitem_ref_code(b)}, "
84
97
  end
@@ -166,25 +179,28 @@ module IsoDoc::Function
166
179
  end
167
180
  end
168
181
 
169
- def format_ref(ref, isopub, date, allparts)
182
+ def format_ref(ref, prefix, isopub, date, allparts)
170
183
  if isopub
171
- if date
172
- on = date.at(ns("./on"))
173
- ref += on&.text == "--" ? ":--" : ":#{date_range(date)}"
174
- ref += " (all parts)" if allparts
175
- end
184
+ #if date
185
+ #on = date.at(ns("./on"))
186
+ #ref += on&.text == "--" ? ":--" : "" # ":#{date_range(date)}"
187
+ #ref += " (all parts)" if allparts
188
+ # ref = docid_prefix(prefix, ref)
189
+ #end
176
190
  end
177
- return "[#{ref}]" if /^\d+$/.match(ref) && !/^\[.*\]$/.match(ref)
191
+ ref = docid_prefix(prefix, ref)
192
+ return "[#{ref}]" if /^\d+$/.match(ref) && !prefix && !/^\[.*\]$/.match(ref)
178
193
  ref
179
194
  end
180
195
 
181
196
  def reference_names(ref)
182
197
  isopub = ref.at(ns(ISO_PUBLISHER_XPATH))
183
198
  docid = ref.at(ns("./docidentifier"))
199
+ prefix = ref.at(ns("./docidentifier/@type"))
184
200
  # return ref_names(ref) unless docid
185
201
  date = ref.at(ns("./date[@type = 'published']"))
186
202
  allparts = ref.at(ns("./allparts"))
187
- reference = format_ref(docid_l10n(docid.text), isopub, date, allparts)
203
+ reference = format_ref(docid_l10n(docid.text), prefix&.text, isopub, date, allparts)
188
204
  @anchors[ref["id"]] = { xref: reference }
189
205
  end
190
206
 
@@ -1,3 +1,3 @@
1
1
  module IsoDoc
2
- VERSION = "0.8.13".freeze
2
+ VERSION = "0.9.0".freeze
3
3
  end
@@ -15,7 +15,7 @@ RSpec.describe IsoDoc do
15
15
  <bibliography><references id="_normative_references" obligation="informative"><title>Normative References</title>
16
16
  <bibitem id="ISO712" type="standard">
17
17
  <title format="text/plain">Cereals and cereal products</title>
18
- <docidentifier>ISO 712</docidentifier>
18
+ <docidentifier type="ISO">ISO 712</docidentifier>
19
19
  <contributor>
20
20
  <role type="publisher"/>
21
21
  <organization>
@@ -25,7 +25,7 @@ RSpec.describe IsoDoc do
25
25
  </bibitem>
26
26
  <bibitem id="ISO16634" type="standard">
27
27
  <title format="text/plain">Cereals, pulses, milled cereal products, oilseeds and animal feeding stuffs</title>
28
- <docidentifier>ISO 16634</docidentifier>
28
+ <docidentifier type="ISO">ISO 16634:-- (all parts)</docidentifier>
29
29
  <date type="published"><on>--</on></date>
30
30
  <contributor>
31
31
  <role type="publisher"/>
@@ -38,7 +38,7 @@ RSpec.describe IsoDoc do
38
38
  </bibitem>
39
39
  <bibitem id="ISO20483" type="standard">
40
40
  <title format="text/plain">Cereals and pulses</title>
41
- <docidentifier>ISO 20483</docidentifier>
41
+ <docidentifier type="ISO">ISO 20483:2013-2014</docidentifier>
42
42
  <date type="published"><from>2013</from><to>2014</to></date>
43
43
  <contributor>
44
44
  <role type="publisher"/>
@@ -49,14 +49,14 @@ RSpec.describe IsoDoc do
49
49
  </bibitem>
50
50
  <bibitem id="ref1">
51
51
  <formattedref format="application/x-isodoc+xml"><smallcap>Standard No I.C.C 167</smallcap>. <em>Determination of the protein content in cereal and cereal products for food and animal feeding stuffs according to the Dumas combustion method</em> (see <link target="http://www.icc.or.at"/>)</formattedref>
52
- <docidentifier>ICC 167</docidentifier>
52
+ <docidentifier type="ICC">167</docidentifier>
53
53
  </bibitem>
54
54
 
55
55
  </references><references id="_bibliography" obligation="informative">
56
56
  <title>Bibliography</title>
57
57
  <bibitem id="ISO3696" type="standard">
58
58
  <title format="text/plain">Water for analytical laboratory use</title>
59
- <docidentifier>ISO 3696</docidentifier>
59
+ <docidentifier type="ISO">ISO 3696</docidentifier>
60
60
  <contributor>
61
61
  <role type="publisher"/>
62
62
  <organization>
@@ -70,7 +70,7 @@ RSpec.describe IsoDoc do
70
70
  </bibitem>
71
71
  <bibitem id="ref11">
72
72
  <formattedref format="application/x-isodoc+xml"><smallcap>Standard No I.C.C 167</smallcap>. <em>Determination of the protein content in cereal and cereal products for food and animal feeding stuffs according to the Dumas combustion method</em> (see <link target="http://www.icc.or.at"/>)</formattedref>
73
- <docidentifier>IETF RFC 10</docidentifier>
73
+ <docidentifier type="IETF">RFC 10</docidentifier>
74
74
  </bibitem>
75
75
 
76
76
 
@@ -95,7 +95,7 @@ RSpec.describe IsoDoc do
95
95
  <p>The following documents are referred to in the text in such a way that some or all of their content constitutes requirements of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.</p>
96
96
  <p id="ISO712" class="NormRef">ISO 712, <i> Cereals and cereal products</i></p>
97
97
  <p id="ISO16634" class="NormRef">ISO 16634:-- (all parts)<a rel="footnote" href="#fn:1" epub:type="footnote"><sup>1</sup></a>, <i> Cereals, pulses, milled cereal products, oilseeds and animal feeding stuffs</i></p>
98
- <p id="ISO20483" class="NormRef">ISO 20483:2013&#8211;2014, <i> Cereals and pulses</i></p>
98
+ <p id="ISO20483" class="NormRef">ISO 20483:2013-2014, <i> Cereals and pulses</i></p>
99
99
  <p id="ref1" class="NormRef">ICC 167, <span style="font-variant:small-caps;">Standard No I.C.C 167</span>. <i>Determination of the protein content in cereal and cereal products for food and animal feeding stuffs according to the Dumas combustion method</i> (see <a href="http://www.icc.or.at">http://www.icc.or.at</a>)</p>
100
100
  </div>
101
101
  <br/>
@@ -103,7 +103,7 @@ RSpec.describe IsoDoc do
103
103
  <h1 class="Section3">Bibliography</h1>
104
104
  <p id="ISO3696" class="Biblio">[1]&#160; ISO 3696, <i> Water for analytical laboratory use</i></p>
105
105
  <p id="ref10" class="Biblio">[10]&#160; <span style="font-variant:small-caps;">Standard No I.C.C 167</span>. <i>Determination of the protein content in cereal and cereal products for food and animal feeding stuffs according to the Dumas combustion method</i> (see <a href="http://www.icc.or.at">http://www.icc.or.at</a>)</p>
106
- <p id="ref11" class="Biblio">[3]&#160; IETF RFC 10,<span style="font-variant:small-caps;">Standard No I.C.C 167</span>. <i>Determination of the protein content in cereal and cereal products for food and animal feeding stuffs according to the Dumas combustion method</i> (see <a href="http://www.icc.or.at">http://www.icc.or.at</a>)</p>
106
+ <p id="ref11" class="Biblio">[3]&#160; IETF RFC 10, <span style="font-variant:small-caps;">Standard No I.C.C 167</span>. <i>Determination of the protein content in cereal and cereal products for food and animal feeding stuffs according to the Dumas combustion method</i> (see <a href="http://www.icc.or.at">http://www.icc.or.at</a>)</p>
107
107
  </div>
108
108
  <aside id="fn:1" class="footnote">
109
109
  <p>Under preparation. (Stage at the time of publication ISO/DIS 16634)</p>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: isodoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.13
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-09-02 00:00:00.000000000 Z
11
+ date: 2018-09-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciimath