pug.rb 841 B

123456789101112131415161718192021222324252627282930313233343536
  1. module Docs
  2. class Pug < UrlScraper
  3. self.type = 'pug'
  4. self.base_url = 'https://pugjs.org/'
  5. self.root_path = 'api/getting-started.html'
  6. self.release = '3.0.0'
  7. self.links = {
  8. home: 'https://pugjs.org/',
  9. code: 'https://github.com/pugjs/pug'
  10. }
  11. html_filters.push 'pug/clean_html', 'pug/entries'
  12. options[:container] = 'body > .container'
  13. options[:attribution] = <<-HTML
  14. &copy; Pug authors<br>
  15. Licensed under the MIT license.
  16. HTML
  17. options[:skip_patterns] = [
  18. /support/
  19. ]
  20. def get_latest_version(opts)
  21. get_npm_version('pug', opts)
  22. end
  23. private
  24. def parse(response) # Hook here because Nokogori removes whitespace from textareas
  25. response.body.gsub! %r{<textarea\ [^>]*>([\W\w]+?)</textarea>}, '<pre>\1</pre>'
  26. super
  27. end
  28. end
  29. end