1
0

bootstrap.rb 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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] = true
  9. # https://github.com/twbs/bootstrap/blob/master/LICENSE
  10. options[:attribution] = <<-HTML
  11. &copy; 2011&ndash;2020 Twitter, Inc.<br>
  12. &copy; 2011&ndash;2020 The Bootstrap Authors<br>
  13. Code licensed under the MIT License.<br>
  14. Documentation licensed under the Creative Commons Attribution License v3.0.
  15. HTML
  16. version '4' do
  17. self.release = '4.5'
  18. self.base_url = 'https://getbootstrap.com/docs/4.5/'
  19. self.root_path = 'getting-started/introduction/'
  20. html_filters.push 'bootstrap/entries_v4', 'bootstrap/clean_html_v4'
  21. options[:only_patterns] = [/\Agetting-started\//, /\Alayout\//, /\Acontent\//, /\Acomponents\//, /\Autilities\/.+/, /\Amigration\//]
  22. end
  23. version '3' do
  24. self.release = '3.4.1'
  25. self.base_url = 'https://getbootstrap.com/docs/3.4/'
  26. self.root_path = 'getting-started/'
  27. html_filters.push 'bootstrap/entries_v3', 'bootstrap/clean_html_v3'
  28. options[:only] = %w(getting-started/ css/ components/ javascript/)
  29. end
  30. def get_latest_version(opts)
  31. doc = fetch_doc('https://getbootstrap.com/', opts)
  32. doc.at_css('#bd-versions').content.strip[1..-1]
  33. end
  34. end
  35. end