From 621ac0a35063ffa998a2f2eb7a111683d0de1dae Mon Sep 17 00:00:00 2001 From: Thibaut Courouble Date: Sun, 24 Jan 2016 12:06:36 -0500 Subject: [PATCH] Version Yii documentation (1.1 and 2.0) Ref #25. --- .../templates/pages/about_tmpl.coffee | 4 +-- .../clean_html.rb => yii/clean_html_v1.rb} | 4 +-- .../yii/{clean_html.rb => clean_html_v2.rb} | 2 +- .../{yii1/entries.rb => yii/entries_v1.rb} | 4 +-- .../filters/yii/{entries.rb => entries_v2.rb} | 2 +- lib/docs/scrapers/yii.rb | 30 +++++++++++++------ lib/docs/scrapers/yii1.rb | 17 ----------- 7 files changed, 29 insertions(+), 34 deletions(-) rename lib/docs/filters/{yii1/clean_html.rb => yii/clean_html_v1.rb} (94%) rename lib/docs/filters/yii/{clean_html.rb => clean_html_v2.rb} (95%) rename lib/docs/filters/{yii1/entries.rb => yii/entries_v1.rb} (88%) rename lib/docs/filters/yii/{entries.rb => entries_v2.rb} (95%) delete mode 100644 lib/docs/scrapers/yii1.rb diff --git a/assets/javascripts/templates/pages/about_tmpl.coffee b/assets/javascripts/templates/pages/about_tmpl.coffee index 9da7092f..7c93ff60 100644 --- a/assets/javascripts/templates/pages/about_tmpl.coffee +++ b/assets/javascripts/templates/pages/about_tmpl.coffee @@ -406,8 +406,8 @@ credits = [ 'https://raw.githubusercontent.com/webpack/webpack/master/LICENSE' ], [ 'Yii', - '2008-2015 by Yii Software LLC', + '2008-2016 by Yii Software LLC', 'BSD', - 'https://raw.github.com/yiisoft/yii/master/LICENSE' + 'https://raw.githubusercontent.com/yiisoft/yii/master/LICENSE' ] ] diff --git a/lib/docs/filters/yii1/clean_html.rb b/lib/docs/filters/yii/clean_html_v1.rb similarity index 94% rename from lib/docs/filters/yii1/clean_html.rb rename to lib/docs/filters/yii/clean_html_v1.rb index 035981ed..ff014269 100644 --- a/lib/docs/filters/yii1/clean_html.rb +++ b/lib/docs/filters/yii/clean_html_v1.rb @@ -1,6 +1,6 @@ module Docs - class Yii1 - class CleanHtmlFilter < Filter + class Yii + class CleanHtmlV1Filter < Filter def call at_css('h1').content = 'Yii PHP Framework' if root_page? diff --git a/lib/docs/filters/yii/clean_html.rb b/lib/docs/filters/yii/clean_html_v2.rb similarity index 95% rename from lib/docs/filters/yii/clean_html.rb rename to lib/docs/filters/yii/clean_html_v2.rb index 135e9d58..0a4b4177 100644 --- a/lib/docs/filters/yii/clean_html.rb +++ b/lib/docs/filters/yii/clean_html_v2.rb @@ -1,6 +1,6 @@ module Docs class Yii - class CleanHtmlFilter < Filter + class CleanHtmlV2Filter < Filter def call css('.hashlink[name]').each do |node| node.parent['id'] = node['name'] diff --git a/lib/docs/filters/yii1/entries.rb b/lib/docs/filters/yii/entries_v1.rb similarity index 88% rename from lib/docs/filters/yii1/entries.rb rename to lib/docs/filters/yii/entries_v1.rb index f9a779d4..5a5d8607 100644 --- a/lib/docs/filters/yii1/entries.rb +++ b/lib/docs/filters/yii/entries_v1.rb @@ -1,6 +1,6 @@ module Docs - class Yii1 - class EntriesFilter < Docs::EntriesFilter + class Yii + class EntriesV1Filter < Docs::EntriesFilter def get_name at_css('h1').content.strip end diff --git a/lib/docs/filters/yii/entries.rb b/lib/docs/filters/yii/entries_v2.rb similarity index 95% rename from lib/docs/filters/yii/entries.rb rename to lib/docs/filters/yii/entries_v2.rb index b2cfdd3e..fb160bcc 100644 --- a/lib/docs/filters/yii/entries.rb +++ b/lib/docs/filters/yii/entries_v2.rb @@ -1,6 +1,6 @@ module Docs class Yii - class EntriesFilter < Docs::EntriesFilter + class EntriesV2Filter < Docs::EntriesFilter def get_name name = at_css('h1').content.strip name.remove! %r{\A.*?(Class|Trait|Interface)\s*} diff --git a/lib/docs/scrapers/yii.rb b/lib/docs/scrapers/yii.rb index 4ff83d44..76dc20ec 100755 --- a/lib/docs/scrapers/yii.rb +++ b/lib/docs/scrapers/yii.rb @@ -1,18 +1,30 @@ module Docs class Yii < UrlScraper self.type = 'yii' - self.release = '2.0.2' - self.base_url = 'http://www.yiiframework.com/doc-2.0/' - self.root_path = 'index.html' - - html_filters.push 'yii/clean_html', 'yii/entries' - - options[:container] = 'div[role=main]' - options[:skip_patterns] = [/\Ayii-apidoc/] options[:attribution] = <<-HTML - © 2008–2015 by Yii Software LLC
+ © 2008–2016 by Yii Software LLC
Licensed under the three clause BSD license. HTML + + version '2.0' do + self.release = '2.0.6' + self.base_url = 'http://www.yiiframework.com/doc-2.0/' + self.root_path = 'index.html' + + html_filters.push 'yii/clean_html_v2', 'yii/entries_v2' + + options[:container] = 'div[role=main]' + options[:skip_patterns] = [/\Ayii-apidoc/] + end + + version '1.1' do + self.release = '1.1.17' + self.base_url = 'http://www.yiiframework.com/doc/api/1.1/' + + html_filters.push 'yii/clean_html_v1', 'yii/entries_v1' + + options[:container] = '.grid_9' + end end end diff --git a/lib/docs/scrapers/yii1.rb b/lib/docs/scrapers/yii1.rb deleted file mode 100644 index e7327527..00000000 --- a/lib/docs/scrapers/yii1.rb +++ /dev/null @@ -1,17 +0,0 @@ -module Docs - class Yii1 < UrlScraper - self.name = 'Yii 1' - self.slug = 'yii1' - self.type = 'yii' - self.release = '1.1.16' - self.base_url = 'http://www.yiiframework.com/doc/api/1.1/' - - html_filters.push 'yii1/clean_html', 'yii1/entries' - - options[:container] = '.grid_9' - options[:attribution] = <<-HTML - © 2008–2015 by Yii Software LLC
- Licensed under the three clause BSD license. - HTML - end -end