pug.rb 714 B

12345678910111213141516171819202122232425262728
  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.0-rc.4'
  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. private
  18. def parse(response) # Hook here because Nokogori removes whitespace from textareas
  19. response.body.gsub! %r{<textarea\ [^>]*>([\W\w]+?)</textarea>}, '<pre>\1</pre>'
  20. super
  21. end
  22. end
  23. end