bootstrap.rb 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. module Docs
  2. class Bootstrap < UrlScraper
  3. self.type = 'bootstrap'
  4. self.links = {
  5. home: 'https://getbootstrap.com/',
  6. code: 'https://github.com/twbs/bootstrap'
  7. }
  8. options[:trailing_slash] = false
  9. options[:attribution] = <<-HTML
  10. &copy; 2011&ndash;2017 Twitter, Inc.<br>
  11. &copy; 2011&ndash;2017 The Bootstrap Authors<br>
  12. Code licensed under the MIT License.<br>
  13. Documentation licensed under the Creative Commons Attribution License v3.0.
  14. HTML
  15. version '4' do
  16. self.release = 'alpha.6'
  17. self.base_url = 'https://v4-alpha.getbootstrap.com/'
  18. self.root_path = 'getting-started/introduction'
  19. html_filters.push 'bootstrap/entries_v4', 'bootstrap/clean_html_v4'
  20. options[:only_patterns] = [/\Agetting-started\//, /\Alayout\//, /\Acontent\//, /\Acomponents\//, /\Autilities\//]
  21. end
  22. version '3' do
  23. self.release = '3.3.7'
  24. self.base_url = 'https://getbootstrap.com/'
  25. self.root_path = 'getting-started'
  26. html_filters.push 'bootstrap/entries_v3', 'bootstrap/clean_html_v3'
  27. options[:only] = %w(getting-started css components javascript)
  28. end
  29. private
  30. def handle_response(response)
  31. response.effective_url.scheme = 'https'
  32. response.effective_url.path = response.effective_url.path.remove(/\/\z/)
  33. super
  34. end
  35. end
  36. end