twig.rb 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. module Docs
  2. class Twig < UrlScraper
  3. self.type = 'sphinx'
  4. self.root_path = 'index.html'
  5. self.initial_paths = %w(extensions/index.html)
  6. self.links = {
  7. home: 'https://twig.symfony.com/',
  8. code: 'https://github.com/twigphp/Twig'
  9. }
  10. options[:attribution] = <<-HTML
  11. &copy; 2009&ndash;2018 by the Twig Team<br>
  12. Licensed under the three clause BSD license.<br>
  13. The Twig logo is &copy; 2010&ndash;2018 Symfony
  14. HTML
  15. html_filters.push 'twig/clean_html', 'twig/entries'
  16. options[:container] = 'div.bd > div.content'
  17. options[:skip] = %w(deprecated.html advanced_legacy.html)
  18. version '2' do
  19. self.release = '2.5.0'
  20. self.base_url = 'https://twig.symfony.com/doc/2.x/'
  21. end
  22. version '1' do
  23. self.release = '1.34.3'
  24. self.base_url = 'https://twig.symfony.com/doc/1.x/'
  25. end
  26. def get_latest_version(options, &block)
  27. get_github_tags('twigphp', 'Twig', options) do |tags|
  28. block.call tags[0]['name'][1..-1]
  29. end
  30. end
  31. end
  32. end