Add CakePHP Documentation

pull/344/merge
Phil Scherer 9 years ago committed by Thibaut Courouble
parent 183a616b03
commit 26bead24b4

@ -0,0 +1,6 @@
#= require views/pages/base
class app.views.CakephpPage extends app.views.BasePage
prepare: ->
@highlightCode @findAllByTag('pre'), 'php'
return

@ -33,6 +33,7 @@
'pages/apache',
'pages/bower',
'pages/c',
'pages/cakephp',
'pages/chai',
'pages/clojure',
'pages/coffeescript',

@ -33,6 +33,7 @@
'pages/apache',
'pages/bower',
'pages/c',
'pages/cakephp',
'pages/chai',
'pages/clojure',
'pages/coffeescript',

@ -0,0 +1,16 @@
._cakephp {
h2 { @extend %block-heading; }
h3 { @extend %block-label, %label-blue; }
h3 > a { float: right; }
h3 > a,
span.label,
span.php-keyword1 {
font-weight: normal;
}
.tree > dd { margin-left: 0px; }
.list { margin-left: 20px; }
}

@ -0,0 +1,59 @@
module Docs
class Cakephp
class CleanHtmlFilter < Filter
def call
if root_page?
css('.section').remove
end
css('.breadcrumbs', '.info', 'a.permalink').remove
css('h1').drop(1).each do |node|
node.name = 'h2'
end
css('.property-name').each do |node|
node.name = 'h3'
end
# Move dummy anchor to method and property name
css('.method-detail').each do |node|
node.at_css('.method-name')['id'] = node.at_css('a')['id']
end
css('.property-detail').each do |node|
node.at_css('.property-name')['id'] = node['id']
node.remove_attribute('id')
end
# Break out source link to separate element
css('.method-name', '.property-name').each do |node|
source = node.at_css('a')
source.add_previous_sibling("<span class=\"name\">#{source.content}</span>")
source.content = 'source'
end
# These are missing in upstream documentation. Not sure why.
css('.section > h2').each do |node|
if node.content == "Method Detail"
node['id'] = 'methods'
end
if node.content == 'Properties summary'
node['id'] = 'properties'
end
end
css('.method-signature').each do |node|
node.name = 'pre'
node.content = node.content.strip
end
css('span.name > code').each do |node|
node.content = node.content.strip
end
# Pages don't share a nice common base css tag.
doc.children
end
end
end
end

@ -0,0 +1,55 @@
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]
end
def include_default_entry?
INCLUDE_PAGE_TYPES[get_page_type]
end
def get_name
case get_page_type
when 'class'
slug.split('.').last
when 'function'
at_css('h1').content.split(' ')[1]
end
end
def get_type
case get_page_type
when 'class'
slug.split('.')[1..-2].join('\\')
when 'function'
'Global Functions'
end
end
def additional_entries
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
end
entries
end
end
end
end

@ -0,0 +1,26 @@
module Docs
class Cakephp < FileScraper
self.name = 'CakePHP'
self.type = 'cakephp'
self.version = '3.1'
self.dir = ''
self.base_url = "http://api.cakephp.org/#{version}/"
self.root_path = 'index.html'
self.links = {
home: 'http://cakephp.org/',
code: 'https://github.com/cakephp/cakephp'
}
html_filters.push 'cakephp/clean_html', 'cakephp/entries'
options[:container] = '#right.columns.nine'
# CakePHP docs include full source code. Ignore it.
options[:skip_patterns] = [/\Asource-/]
options[:attribution] = <<-HTML
&copy; 2005&ndash;2015 The Cake Software Foundation, Inc.<br>
Licensed under the MIT License.
HTML
end
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

@ -0,0 +1 @@
http://cakephp.org/pages/logos
Loading…
Cancel
Save