relaton-ietf 1.11.0 → 1.11.3

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: 487865677406ccb87b65d3f4064c60bef7d26b7955817dd7030c4272eabf3e3f
4
- data.tar.gz: 818d190f6bcb3d91a9b5a0bf7ebe8e5acd20e3f1e46de30c1b7e6e9b4435116b
3
+ metadata.gz: 53c7e68edafd4a51e8b08f0b169318d1864a0fba32327f9ceaf2eb7968048c97
4
+ data.tar.gz: 8b75d635bbc3e97c9cb7a680ed0c657d50614a5313babe1ac5759dd0e1c584c4
5
5
  SHA512:
6
- metadata.gz: 1f2553900686f5c7a1a3653b0e9546510448e79dde9965d8c1aa604377bde3489d805bdd13ae68128bfa7f49fd4037d588584c3dcc3ca594579f5410c6cb0b6e
7
- data.tar.gz: 1a0599db3efa91cfd7360f53cc77bffdb1fcf7b445f2fc56e9d2957634826adf71be8c54a75e71e2b5e4619e91c00d7b351b01eb01c16535be2c3602281ba45d
6
+ metadata.gz: bcdaea6abeb068ad1a23bd9e2ba3f5792c1eeccd06b90586f8307aa005f3204f6cd135ac96b38b5ac60a1a38e70980ec3ff3163255eb5b79254f60bba8be9732
7
+ data.tar.gz: 2f2ce84d3898691e786fc598963842f68e36ea0ee2a9ee179d131d00ab1ce724860938e40caedbb4cf06adf1cafceffdbd9109e481ae8142453f804c80349088
data/Gemfile CHANGED
@@ -1,6 +1,3 @@
1
- Encoding.default_external = Encoding::UTF_8
2
- Encoding.default_internal = Encoding::UTF_8
3
-
4
1
  source "https://rubygems.org"
5
2
 
6
3
  git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
@@ -63,13 +63,19 @@ module RelatonIetf
63
63
  #
64
64
  # Fetches ietf-internet-drafts documents
65
65
  #
66
- def fetch_ieft_internet_drafts # rubocop:disable Metrics/MethodLength
66
+ def fetch_ieft_internet_drafts # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
67
67
  versions = Dir["bibxml-ids/*.xml"].each_with_object([]) do |path, vers|
68
68
  file = File.basename path, ".xml"
69
69
  if file.include?("D.draft-")
70
70
  vers << file.sub(/^reference\.I-D\./, "")
71
+ /(?<ver>\d+)$/ =~ file
71
72
  end
72
- save_doc BibXMLParser.parse(File.read(path, encoding: "UTF-8"))
73
+ bib = BibXMLParser.parse(File.read(path, encoding: "UTF-8"))
74
+ if ver
75
+ version = RelatonBib::BibliographicItem::Version.new nil, [ver]
76
+ bib.instance_variable_set :@version, version
77
+ end
78
+ save_doc bib
73
79
  end
74
80
  update_versions(versions) if versions.any? && @format != "bibxml"
75
81
  end
@@ -3,12 +3,13 @@ module RelatonIetf
3
3
  #
4
4
  # Document parser initalization
5
5
  #
6
- # @param [String] name document type name
6
+ # @param [Nokogiri::XML::Element] doc document
7
7
  # @param [String] doc_id document id
8
8
  # @param [Array<String>] is_also included document ids
9
9
  #
10
- def initialize(name, doc_id, is_also)
11
- @name = name
10
+ def initialize(doc, doc_id, is_also)
11
+ @doc = doc
12
+ @name = doc.name.split("-").first
12
13
  @shortnum = doc_id[-4..-1].sub(/^0+/, "")
13
14
  @doc_id = doc_id
14
15
  @is_also = is_also
@@ -26,8 +27,7 @@ module RelatonIetf
26
27
  is_also = doc.xpath("./xmlns:is-also/xmlns:doc-id").map &:text
27
28
  return unless doc_id && is_also.any?
28
29
 
29
- name = doc.name.split("-").first
30
- new(name, doc_id.text, is_also).parse
30
+ new(doc, doc_id.text, is_also).parse
31
31
  end
32
32
 
33
33
  def parse
@@ -79,7 +79,9 @@ module RelatonIetf
79
79
 
80
80
  def parse_relation
81
81
  @is_also.each_with_object([]) do |ref, a|
82
- bib = IetfBibliography.get ref.sub(/^(RFC)(\d+)/, '\1 \2')
82
+ # bib = IetfBibliography.get ref.sub(/^(RFC)(\d+)/, '\1 \2')
83
+ ref_doc = @doc.at "/xmlns:rfc-index/xmlns:rfc-entry[xmlns:doc-id[text()='#{ref}']]"
84
+ bib = RfcEntry.parse ref_doc
83
85
  a << { type: "includes", bibitem: bib } if bib
84
86
  end
85
87
  end
@@ -38,7 +38,7 @@ module RelatonIetf
38
38
  # doc = Nokogiri::XML get_page(uri)
39
39
  # r = doc.at("/referencegroup", "/reference")
40
40
  # fetch_rfc r, is_relation: is_relation, url: uri, ver: ver
41
- BibXMLParser.parse get_page(uri), url: uri, is_relation: is_relation, ver: ver
41
+ BibXMLParser.parse get_page(uri), is_relation: is_relation, ver: ver
42
42
  end
43
43
 
44
44
  # @param uri [String]
@@ -1,3 +1,3 @@
1
1
  module RelatonIetf
2
- VERSION = "1.11.0".freeze
2
+ VERSION = "1.11.3".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-ietf
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.11.0
4
+ version: 1.11.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-04-10 00:00:00.000000000 Z
11
+ date: 2022-05-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: equivalent-xml