mdn.rb 584 B

123456789101112131415161718192021222324
  1. module Docs
  2. class Mdn < UrlScraper
  3. self.abstract = true
  4. self.type = 'mdn'
  5. params[:raw] = 1
  6. params[:macros] = 1
  7. html_filters.push 'mdn/clean_html'
  8. text_filters.insert_before 'attribution', 'mdn/contribute_link'
  9. options[:trailing_slash] = false
  10. options[:attribution] = <<-HTML
  11. &copy; 2013 Mozilla Contributors<br>
  12. Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
  13. HTML
  14. private
  15. def process_response?(response)
  16. super && response.effective_url.query == 'raw=1&macros=1'
  17. end
  18. end
  19. end