mirror of https://github.com/freeCodeCamp/devdocs
# The first commit's message is: Initial addition of the filters,scraper, and icons. Conflicts: lib/docs/filters/yii/clean_html.rb lib/docs/filters/yii/entries.rb public/docs/docs.json # This is the 2nd commit message: Trying to get the code to format to convention. Git shows code differently than my editor.pull/62/head
parent
2f0d59ccdd
commit
5f7e905a29
@ -0,0 +1,95 @@
|
|||||||
|
module Docs
|
||||||
|
class Yii
|
||||||
|
class CleanHtmlFilter < Filter
|
||||||
|
def call
|
||||||
|
<<<<<<< HEAD
|
||||||
|
|
||||||
|
#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
|
||||||
|
|
||||||
|
=======
|
||||||
|
|
||||||
|
#remove meaningless 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
|
||||||
|
|
||||||
|
#remove javascript show links
|
||||||
|
css('b').each do |node|
|
||||||
|
if node['class'] == "show"
|
||||||
|
node.remove
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# Put code blocks in <pre> tags
|
||||||
|
css('.code').each do |node|
|
||||||
|
node.name = 'pre'
|
||||||
|
end
|
||||||
|
|
||||||
|
#remove "Hide inherited methods / properties
|
||||||
|
css('a').each do |node|
|
||||||
|
if node['class'] == 'toggle'
|
||||||
|
node.remove
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
>>>>>>> 9150005... Initial addition of the filters,scraper, and icons.
|
||||||
|
doc
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,56 @@
|
|||||||
|
module Docs
|
||||||
|
class Yii
|
||||||
|
class EntriesFilter < Docs::EntriesFilter
|
||||||
|
<<<<<<< HEAD
|
||||||
|
|
||||||
|
=======
|
||||||
|
|
||||||
|
>>>>>>> 9150005... Initial addition of the filters,scraper, and icons.
|
||||||
|
def get_name
|
||||||
|
#class names exist in the <h1> content.
|
||||||
|
name = at_css('h1').content.strip
|
||||||
|
end
|
||||||
|
<<<<<<< HEAD
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
=======
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
>>>>>>> 9150005... Initial addition of the filters,scraper, and icons.
|
||||||
|
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,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
|
Loading…
Reference in new issue