sanctuary.rb 848 B

123456789101112131415161718192021222324252627282930313233
  1. module Docs
  2. class Sanctuary < UrlScraper
  3. self.name = "Sanctuary"
  4. self.slug = "sanctuary"
  5. self.type = "sanctuary"
  6. self.release = "3.1.0"
  7. self.base_url = "https://sanctuary.js.org/"
  8. self.links = {
  9. home: "https://sanctuary.js.org/",
  10. code: "https://github.com/sanctuary-js/sanctuary",
  11. }
  12. html_filters.push "sanctuary/entries", "sanctuary/clean_html"
  13. options[:container] = '#css-main'
  14. options[:title] = "Sanctuary"
  15. options[:attribution] = "Licensed under the MIT License."
  16. def get_latest_version(opts)
  17. get_npm_version("sanctuary", opts)
  18. end
  19. private
  20. def parse(response) # Hook here because Nokogori removes whitespace from textareas
  21. response.body.gsub! %r{<div class="output"[^>]*>([\W\w]+?)</div>}, '<pre class="output">\1</pre>'
  22. super
  23. end
  24. end
  25. end