Unified · Split
| @@ -0,0 +1,6 @@ | ||
| 1 | +#= require views/pages/base | |
| 2 | + | |
| 3 | +class app.views.CakephpPage extends app.views.BasePage | |
| 4 | + prepare: -> | |
| 5 | + @highlightCode @findAllByTag('pre'), 'php' | |
| 6 | + return | |
| @@ -33,6 +33,7 @@ · 32 unmodified lines | ||
| 33 | 33 | 'pages/apache', |
| 34 | 34 | 'pages/bower', |
| 35 | 35 | 'pages/c', |
| 36 | + 'pages/cakephp', | |
| 36 | 37 | 'pages/chai', |
| 37 | 38 | 'pages/clojure', |
| 38 | 39 | 'pages/coffeescript', |
| @@ -33,6 +33,7 @@ · 32 unmodified lines | ||
| 33 | 33 | 'pages/apache', |
| 34 | 34 | 'pages/bower', |
| 35 | 35 | 'pages/c', |
| 36 | + 'pages/cakephp', | |
| 36 | 37 | 'pages/chai', |
| 37 | 38 | 'pages/clojure', |
| 38 | 39 | 'pages/coffeescript', |
| @@ -0,0 +1,16 @@ | ||
| 1 | +._cakephp { | |
| 2 | + h2 { @extend %block-heading; } | |
| 3 | + | |
| 4 | + h3 { @extend %block-label, %label-blue; } | |
| 5 | + | |
| 6 | + h3 > a { float: right; } | |
| 7 | + | |
| 8 | + h3 > a, | |
| 9 | + span.label, | |
| 10 | + span.php-keyword1 { | |
| 11 | + font-weight: normal; | |
| 12 | + } | |
| 13 | + | |
| 14 | + .tree > dd { margin-left: 0px; } | |
| 15 | + .list { margin-left: 20px; } | |
| 16 | +} | |
| @@ -0,0 +1,59 @@ | ||
| 1 | +module Docs | |
| 2 | + class Cakephp | |
| 3 | + class CleanHtmlFilter < Filter | |
| 4 | + def call | |
| 5 | + if root_page? | |
| 6 | + css('.section').remove | |
| 7 | + end | |
| 8 | + | |
| 9 | + css('.breadcrumbs', '.info', 'a.permalink').remove | |
| 10 | + | |
| 11 | + css('h1').drop(1).each do |node| | |
| 12 | + node.name = 'h2' | |
| 13 | + end | |
| 14 | + | |
| 15 | + css('.property-name').each do |node| | |
| 16 | + node.name = 'h3' | |
| 17 | + end | |
| 18 | + | |
| 19 | + # Move dummy anchor to method and property name | |
| 20 | + css('.method-detail').each do |node| | |
| 21 | + node.at_css('.method-name')['id'] = node.at_css('a')['id'] | |
| 22 | + end | |
| 23 | + css('.property-detail').each do |node| | |
| 24 | + node.at_css('.property-name')['id'] = node['id'] | |
| 25 | + node.remove_attribute('id') | |
| 26 | + end | |
| 27 | + | |
| 28 | + # Break out source link to separate element | |
| 29 | + css('.method-name', '.property-name').each do |node| | |
| 30 | + source = node.at_css('a') | |
| 31 | + source.add_previous_sibling("<span class=\"name\">#{source.content}</span>") | |
| 32 | + source.content = 'source' | |
| 33 | + end | |
| 34 | + | |
| 35 | + # These are missing in upstream documentation. Not sure why. | |
| 36 | + css('.section > h2').each do |node| | |
| 37 | + if node.content == "Method Detail" | |
| 38 | + node['id'] = 'methods' | |
| 39 | + end | |
| 40 | + if node.content == 'Properties summary' | |
| 41 | + node['id'] = 'properties' | |
| 42 | + end | |
| 43 | + end | |
| 44 | + | |
| 45 | + css('.method-signature').each do |node| | |
| 46 | + node.name = 'pre' | |
| 47 | + node.content = node.content.strip | |
| 48 | + end | |
| 49 | + | |
| 50 | + css('span.name > code').each do |node| | |
| 51 | + node.content = node.content.strip | |
| 52 | + end | |
| 53 | + | |
| 54 | + # Pages don't share a nice common base css tag. | |
| 55 | + doc.children | |
| 56 | + end | |
| 57 | + end | |
| 58 | + end | |
| 59 | +end | |
| @@ -0,0 +1,55 @@ | ||
| 1 | +module Docs | |
| 2 | + class Cakephp | |
| 3 | + class EntriesFilter < Docs::EntriesFilter | |
| 4 | + INCLUDE_PAGE_TYPES = { | |
| 5 | + 'class' => true, | |
| 6 | + 'function' => true, | |
| 7 | + 'namespace' => false, | |
| 8 | + } | |
| 9 | + | |
| 10 | + def get_page_type | |
| 11 | + page_type = slug.split('-')[0] | |
| 12 | + end | |
| 13 | + | |
| 14 | + def include_default_entry? | |
| 15 | + INCLUDE_PAGE_TYPES[get_page_type] | |
| 16 | + end | |
| 17 | + | |
| 18 | + def get_name | |
| 19 | + case get_page_type | |
| 20 | + when 'class' | |
| 21 | + slug.split('.').last | |
| 22 | + when 'function' | |
| 23 | + at_css('h1').content.split(' ')[1] | |
| 24 | + end | |
| 25 | + end | |
| 26 | + | |
| 27 | + def get_type | |
| 28 | + case get_page_type | |
| 29 | + when 'class' | |
| 30 | + slug.split('.')[1..-2].join('\\') | |
| 31 | + when 'function' | |
| 32 | + 'Global Functions' | |
| 33 | + end | |
| 34 | + end | |
| 35 | + | |
| 36 | + def additional_entries | |
| 37 | + entries = [] | |
| 38 | + if get_page_type == 'class' | |
| 39 | + css('.method-name').each do |node| | |
| 40 | + name = get_name + '::' + node.at_css('.name').content.strip + '()' | |
| 41 | + id = node['id'] | |
| 42 | + entries << [name, id, get_type] | |
| 43 | + end | |
| 44 | + css('.property-name').each do |node| | |
| 45 | + name = get_name + '::' + node.at_css('.name').content.strip | |
| 46 | + id = node['id'] | |
| 47 | + entries << [name, id, get_type] | |
| 48 | + end | |
| 49 | + end | |
| 50 | + entries | |
| 51 | + end | |
| 52 | + | |
| 53 | + end | |
| 54 | + end | |
| 55 | +end | |
| @@ -0,0 +1,26 @@ | ||
| 1 | +module Docs | |
| 2 | + class Cakephp < FileScraper | |
| 3 | + self.name = 'CakePHP' | |
| 4 | + self.type = 'cakephp' | |
| 5 | + self.version = '3.1' | |
| 6 | + self.dir = '' | |
| 7 | + self.base_url = "http://api.cakephp.org/#{version}/" | |
| 8 | + self.root_path = 'index.html' | |
| 9 | + self.links = { | |
| 10 | + home: 'http://cakephp.org/', | |
| 11 | + code: 'https://github.com/cakephp/cakephp' | |
| 12 | + } | |
| 13 | + | |
| 14 | + html_filters.push 'cakephp/clean_html', 'cakephp/entries' | |
| 15 | + | |
| 16 | + options[:container] = '#right.columns.nine' | |
| 17 | + | |
| 18 | + # CakePHP docs include full source code. Ignore it. | |
| 19 | + options[:skip_patterns] = [/\Asource-/] | |
| 20 | + | |
| 21 | + options[:attribution] = <<-HTML | |
| 22 | + © 2005–2015 The Cake Software Foundation, Inc.<br> | |
| 23 | + Licensed under the MIT License. | |
| 24 | + HTML | |
| 25 | + end | |
| 26 | +end | |
Binary file not shown.
Binary file not shown.
| @@ -0,0 +1 @@ | ||
| 1 | +http://cakephp.org/pages/logos | |