Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 37 KiB |
Before Width: | Height: | Size: 96 KiB After Width: | Height: | Size: 97 KiB |
@ -1,16 +1,17 @@
|
||||
._cakephp {
|
||||
h2 { @extend %block-heading; }
|
||||
@extend %simple;
|
||||
|
||||
h3 { @extend %block-label, %label-blue; }
|
||||
h3 > .source { float: right; }
|
||||
h3 > a, span.label, span.php-keyword1 { font-weight: normal; }
|
||||
|
||||
h3 > a { float: right; }
|
||||
|
||||
h3 > a,
|
||||
span.label,
|
||||
span.php-keyword1 {
|
||||
font-weight: normal;
|
||||
h4 {
|
||||
margin: 1.5em 0;
|
||||
@extend %block-label;
|
||||
}
|
||||
|
||||
.tree > dd { margin-left: 0px; }
|
||||
.list { margin-left: 20px; }
|
||||
dl { margin: 1em 0; }
|
||||
|
||||
.info { @extend %note; }
|
||||
code { @extend %label; }
|
||||
p > .label, dt > .label { @extend %label, %label-yellow; }
|
||||
}
|
||||
|
@ -1,55 +1,63 @@
|
||||
module Docs
|
||||
class Cakephp
|
||||
class EntriesFilter < Docs::EntriesFilter
|
||||
INCLUDE_PAGE_TYPES = {
|
||||
'class' => true,
|
||||
'function' => true,
|
||||
'namespace' => false,
|
||||
}
|
||||
|
||||
def get_page_type
|
||||
page_type = slug.split('-')[0]
|
||||
def page_type
|
||||
@page_type ||= slug.split('-').first
|
||||
end
|
||||
|
||||
def include_default_entry?
|
||||
INCLUDE_PAGE_TYPES[get_page_type]
|
||||
def slug_without_page_type
|
||||
@slug_without_page_type ||= slug.split('-').last
|
||||
end
|
||||
|
||||
def get_name
|
||||
case get_page_type
|
||||
when 'class'
|
||||
slug.split('.').last
|
||||
when 'function'
|
||||
at_css('h1').content.split(' ')[1]
|
||||
case page_type
|
||||
when 'class'
|
||||
slug_without_page_type.split('.').last.concat(' (class)')
|
||||
when 'function'
|
||||
at_css('h1').content.remove('Function ')
|
||||
when 'namespace', 'package'
|
||||
slug_without_page_type.split('.').tap do |path|
|
||||
path.shift if path.length > 1
|
||||
end.join('\\').concat(" (#{page_type})")
|
||||
end
|
||||
end
|
||||
|
||||
def get_type
|
||||
case get_page_type
|
||||
when 'class'
|
||||
slug.split('.')[1..-2].join('\\')
|
||||
when 'function'
|
||||
'Global Functions'
|
||||
return 'Global' if slug == 'namespace-None'
|
||||
case page_type
|
||||
when 'class', 'namespace', 'package'
|
||||
if (node = at_css('.info')) && node.content =~ /Located at\s+((?:\w+\/?)+)/ # for 2.x docs
|
||||
path = $1.split('/')
|
||||
else
|
||||
path = slug_without_page_type.split('.')
|
||||
end
|
||||
path.shift if path.length > 1 && path[0] == 'Cake'
|
||||
path.pop if path.length > 1
|
||||
path.pop if path.last == 'Exception'
|
||||
path.join('\\')
|
||||
when 'function'
|
||||
'Global'
|
||||
end
|
||||
end
|
||||
|
||||
def additional_entries
|
||||
return [] unless page_type == 'class'
|
||||
class_name = name.remove(' (class)')
|
||||
return [] if class_name.end_with?('Exception')
|
||||
entries = []
|
||||
if get_page_type == 'class'
|
||||
css('.method-name').each do |node|
|
||||
name = get_name + '::' + node.at_css('.name').content.strip + '()'
|
||||
id = node['id']
|
||||
entries << [name, id, get_type]
|
||||
end
|
||||
css('.property-name').each do |node|
|
||||
name = get_name + '::' + node.at_css('.name').content.strip
|
||||
id = node['id']
|
||||
entries << [name, id, get_type]
|
||||
end
|
||||
|
||||
css('.method-name').each do |node|
|
||||
break if node.parent.previous_element.content =~ /\AMethods.*from/
|
||||
entries << ["#{class_name}::#{node.at_css('.name').content.strip}()", node['id']]
|
||||
end
|
||||
|
||||
css('.property-name').each do |node|
|
||||
break if node.parent.parent['class'].include?('used')
|
||||
entries << ["#{class_name}::#{node.at_css('.name').content.strip}", node['id']]
|
||||
end
|
||||
|
||||
entries
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 760 B |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.0 KiB |