1
0

pug.rb 786 B

1234567891011121314151617181920212223242526272829303132
  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 = '2.0.3'
  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. def get_latest_version(opts)
  18. get_npm_version('pug', opts)
  19. end
  20. private
  21. def parse(response) # Hook here because Nokogori removes whitespace from textareas
  22. response.body.gsub! %r{<textarea\ [^>]*>([\W\w]+?)</textarea>}, '<pre>\1</pre>'
  23. super
  24. end
  25. end
  26. end