mirror of https://github.com/freeCodeCamp/devdocs
commit
14e885aef5
@ -0,0 +1,48 @@
|
|||||||
|
module Docs
|
||||||
|
class Yii
|
||||||
|
class CleanHtmlFilter < Filter
|
||||||
|
def call
|
||||||
|
|
||||||
|
#remove irrelevant content
|
||||||
|
css('div').each do |node|
|
||||||
|
if node['class'] == "layout-main-header"
|
||||||
|
node.remove
|
||||||
|
elsif node['class'] == "layout-main-submenu"
|
||||||
|
node.remove
|
||||||
|
elsif node['class'] == "layout-main-shortcuts"
|
||||||
|
node.remove
|
||||||
|
elsif node['class'] == "layout-main-footer"
|
||||||
|
node.remove
|
||||||
|
elsif node['class'] == "grid_3 alpha"
|
||||||
|
node.remove
|
||||||
|
elsif node['class'] == "comments"
|
||||||
|
node.remove
|
||||||
|
elsif node['class'] == "api-suggest clearfix"
|
||||||
|
node.remove
|
||||||
|
elsif node['id'] == "comments"
|
||||||
|
node.remove
|
||||||
|
elsif node['id'] == "nav"
|
||||||
|
node.remove
|
||||||
|
else
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# Put code blocks in <pre> tags
|
||||||
|
css('.code').each do |node|
|
||||||
|
node.name = 'pre'
|
||||||
|
end
|
||||||
|
|
||||||
|
#remove Hide inherited methods / properties and show links
|
||||||
|
css('a').each do |node|
|
||||||
|
if node['class'] == 'toggle'
|
||||||
|
node.remove
|
||||||
|
elsif node['class'] == 'show'
|
||||||
|
node.remove
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
doc
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,30 @@
|
|||||||
|
module Docs
|
||||||
|
class Yii
|
||||||
|
class EntriesFilter < Docs::EntriesFilter
|
||||||
|
|
||||||
|
def get_name
|
||||||
|
#class names exist in the <h1> content.
|
||||||
|
name = at_css('h1').content.strip
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_type
|
||||||
|
#need to get the table with a class of summaryTable. Then we need the content of the first td in the first tr.
|
||||||
|
type = css('table.summaryTable td')[0].content
|
||||||
|
type
|
||||||
|
end
|
||||||
|
|
||||||
|
def additional_entries
|
||||||
|
css('table.summaryTable tr[id]').inject [] do |entries,node|
|
||||||
|
#need to ignore inherited methods and properties
|
||||||
|
if (node['class'] != 'inherited' and node.parent().parent()['class'] == "summary docMethod")
|
||||||
|
#name should be Class.method() id will take you to the link in the summary block.
|
||||||
|
name = slug + "." + node['id'] + "()"
|
||||||
|
entries << [name, node['id']]
|
||||||
|
end
|
||||||
|
entries
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,12 @@
|
|||||||
|
module Docs
|
||||||
|
class Yii < UrlScraper
|
||||||
|
self.name = 'Yii'
|
||||||
|
self.slug = 'yii'
|
||||||
|
self.type = 'yii'
|
||||||
|
self.version = '1.1.14'
|
||||||
|
self.base_url = 'http://www.yiiframework.com/doc/api/1.1/'
|
||||||
|
|
||||||
|
html_filters.push 'yii/clean_html', 'yii/entries'
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
After Width: | Height: | Size: 890 B |
After Width: | Height: | Size: 2.0 KiB |
Loading…
Reference in new issue