lib/rfcbib/scrapper.rb in rfcbib-0.2.0 vs lib/rfcbib/scrapper.rb in rfcbib-0.2.1
- old
+ new
@@ -31,11 +31,11 @@
# @return [IsoBibItem::BibliographicItem]
def bib_item
IsoBibItem::BibliographicItem.new(
id: @reference[:anchor],
- docid: docids,
+ docid: docids(@reference[:anchor].sub(/^(RFC)/, "\\1 ")),
status: status,
language: [language],
link: [{ type: 'src', content: @reference[:target] }],
titles: titles,
contributors: contributors,
@@ -161,17 +161,18 @@
#
# Extract document identifiers from reference
#
# @return [Array<IsoBibItem::DocumentIdentifier>]
#
- def docids
- @reference.xpath('//seriesinfo').map do |si|
+ def docids(id)
+ ret = @reference.xpath('//seriesinfo').map do |si|
next unless si[:name] == 'DOI'
IsoBibItem::DocumentIdentifier.new(
id: si[:value],
type: si[:name]
)
end.compact
+ ret << IsoBibItem::DocumentIdentifier.new(type: "IETF", id: id)
end
#
# Extract series form reference
#