relaton-ieee 1.9.1 → 1.9.2

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: 53ecd27da5566b505d1ced7fc6f29af23ec9a45124501e790596350851c362a0
4
- data.tar.gz: 2e6b02cedacffd9d44004aa480d57037abfcd6ddf9a5371c5fed0bea2aa533f3
3
+ metadata.gz: 7b87fe1e68a822c6589d00479407ad483f13bcffd1d652885839e0e15c0f0b8c
4
+ data.tar.gz: 8592b17b9d14faaa3b4a117c1f453af5591884230b6f92f68a4caf4a7dc89bed
5
5
  SHA512:
6
- metadata.gz: fb1c5ed0240d28a7494e0e7f7c587ad29610f1ec83aa6ca3f390b9d98256c96b2d8e735d3e46425c7d0b3457b66a1e020c0744d7dfa0b8c031535c866e0a53a7
7
- data.tar.gz: ba00b7b538a63696c5e646953eb4f68a76e8c25dd7e1a1a221e2c8edacf1155c8f0eb14951421b253e252190d0f728f681f25712bc5798f6235e93463f97aaa8
6
+ metadata.gz: 0463f9179cd438c1c9bcd146b586aa82143ddf119b00b36b24a33bead1f9cfc597553cc277c3ff24e5c2f58b4c7ded9bd553bdfec3e2a327d14377f000a94346
7
+ data.tar.gz: 3777fa1634406a12a0734a6efab5d0ac9df0aa540f4f7fb7e26118657809a3120bc796b257e02b2a460cf79757cdfbeb38e224ec1be30798ee9aa23649a0ee63
data/README.adoc CHANGED
@@ -138,6 +138,16 @@ RelatonIeee::IeeeBibliography.get("IEEE 528-2019")
138
138
  ...
139
139
  ----
140
140
 
141
+ === Typed links
142
+
143
+ Each IEEE document has `src` type link.
144
+
145
+ [source,ruby]
146
+ ----
147
+ item.link
148
+ => [#<RelatonBib::TypedUri:0x00007fe885219ba0 @content=#<Addressable::URI:0x8ac URI:https://standards.ieee.org/standard/528-2019.html>, @type="src">]
149
+ ----
150
+
141
151
  === Create bibliographic item from XML
142
152
  [source,ruby]
143
153
  ----
@@ -0,0 +1,14 @@
1
+ module RelatonIeee
2
+ module BibXMLParser
3
+ extend RelatonBib::BibXMLParser
4
+ extend BibXMLParser
5
+
6
+ FLAVOR = "IEEE"
7
+
8
+ # @param attrs [Hash]
9
+ # @return [RelatonBib::IetfBibliographicItem]
10
+ def bib_item(**attrs)
11
+ IeeeBibliographicItem.new(**attrs)
12
+ end
13
+ end
14
+ end
@@ -27,6 +27,7 @@ module RelatonIeee
27
27
  def initialize(output, format)
28
28
  @output = output
29
29
  @format = format
30
+ @ext = format.sub(/^bib/, "")
30
31
  @crossrefs = {}
31
32
  @backrefs = {}
32
33
  end
@@ -130,7 +131,11 @@ module RelatonIeee
130
131
  # @param [RelatonIeee::IeeeBibliographicItem] bib
131
132
  #
132
133
  def save_doc(bib)
133
- c = @format == "xml" ? bib.to_xml(bibdata: true) : bib.to_hash.to_yaml
134
+ c = case @format
135
+ when "xml" then bib.to_xml(bibdata: true)
136
+ when "yaml" then bib.to_hash.to_yaml
137
+ else bib.send("to_#{@format}")
138
+ end
134
139
  File.write file_name(bib.docnumber), c, encoding: "UTF-8"
135
140
  end
136
141
 
@@ -142,8 +147,8 @@ module RelatonIeee
142
147
  # @return [String] filename
143
148
  #
144
149
  def file_name(docnumber)
145
- name = docnumber.gsub(/[.\s,:\/]/, "_").squeeze("_").upcase
146
- File.join @output, "#{name}.#{@format}"
150
+ name = docnumber.gsub(/\s-/, "-").gsub(/[.\s,:\/]/, "_").squeeze("_").upcase
151
+ File.join @output, "#{name}.#{@ext}"
147
152
  end
148
153
 
149
154
  #
@@ -198,7 +203,9 @@ module RelatonIeee
198
203
  #
199
204
  def read_bib(docnumber)
200
205
  c = File.read file_name(docnumber), encoding: "UTF-8"
201
- if @format == "xml" then XMLParser.from_xml c
206
+ case @format
207
+ when "xml" then XMLParser.from_xml c
208
+ when "bibxml" then BibXMLParser.parse c
202
209
  else IeeeBibliographicItem.from_hash YAML.safe_load(c)
203
210
  end
204
211
  end
@@ -1,3 +1,3 @@
1
1
  module RelatonIeee
2
- VERSION = "1.9.1".freeze
2
+ VERSION = "1.9.2".freeze
3
3
  end
data/lib/relaton_ieee.rb CHANGED
@@ -9,6 +9,7 @@ require "relaton_ieee/scrapper"
9
9
  require "relaton_ieee/ieee_bibliographic_item"
10
10
  require "relaton_ieee/committee"
11
11
  require "relaton_ieee/xml_parser"
12
+ require "relaton_ieee/bibxml_parser"
12
13
  require "relaton_ieee/hash_converter"
13
14
  require "relaton_ieee/data_fetcher"
14
15
 
data/relaton_ieee.gemspec CHANGED
@@ -38,6 +38,6 @@ Gem::Specification.new do |spec|
38
38
  spec.add_development_dependency "webmock"
39
39
 
40
40
  spec.add_dependency "faraday", "~> 1.1"
41
- spec.add_dependency "relaton-bib", "~> 1.9.0"
41
+ spec.add_dependency "relaton-bib", ">= 1.9.5"
42
42
  spec.add_dependency "rubyzip", "~> 2.3.0"
43
43
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-ieee
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.1
4
+ version: 1.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-09-24 00:00:00.000000000 Z
11
+ date: 2021-10-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: equivalent-xml
@@ -98,16 +98,16 @@ dependencies:
98
98
  name: relaton-bib
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - "~>"
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
- version: 1.9.0
103
+ version: 1.9.5
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - "~>"
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
- version: 1.9.0
110
+ version: 1.9.5
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: rubyzip
113
113
  requirement: !ruby/object:Gem::Requirement
@@ -146,6 +146,7 @@ files:
146
146
  - grammars/isodoc.rng
147
147
  - grammars/reqt.rng
148
148
  - lib/relaton_ieee.rb
149
+ - lib/relaton_ieee/bibxml_parser.rb
149
150
  - lib/relaton_ieee/committee.rb
150
151
  - lib/relaton_ieee/data_fetcher.rb
151
152
  - lib/relaton_ieee/data_parser.rb