lib/bible_gateway.rb in bible_gateway-0.0.11 vs lib/bible_gateway.rb in bible_gateway-0.0.12

- old
+ new

@@ -36,10 +36,14 @@ # French :bible_du_semeur => "BDS", :louis_segond => "LSG", :nouvelle_edition_de_geneve => "NEG1979", :segond_21 => "SG21", + + #Chinese + :chinese_new_version_simplified => "CNVS", + :chinese_union_version_simplified => "CUVS", } def self.versions VERSIONS.keys end @@ -72,18 +76,32 @@ segment = doc.at('div.passage-wrap') segment.search('sup.crossreference').remove # remove cross reference links segment.search('sup.footnote').remove # remove footnote links segment.search("div.crossrefs").remove # remove cross references segment.search("div.footnotes").remove # remove footnotes + + #scripture_text should be text + text = "" segment.search("span.text").each do |span| - text = span.inner_html - span.swap text + text += span.inner_text end + # text should be html so that text can be used above. + segment.search("span.text").each do |span| + html_content = span.inner_html + span.swap html_content + end + + # text should be html so that text can be used above. segment.search('sup.versenum').each do |sup| - text = sup.content - sup.swap "<sup>#{text}</sup>" + html_content = sup.content + sup.swap "<sup>#{html_content}</sup>" end + content = segment.inner_html.gsub('<p></p>', '').gsub(/<!--.*?-->/, '').strip - {:title => title, :content => content } + + #scripture_text should be text + {:title => title, + :content => content, + :text => text } end end