lib/rfcbib/scrapper.rb in rfcbib-0.1.1 vs lib/rfcbib/scrapper.rb in rfcbib-0.2.0
- old
+ new
@@ -12,10 +12,14 @@
class << self
# @param text [String]
# @return [IsoBibItem::BibliographicItem]
def scrape_page(text)
ref = text.sub(' ', '.') + '.xml'
- uri = URI("https://www.rfc-editor.org/refs/bibxml/reference.#{ref}")
+ if text =~ /^RFC/
+ uri = URI("https://www.rfc-editor.org/refs/bibxml/reference.#{ref}")
+ elsif text =~ /^I-D/
+ uri = URI "https://xml2rfc.tools.ietf.org/public/rfc/bibxml-ids/reference.#{ref}"
+ end
doc = Nokogiri::HTML Net::HTTP.get(uri)
@reference = doc.at('//reference')
return unless @reference
bib_item
end