Skip to content

Commit 1c3a976

Browse files
committed
vue-router: finish scraper and filters
1 parent 63a8f84 commit 1c3a976

File tree

5 files changed

+32
-30
lines changed

5 files changed

+32
-30
lines changed

assets/javascripts/templates/pages/about_tmpl.coffee

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -736,9 +736,9 @@ credits = [
736736
'https://raw.githubusercontent.com/vuejs/vue/master/LICENSE'
737737
], [
738738
'Vue Router',
739-
'2013-2018 Evan You, Vue.js contributors',
739+
'2013-present Evan You',
740740
'MIT',
741-
'https://github.com/vuejs/vue-router/blob/dev/LICENSE'
741+
'https://raw.githubusercontent.com/vuejs/vue-router/dev/LICENSE'
742742
], [
743743
'Vulkan',
744744
'2014-2017 Khronos Group Inc.<br>Vulkan and the Vulkan logo are registered trademarks of the Khronos Group Inc.',

lib/docs/filters/vue_router/clean_html.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ def call
1111
end
1212
end
1313
end
14-
end
14+
end

lib/docs/filters/vue_router/entries.rb

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,13 @@ class VueRouter
33
class EntriesFilter < Docs::EntriesFilter
44
def get_name
55
name = at_css('h1').content
6-
76
name.remove! '# '
8-
97
name
108
end
119

1210
def get_type
1311
return 'Other Guides' if subpath.start_with?('guide/advanced')
1412
return 'Basic Guides' if subpath.start_with?('guide') || subpath.start_with?('installation')
15-
1613
'API Reference'
1714
end
1815

@@ -21,7 +18,7 @@ def include_default_entry?
2118
end
2219

2320
def additional_entries
24-
return [] unless subpath.start_with?('api')
21+
return [] unless subpath.start_with?('api')
2522

2623
entries = [
2724
['<router-link>', 'router-link', 'API Reference'],
@@ -31,41 +28,44 @@ def additional_entries
3128
]
3229

3330
css('h3').each do |node|
34-
entryName = node.content.strip
31+
entry_name = node.content.strip
3532

3633
# Get the previous h2 title
3734
title = node
3835
title = title.previous_element until title.name == 'h2'
3936
title = title.content.strip
4037
title.remove! '# '
4138

42-
entryName.remove! '# '
39+
entry_name.remove! '# '
4340

44-
if title == "Router Construction Options"
45-
entryName = "RouterOptions.#{entryName}"
46-
elsif title == "<router-view> Props"
47-
entryName = "<router-view> `#{entryName}` prop"
48-
elsif title == "<router-link> Props"
49-
entryName = "<router-link> `#{entryName}` prop"
50-
elsif title == "Router Instance Methods"
51-
entryName = "#{entryName}()"
41+
case title
42+
when 'Router Construction Options'
43+
entry_name = "RouterOptions.#{entry_name}"
44+
when '<router-view> Props'
45+
entry_name = "<router-view> `#{entry_name}` prop"
46+
when '<router-link> Props'
47+
entry_name = "<router-link> `#{entry_name}` prop"
48+
when 'Router Instance Methods'
49+
entry_name = "#{entry_name}()"
5250
end
5351

54-
unless title == "Component Injections" || node['id'] == 'applying-active-class-to-outer-element' || node['id'] == 'route-object-properties'
55-
entries << [entryName, node['id'], 'API Reference']
52+
entry_name = entry_name.split(' API ')[0] if entry_name.start_with?('v-slot')
53+
54+
unless title == "Component Injections" || node['id'] == 'route-object-properties'
55+
entries << [entry_name, node['id'], 'API Reference']
5656
end
5757
end
5858

5959
css('#route-object-properties + ul > li > p:first-child > strong').each do |node|
60-
entryName = node.content.strip
61-
id = "route-object-#{entryName.remove('$route.')}"
60+
entry_name = node.content.strip
61+
id = "route-object-#{entry_name.remove('$route.')}"
6262

6363
node['id'] = id
64-
entries << [entryName, node['id'], 'API Reference']
64+
entries << [entry_name, node['id'], 'API Reference']
6565
end
6666

6767
entries
6868
end
6969
end
7070
end
71-
end
71+
end

lib/docs/scrapers/vue_router.rb

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,29 @@
11
module Docs
22
class VueRouter < UrlScraper
3-
self.slug = 'vue_router'
43
self.name = 'Vue Router'
4+
self.slug = 'vue_router'
55
self.type = 'simple'
6-
6+
self.release = '3.1.2'
7+
self.base_url = 'https://router.vuejs.org/'
78
self.links = {
89
home: 'https://router.vuejs.org',
910
code: 'https://github.com/vuejs/vue-router'
1011
}
1112

1213
html_filters.push 'vue_router/entries', 'vue_router/clean_html'
1314

14-
self.release = '3.0.1'
15-
self.base_url = 'https://router.vuejs.org/'
16-
1715
options[:skip_patterns] = [
1816
# Other languages
1917
/^(zh|ja|ru|kr|fr)\//,
2018
]
2119

2220
options[:attribution] = <<-HTML
23-
&copy; 2013&ndash;2018 Evan You, Vue.js contributors<br>
21+
&copy; 2013&ndash;present Evan You<br>
2422
Licensed under the MIT License.
2523
HTML
24+
25+
def get_latest_version(opts)
26+
get_latest_github_release('vuejs', 'vue-router', opts)
27+
end
2628
end
2729
end

public/icons/docs/vue_router/SOURCE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
http://vuejs.org/
1+
https://github.com/vuejs/vuejs.org/blob/master/assets/logo.ai

0 commit comments

Comments
 (0)