diff options
Diffstat (limited to 'lib/helpers/RstSemantic.rb')
| -rw-r--r-- | lib/helpers/RstSemantic.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/helpers/RstSemantic.rb b/lib/helpers/RstSemantic.rb new file mode 100644 index 0000000..ac18f9d --- /dev/null +++ b/lib/helpers/RstSemantic.rb @@ -0,0 +1,18 @@ +require 'nokogiri' + +module RstSemantic + def get_toc(raw) + doc = Nokogiri::HTML(raw) + return doc.css("div.contents").to_s.gsub(/<li>.*Summary<\/a><\/li>/, '') + end + + def get_content(raw) + doc = Nokogiri::HTML(raw) + return doc.css("div.document > div.section")[1..-1] + end + + def get_summary(raw) + doc = Nokogiri::HTML(raw) + return doc.css("div.section").first.to_s.gsub(/<h1>.*<\/h1>/, '') + end +end |
