Explorar el Código

Update Vue.js documentation (2.3.2)

Closes #612.
Thibaut Courouble hace 8 años
padre
commit
0e8ab3c5c5
Se han modificado 2 ficheros con 9 adiciones y 4 borrados
  1. 6 2
      lib/docs/filters/vue/entries.rb
  2. 3 2
      lib/docs/scrapers/vue.rb

+ 6 - 2
lib/docs/filters/vue/entries.rb

@@ -5,7 +5,11 @@ module Docs
         if slug == 'api/'
           'API'
         else
-          at_css('h1').content
+          name = at_css('.content h1').content
+          node = at_css(".sidebar .menu-root a[href='#{File.basename(slug)}']")
+          index = node.parent.parent.css('> li > a').to_a.index(node)
+          name.prepend "#{index + 1}. " if index
+          name
         end
       end
 
@@ -21,7 +25,7 @@ module Docs
         return [] if slug.start_with?('guide')
         type = nil
 
-        css('h2, h3').each_with_object [] do |node, entries|
+        css('.content h2, .content h3').each_with_object [] do |node, entries|
           if node.name == 'h2'
             type = node.content.strip
           else

+ 3 - 2
lib/docs/scrapers/vue.rb

@@ -8,9 +8,10 @@ module Docs
       code: 'https://github.com/vuejs/vue'
     }
 
-    html_filters.push 'vue/clean_html', 'vue/entries'
+    html_filters.push 'vue/entries', 'vue/clean_html'
 
     options[:only_patterns] = [/guide\//, /api\//]
+    options[:replace_paths] = { 'guide/' => 'guide/index.html' }
 
     options[:attribution] = <<-HTML
       &copy; 2013&ndash;2017 Evan You, Vue.js contributors<br>
@@ -18,7 +19,7 @@ module Docs
     HTML
 
     version '2' do
-      self.release = '2.2.6'
+      self.release = '2.3.2'
       self.base_url = 'https://vuejs.org/v2/'
       self.root_path = 'guide/index.html'
       self.initial_paths = %w(api/)