sanctuary.rb 948 B

12345678910111213141516171819202122232425262728293031323334353637
  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] = <<-HTML
  16. &copy; 2020 Sanctuary<br>
  17. &copy; 2016 Plaid Technologies, Inc.<br>
  18. Licensed under the MIT License.
  19. HTML
  20. def get_latest_version(opts)
  21. get_npm_version("sanctuary", opts)
  22. end
  23. private
  24. def parse(response) # Hook here because Nokogori removes whitespace from textareas
  25. response.body.gsub! %r{<div class="output"[^>]*>([\W\w]+?)</div>}, '<pre class="output">\1</pre>'
  26. super
  27. end
  28. end
  29. end