Skip to content

Commit

Permalink
use complete records as rfcsubseries relation #120
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew2net committed Jan 15, 2024
1 parent 613213b commit 50d146b
Show file tree
Hide file tree
Showing 10 changed files with 30,647 additions and 52,801 deletions.
10 changes: 6 additions & 4 deletions lib/relaton_ietf/rfc_index_entry.rb
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,12 @@ def formattedref
#
def parse_relation
@is_also.map do |ref|
fref = RelatonBib::FormattedRef.new content: ref
id = ref.sub(/^([A-Z]+)0*(\d+)$/, '\1 \2')
docid = RelatonBib::DocumentIdentifier.new(type: "IETF", id: id, primary: true)
bib = IetfBibliographicItem.new formattedref: fref, docid: [docid]
entry = @doc.at("/xmlns:rfc-index/xmlns:rfc-entry[xmlns:doc-id = '#{ref}']")
bib = RfcEntry.parse entry
# fref = RelatonBib::FormattedRef.new content: ref
# id = ref.sub(/^([A-Z]+)0*(\d+)$/, '\1 \2')
# docid = RelatonBib::DocumentIdentifier.new(type: "IETF", id: id, primary: true)
# bib = IetfBibliographicItem.new formattedref: fref, docid: [docid]
{ type: "includes", bibitem: bib }
end
end
Expand Down
15 changes: 15 additions & 0 deletions spec/relaton_ietf/rfc_index_entry_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,19 @@
<bcp-entry>
<doc-id>BCP0001</doc-id>
<stream>IETF</stream>
<is-also>
<doc-id>RFC0002</doc-id>
</is-also>
</bcp-entry>
<rfc-entry>
<doc-id>RFC0002</doc-id>
<title>Test</title>
<author>
<name>Author</name>
</author>
<current-status>PROPOSED STANDARD</current-status>
<doi>10.17487/RFC0002</doi>
</rfc-entry>
</rfc-index>
XML
xml.at "/xmlns:rfc-index/xmlns:bcp-entry"
Expand Down Expand Up @@ -134,6 +146,9 @@
expect(rels.first).to be_instance_of Hash
expect(rels.first[:bibitem]).to be_instance_of RelatonIetf::IetfBibliographicItem
expect(rels.first[:bibitem].docidentifier.first.id).to eq "RFC 2"
expect(rels.first[:bibitem].title.first.title.content).to eq "Test"
expect(rels.first[:bibitem].contributor.first.entity.name.completename.content).to eq "Author"
expect(rels.first[:type]).to eq "includes"
end

it "parse series" do
Expand Down
42 changes: 21 additions & 21 deletions spec/vcr_cassettes/bcp_47.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions spec/vcr_cassettes/fyi_2.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions spec/vcr_cassettes/i_d_abarth_cake_01.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 50d146b

Please sign in to comment.