lib/onebox/engine/pubmed_onebox.rb in onebox-2.2.12 vs lib/onebox/engine/pubmed_onebox.rb in onebox-2.2.13

- old
+ new

@@ -4,11 +4,11 @@ module Engine class PubmedOnebox include Engine include LayoutSupport - matches_regexp Regexp.new("^https?://(?:(?:\\w)+\\.)?(www.ncbi.nlm.nih)\\.gov(?:/)?/pubmed/\\d+") + matches_regexp(/^https?:\/\/(?:(?:\w)+\.)?(www.ncbi.nlm.nih)\.gov(?:\/)?\/pubmed\/\d+/) private def get_xml doc = Nokogiri::XML(URI.open(URI.join(@url, "?report=xml&format=text"))) @@ -33,10 +33,11 @@ date_arr = (date_arr.map { |s| s.split }).flatten date_arr.sort.reverse.join(" ") # Reverse sort so month before year. end def data - xml = get_xml() + xml = get_xml + { title: xml.css("ArticleTitle").text, authors: authors_of_xml(xml), journal: xml.css("Title").text, abstract: xml.css("AbstractText").text,