Extract constants and methods

This commit is contained in:
James Shih 2015-08-10 16:20:26 +08:00 committed by Thibaut
parent a812cc8d0a
commit 4cde9d2961
3 changed files with 24 additions and 3 deletions

View file

@ -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

View file

@ -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

View file

@ -14,6 +14,7 @@ module Docs
options[:root_title] = 'Phalcon'
options[:only_patterns] = [/reference\//, /api\//]
options[:skip_patterns] = [/api\/index/]
options[:attribution] = <<-HTML
&copy; 2012&ndash;2015 the Phalcon Team<br>