Update Yii documentation (2.0.1)

pull/142/merge
Thibaut 10 years ago
parent 56491bb8cd
commit a72778e9f4

@ -1,15 +0,0 @@
#= require views/pages/base
class app.views.YiiPage extends app.views.BasePage
@events:
click: 'onClick'
onClick: (event) ->
return unless event.target.classList.contains 'show'
$.stopEvent(event)
source = $ '.code', event.target.parentNode.parentNode
isShown = source.style.display is 'block'
source.style.display = if isShown then 'none' else 'block'
event.target.textContent = if isShown then 'show' else 'hide'

@ -1,24 +1,14 @@
._yii { ._yii {
h2 { @extend %block-heading; } h2 { @extend %block-heading; }
> h3 { @extend %block-label, %label-blue; } h3 { @extend %block-label, %label-blue; }
h4 { font-size: 1em; }
.paramNameCol { font-weight: bold; } blockquote { @extend %note; }
.signature2 { margin: .4em 0; }
.sourceCode { margin-bottom: 1em; }
.sourceCode > .code { display: none; }
.SeeAlso { .detail-header-tag, .detailHeaderTag {
> h4 { float: right;
margin-bottom: 1em; color: $textColorLight;
font-size: inherit;
}
> ul { margin-top: 0; }
} }
.summaryTable td:first-child[rowspan] { .param-type-col { white-space: nowrap; }
border-right: 1px solid $boxBorderLight;
+ td { border-left: 0; }
}
} }

@ -2,28 +2,34 @@ module Docs
class Yii class Yii
class CleanHtmlFilter < Filter class CleanHtmlFilter < Filter
def call def call
at_css('h1').content = 'Yii PHP Framework' if root_page? css('#nav', '.tool-link', '.toggle').remove
css('.api-suggest', '.google-ad', '.g-plusone', '#nav', '#comments').remove css('.hashlink[name]').each do |node|
node.parent['id'] = node['name']
node.remove
end
css('.summary > p > .toggle').each do |node| css('.detail-header').each do |node|
node.parent.remove node.name = 'h3'
node.child.remove while node.child.content.blank?
end end
css('.signature', '.signature2').each do |node| css('pre').each do |node|
node.inner_html = node.inner_html.gsub('<br>', "\n").gsub('&nbsp;', ' ')
node.content = node.content
end
css('div.signature').each do |node|
node.name = 'pre' node.name = 'pre'
node.inner_html = node.inner_html.strip node.inner_html = node.inner_html.strip
end end
css('div.detailHeader').each do |node| css('.detail-table th').each do |node|
node.name = 'h3' node.name = 'td'
end end
css('.sourceCode > .code > code').each do |node| css('.detail-table td.signature').each do |node|
parent = node.parent node.name = 'th'
parent.name = 'pre'
node.remove
parent.inner_html = node.first_element_child.inner_html.strip
end end
doc doc

@ -2,17 +2,29 @@ module Docs
class Yii class Yii
class EntriesFilter < Docs::EntriesFilter class EntriesFilter < Docs::EntriesFilter
def get_name def get_name
at_css('h1').content.strip name = at_css('h1').content.strip
name.remove! %r{\A.*?(Class|Trait|Interface)\s*}
name.remove!('yii\\')
name
end end
def get_type def get_type
css('.summaryTable td').first.content if slug.include?('guide')
'Guides'
else
components = name.split('\\')
type = components.first
type << "\\#{components.second}" if (type == 'db' && components.second.in?(%w(cubrid mssql mysql oci pgsql sqlite))) ||
(type == 'web' && components.second.in?(%w(Request Response)))
type = 'yii' if type == 'BaseYii' || type == 'Yii'
type
end
end end
def additional_entries def additional_entries
css('.detailHeader').inject [] do |entries, node| css('.detail-header').each_with_object [] do |node, entries|
name = node.child.content.strip name = node.child.content.strip
name.prepend self.name + (node.next_element.content.include?('public static') ? '::' : '->') name.prepend "#{self.name} "
entries << [name, node['id']] entries << [name, node['id']]
end end
end end

@ -1,12 +1,15 @@
module Docs module Docs
class Yii < UrlScraper class Yii < UrlScraper
self.type = 'yii' self.type = 'yii'
self.version = '1.1.14' self.version = '2.0.1'
self.base_url = 'http://www.yiiframework.com/doc/api/1.1/' self.base_url = 'http://www.yiiframework.com/doc-2.0/'
self.root_path = 'index.html'
html_filters.push 'yii/clean_html', 'yii/entries' html_filters.push 'yii/clean_html', 'yii/entries'
options[:container] = '.grid_9' options[:container] = 'div[role=main]'
options[:skip_patterns] = [/\Ayii-apidoc/]
options[:attribution] = <<-HTML options[:attribution] = <<-HTML
&copy; 2008&ndash;2014 by Yii Software LLC<br> &copy; 2008&ndash;2014 by Yii Software LLC<br>
Licensed under the three clause BSD license. Licensed under the three clause BSD license.

Loading…
Cancel
Save