Add Twig Documentation

pull/496/head
David 8 years ago committed by Thibaut Courouble
parent 86dd7996b0
commit 6b0e60f65a

@ -0,0 +1,12 @@
module Docs
class Twig
class CleanHtmlFilter < Filter
def call
css('.infobar', '.admonition-note', 'ul.pages', '.offline-docs').remove
doc
end
end
end
end

@ -0,0 +1,33 @@
module Docs
class Twig
class EntriesFilter < Docs::EntriesFilter
def get_name
name = at_css('h1').content.strip.tr('¶', '')
name
end
def get_type
if slug.include?('deprecate')
'Deprecated'
elsif slug.include?('extensions')
'Doc\\Extensions'
elsif slug.include?('tags')
'tags'
elsif slug.include?('filters')
'filters'
elsif slug.include?('functions')
'functions'
elsif slug.include?('tests')
'tests'
elsif slug.include?('-operator') || slug.include?('#math') || slug.include?('comparisons')
'operators'
elsif slug.in?('doc/index') || slug.include?('intro') || slug.include?('recipes') || slug.include?('internals') || slug.include?('coding_standards') || slug.include?('installation') || slug.include?('api') || slug.include?('advanced')
'Doc'
elsif slug.include?('templates')
'Doc\\Templates'
end
end
end
end
end

@ -0,0 +1,20 @@
module Docs
class Twig < UrlScraper
self.type = 'twig'
options[:attribution] = <<-HTML
&copy; 2009&ndash;2016 by SensioLabs<br>
Licensed under the three clause BSD license.
HTML
self.release = '1.24.1'
self.base_url = 'http://twig.sensiolabs.org/'
self.root_path = 'documentation'
html_filters.push 'twig/clean_html', 'twig/entries'
options[:container] = 'div.bd > div.content'
options[:skip_patterns] = [/\Aapi/, /\Alicense/]
options[:skip] = %w(doc/deprecated.html doc/advanced_legacy.html)
end
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 838 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

@ -0,0 +1 @@
http://twig.sensiolabs.org/images/twig-logo.png
Loading…
Cancel
Save