mirror of
https://github.com/freeCodeCamp/devdocs
synced 2024-11-18 10:07:11 +01:00
Extract constants and methods
This commit is contained in:
parent
a812cc8d0a
commit
4cde9d2961
3 changed files with 24 additions and 3 deletions
|
@ -7,6 +7,11 @@ module Docs
|
|||
# Remove unnecessary things
|
||||
css('.headerlink', '#what-is-phalcon', '#other-formats', '#welcome h1', '#welcome p', '#table-of-contents h2').remove
|
||||
|
||||
# Add id for constants and methods
|
||||
css('#constants strong', '#methods strong').each do |node|
|
||||
node.parent['id'] = node.content.strip
|
||||
end
|
||||
|
||||
doc
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
module Docs
|
||||
class Phalcon
|
||||
class EntriesFilter < Docs::EntriesFilter
|
||||
|
||||
def get_name
|
||||
node = css('h1').first
|
||||
name = node.content.strip
|
||||
|
@ -9,12 +10,26 @@ module Docs
|
|||
end
|
||||
|
||||
def get_type
|
||||
if slug.start_with?('reference')
|
||||
'Reference'
|
||||
if slug.start_with? 'reference'
|
||||
'Guides'
|
||||
else
|
||||
'API'
|
||||
'Classes'
|
||||
end
|
||||
end
|
||||
|
||||
def additional_entries
|
||||
entries = []
|
||||
|
||||
css('#constants strong').each do |node|
|
||||
entries << [node.content.strip, node.parent['id'], 'Constants']
|
||||
end
|
||||
|
||||
css('#methods strong').each do |node|
|
||||
entries << [node.content.strip, node.parent['id'], 'Methods']
|
||||
end
|
||||
|
||||
entries
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -14,6 +14,7 @@ module Docs
|
|||
|
||||
options[:root_title] = 'Phalcon'
|
||||
options[:only_patterns] = [/reference\//, /api\//]
|
||||
options[:skip_patterns] = [/api\/index/]
|
||||
|
||||
options[:attribution] = <<-HTML
|
||||
© 2012–2015 the Phalcon Team<br>
|
||||
|
|
Loading…
Reference in a new issue