浏览代码

Finish Bottle scraper

Thibaut Courouble 9 年之前
父节点
当前提交
380afc40cd

二进制
assets/images/docs.png


二进制
assets/images/docs@2x.png


+ 3 - 0
assets/javascripts/news.json

@@ -1,5 +1,8 @@
 [
   [
+    "2016-09-05",
+    "New documentation: <a href=\"/bottle/\">Bottle</a>"
+  ], [
     "2016-08-07",
     "New documentation: <a href=\"/docker/\">Docker</a>"
   ], [

+ 5 - 0
assets/javascripts/templates/pages/about_tmpl.coffee

@@ -109,6 +109,11 @@ credits = [
     '2011-2016 Twitter, Inc.',
     'CC BY',
     'https://creativecommons.org/licenses/by/3.0/'
+  ], [
+    'Bottle',
+    '2016 Marcel Hellkamp',
+    'MIT',
+    'https://raw.githubusercontent.com/bottlepy/bottle/master/LICENSE'
   ], [
     'Bower',
     '2016 Bower contributors',

+ 1 - 0
assets/stylesheets/global/_icons.scss

@@ -116,6 +116,7 @@
 ._icon-socketio:before      { background-position: -2rem -6rem; }
 ._icon-modernizr:before     { background-position: -3rem -6rem; }
 ._icon-bower:before         { background-position: -4rem -6rem; }
+._icon-bottle:before        { background-position: 0 -7rem; }
 ._icon-docker:before        { background-position: -1rem -7rem; }
 ._icon-cakephp:before       { background-position: -2rem -7rem; }
 ._icon-lua:before           { background-position: -3rem -7rem; @extend %darkIconFix !optional; }

+ 10 - 17
lib/docs/filters/bottle/entries.rb

@@ -1,16 +1,6 @@
 module Docs
   class Bottle
     class EntriesFilter < Docs::EntriesFilter
-      TYPES = {
-        'routing' => 'Request Routing',
-        'stpl' => 'SimpleTemplate Engine',
-        'api'  => 'API Reference',
-
-        'tutorial_app' => 'Tutorial',
-        'async' => 'Primer to Asynchronous Applications',
-        'faq' => 'Frequently Asked Questions'
-      }
-
       def get_name
         name = at_css('h1').content.strip
         name.remove! "\u{00B6}"
@@ -18,15 +8,18 @@ module Docs
       end
 
       def get_type
-        type = slug.split('/').first
-
-        if TYPES.key?(type)
-          type = TYPES[type]
+        case slug
+        when 'api'
+          'Reference'
+        when 'configuration'
+          'Reference: Configuration'
+        when 'stpl'
+          'Reference: SimpleTemplate'
+        when 'plugindev'
+          'Reference: Plugin'
         else
-          type = type.capitalize
+          'Manual'
         end
-
-        type
       end
 
       def additional_entries

+ 7 - 13
lib/docs/scrapers/bottle.rb

@@ -1,8 +1,7 @@
 module Docs
-  class Bottle < FileScraper
+  class Bottle < UrlScraper
     self.type = 'sphinx'
-    self.dir = ""
-    self.root_path = "index.html"
+    self.root_path = 'index.html'
     self.links = {
       home: 'https://bottle.org/',
       code: 'https://github.com/bottlepy/bottle'
@@ -12,24 +11,19 @@ module Docs
 
     options[:container] = '.body'
 
-    options[:skip] = %w(
-      changelog.html
-      development.html
-      plugindev.html
-      _modules/bottle.html
-    )
+    options[:skip] = %w(changelog.html development.html _modules/bottle.html)
 
     options[:attribution] = <<-HTML
-      &copy; 2009&ndash;2016, Marcel Hellkamp<br>
-      Licensed under the MIT License.<br>
+      &copy; 2016 Marcel Hellkamp<br>
+      Licensed under the MIT License.
     HTML
 
-    version '0.12' do # http://bottlepy.org/docs/0.12/bottle-docs.zip
+    version '0.12' do
       self.release = '0.12'
       self.base_url = "http://bottlepy.org/docs/#{self.version}/"
     end
 
-    version '0.11' do # http://bottlepy.org/docs/0.11/bottle-docs.zip
+    version '0.11' do
       self.release = '0.11'
       self.base_url = "http://bottlepy.org/docs/#{self.version}/"
     end

二进制
public/icons/docs/bottle/16.png


二进制
public/icons/docs/bottle/16@2x.png


+ 2 - 0
public/icons/docs/bottle/SOURCE

@@ -0,0 +1,2 @@
+https://raw.githubusercontent.com/bottlepy/bottlepy.org/master/sphinx/static/logo_icon.png
+https://github.com/bottlepy/bottle/issues/886