mirror of https://github.com/freeCodeCamp/devdocs
parent
9f67605e9b
commit
4a930ee4eb
@ -0,0 +1,33 @@
|
||||
module Docs
|
||||
class Yii1
|
||||
class CleanHtmlFilter < Filter
|
||||
def call
|
||||
at_css('h1').content = 'Yii PHP Framework' if root_page?
|
||||
|
||||
css('.api-suggest', '.google-ad', '.g-plusone', '#nav', '#comments').remove
|
||||
|
||||
css('.summary > p > .toggle').each do |node|
|
||||
node.parent.remove
|
||||
end
|
||||
|
||||
css('.signature', '.signature2').each do |node|
|
||||
node.name = 'pre'
|
||||
node.inner_html = node.inner_html.strip
|
||||
end
|
||||
|
||||
css('div.detailHeader').each do |node|
|
||||
node.name = 'h3'
|
||||
end
|
||||
|
||||
css('.sourceCode > .code > code').each do |node|
|
||||
parent = node.parent
|
||||
parent.name = 'pre'
|
||||
node.remove
|
||||
parent.inner_html = node.first_element_child.inner_html.strip
|
||||
end
|
||||
|
||||
doc
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,21 @@
|
||||
module Docs
|
||||
class Yii1
|
||||
class EntriesFilter < Docs::EntriesFilter
|
||||
def get_name
|
||||
at_css('h1').content.strip
|
||||
end
|
||||
|
||||
def get_type
|
||||
css('.summaryTable td').first.content
|
||||
end
|
||||
|
||||
def additional_entries
|
||||
css('.detailHeader').inject [] do |entries, node|
|
||||
name = node.child.content.strip
|
||||
name.prepend self.name + (node.next_element.content.include?('public static') ? '::' : '->')
|
||||
entries << [name, node['id']]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,17 @@
|
||||
module Docs
|
||||
class Yii1 < UrlScraper
|
||||
self.name = 'Yii 1'
|
||||
self.slug = 'yii1'
|
||||
self.type = 'yii'
|
||||
self.version = '1.1.16'
|
||||
self.base_url = 'http://www.yiiframework.com/doc/api/1.1/'
|
||||
|
||||
html_filters.push 'yii1/clean_html', 'yii1/entries'
|
||||
|
||||
options[:container] = '.grid_9'
|
||||
options[:attribution] = <<-HTML
|
||||
© 2008–2015 by Yii Software LLC<br>
|
||||
Licensed under the three clause BSD license.
|
||||
HTML
|
||||
end
|
||||
end
|
Loading…
Reference in new issue