浏览代码

vue: update scraper and filters for 2.6.10

Jasper van Merle 6 年之前
父节点
当前提交
751bf6e7d5

+ 2 - 2
assets/javascripts/templates/pages/about_tmpl.coffee

@@ -720,9 +720,9 @@ credits = [
     'https://raw.githubusercontent.com/mitchellh/vagrant/master/website/LICENSE.md'
   ], [
     'Vue.js',
-    '2013-2019 Evan You, Vue.js contributors',
+    '2013-present Yuxi Evan You',
     'MIT',
-    'https://raw.githubusercontent.com/vuejs/vue/master/LICENSE'
+    'https://raw.githubusercontent.com/vuejs/vuejs.org/master/LICENSE'
   ], [
     'Vulkan',
     '2014-2017 Khronos Group Inc.<br>Vulkan and the Vulkan logo are registered trademarks of the Khronos Group Inc.',

+ 9 - 0
lib/docs/filters/vue/clean_html.rb

@@ -16,10 +16,19 @@ module Docs
           node['data-language'] = node['class'][/highlight (\w+)/, 1]
         end
 
+        css('pre').each do |node|
+          node.content = node.content.strip
+          node['data-language'] = 'javascript'
+        end
+
         css('iframe').each do |node|
           node['sandbox'] = 'allow-forms allow-scripts allow-same-origin'
         end
 
+        css('details').each do |node|
+          node.name = 'div'
+        end
+
         doc
       end
     end

+ 13 - 1
lib/docs/filters/vue/entries.rb

@@ -4,6 +4,8 @@ module Docs
       def get_name
         if slug == 'api/'
           'API'
+        elsif slug == 'style-guide/'
+          'Style Guide'
         else
           name = at_css('.content h1').content
           node = at_css(".sidebar .menu-root a[href='#{File.basename(slug)}']")
@@ -16,6 +18,8 @@ module Docs
       def get_type
         if slug.start_with?('guide')
           'Guide'
+        elsif slug == 'style-guide/'
+          'Style Guide'
         else
           'API'
         end
@@ -31,7 +35,15 @@ module Docs
           else
             name = node.content.strip
             name.sub! %r{\(.*\)}, '()'
-            entries << [name, node['id'], "API: #{type}"]
+            name.sub! /(essential|strongly recommended|recommended|use with caution)\Z/, ''
+
+            current_type = "API: #{type}"
+            if slug == 'style-guide/'
+              current_type = "Style Guide: "
+              current_type += type.sub(/( Rules: )/, ': ').split('(')[0]
+            end
+
+            entries << [name, node['id'], current_type]
           end
         end
       end

+ 1 - 1
lib/docs/scrapers/vue.rb

@@ -15,7 +15,7 @@ module Docs
     options[:replace_paths] = { 'guide/' => 'guide/index.html' }
 
     options[:attribution] = <<-HTML
-      &copy; 2013&ndash;2019 Evan You, Vue.js contributors<br>
+      &copy; 2013&ndash;present Yuxi Evan You<br>
       Licensed under the MIT License.
     HTML