mirror of https://github.com/freeCodeCamp/devdocs
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
|
||||
© 2009–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
|
After Width: | Height: | Size: 838 B |
After Width: | Height: | Size: 4.1 KiB |
@ -0,0 +1 @@
|
||||
http://twig.sensiolabs.org/images/twig-logo.png
|
Loading…
Reference in new issue