[devdocsgjs/main: 805/1867] vue-router: finish scraper and filters
- From: Andy Holmes <andyholmes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [devdocsgjs/main: 805/1867] vue-router: finish scraper and filters
- Date: Fri, 19 Nov 2021 23:47:30 +0000 (UTC)
commit 1c3a9761c6028a37082c4fb3e1a8bb353382551c
Author: Jasper van Merle <jaspervmerle gmail com>
Date: Tue Aug 13 18:14:58 2019 +0200
vue-router: finish scraper and filters
.../javascripts/templates/pages/about_tmpl.coffee | 4 +--
lib/docs/filters/vue_router/clean_html.rb | 2 +-
lib/docs/filters/vue_router/entries.rb | 40 +++++++++++-----------
lib/docs/scrapers/vue_router.rb | 14 ++++----
public/icons/docs/vue_router/SOURCE | 2 +-
5 files changed, 32 insertions(+), 30 deletions(-)
---
diff --git a/assets/javascripts/templates/pages/about_tmpl.coffee
b/assets/javascripts/templates/pages/about_tmpl.coffee
index c22b737c..67fade42 100644
--- a/assets/javascripts/templates/pages/about_tmpl.coffee
+++ b/assets/javascripts/templates/pages/about_tmpl.coffee
@@ -736,9 +736,9 @@ credits = [
'https://raw.githubusercontent.com/vuejs/vue/master/LICENSE'
], [
'Vue Router',
- '2013-2018 Evan You, Vue.js contributors',
+ '2013-present Evan You',
'MIT',
- 'https://github.com/vuejs/vue-router/blob/dev/LICENSE'
+ 'https://raw.githubusercontent.com/vuejs/vue-router/dev/LICENSE'
], [
'Vulkan',
'2014-2017 Khronos Group Inc.<br>Vulkan and the Vulkan logo are registered trademarks of the Khronos
Group Inc.',
diff --git a/lib/docs/filters/vue_router/clean_html.rb b/lib/docs/filters/vue_router/clean_html.rb
index 6377b0d4..19c6e7ae 100644
--- a/lib/docs/filters/vue_router/clean_html.rb
+++ b/lib/docs/filters/vue_router/clean_html.rb
@@ -11,4 +11,4 @@ module Docs
end
end
end
-end
\ No newline at end of file
+end
diff --git a/lib/docs/filters/vue_router/entries.rb b/lib/docs/filters/vue_router/entries.rb
index e8eb2279..b38fed28 100644
--- a/lib/docs/filters/vue_router/entries.rb
+++ b/lib/docs/filters/vue_router/entries.rb
@@ -3,16 +3,13 @@ module Docs
class EntriesFilter < Docs::EntriesFilter
def get_name
name = at_css('h1').content
-
name.remove! '# '
-
name
end
def get_type
return 'Other Guides' if subpath.start_with?('guide/advanced')
return 'Basic Guides' if subpath.start_with?('guide') || subpath.start_with?('installation')
-
'API Reference'
end
@@ -21,7 +18,7 @@ module Docs
end
def additional_entries
- return [] unless subpath.start_with?('api')
+ return [] unless subpath.start_with?('api')
entries = [
['<router-link>', 'router-link', 'API Reference'],
@@ -31,7 +28,7 @@ module Docs
]
css('h3').each do |node|
- entryName = node.content.strip
+ entry_name = node.content.strip
# Get the previous h2 title
title = node
@@ -39,33 +36,36 @@ module Docs
title = title.content.strip
title.remove! '# '
- entryName.remove! '# '
+ entry_name.remove! '# '
- if title == "Router Construction Options"
- entryName = "RouterOptions.#{entryName}"
- elsif title == "<router-view> Props"
- entryName = "<router-view> `#{entryName}` prop"
- elsif title == "<router-link> Props"
- entryName = "<router-link> `#{entryName}` prop"
- elsif title == "Router Instance Methods"
- entryName = "#{entryName}()"
+ case title
+ when 'Router Construction Options'
+ entry_name = "RouterOptions.#{entry_name}"
+ when '<router-view> Props'
+ entry_name = "<router-view> `#{entry_name}` prop"
+ when '<router-link> Props'
+ entry_name = "<router-link> `#{entry_name}` prop"
+ when 'Router Instance Methods'
+ entry_name = "#{entry_name}()"
end
- unless title == "Component Injections" || node['id'] == 'applying-active-class-to-outer-element'
|| node['id'] == 'route-object-properties'
- entries << [entryName, node['id'], 'API Reference']
+ entry_name = entry_name.split(' API ')[0] if entry_name.start_with?('v-slot')
+
+ unless title == "Component Injections" || node['id'] == 'route-object-properties'
+ entries << [entry_name, node['id'], 'API Reference']
end
end
css('#route-object-properties + ul > li > p:first-child > strong').each do |node|
- entryName = node.content.strip
- id = "route-object-#{entryName.remove('$route.')}"
+ entry_name = node.content.strip
+ id = "route-object-#{entry_name.remove('$route.')}"
node['id'] = id
- entries << [entryName, node['id'], 'API Reference']
+ entries << [entry_name, node['id'], 'API Reference']
end
entries
end
end
end
-end
\ No newline at end of file
+end
diff --git a/lib/docs/scrapers/vue_router.rb b/lib/docs/scrapers/vue_router.rb
index a029466b..9f617944 100644
--- a/lib/docs/scrapers/vue_router.rb
+++ b/lib/docs/scrapers/vue_router.rb
@@ -1,9 +1,10 @@
module Docs
class VueRouter < UrlScraper
- self.slug = 'vue_router'
self.name = 'Vue Router'
+ self.slug = 'vue_router'
self.type = 'simple'
-
+ self.release = '3.1.2'
+ self.base_url = 'https://router.vuejs.org/'
self.links = {
home: 'https://router.vuejs.org',
code: 'https://github.com/vuejs/vue-router'
@@ -11,17 +12,18 @@ module Docs
html_filters.push 'vue_router/entries', 'vue_router/clean_html'
- self.release = '3.0.1'
- self.base_url = 'https://router.vuejs.org/'
-
options[:skip_patterns] = [
# Other languages
/^(zh|ja|ru|kr|fr)\//,
]
options[:attribution] = <<-HTML
- © 2013–2018 Evan You, Vue.js contributors<br>
+ © 2013–present Evan You<br>
Licensed under the MIT License.
HTML
+
+ def get_latest_version(opts)
+ get_latest_github_release('vuejs', 'vue-router', opts)
+ end
end
end
diff --git a/public/icons/docs/vue_router/SOURCE b/public/icons/docs/vue_router/SOURCE
index 97bd9e03..6999e8c5 100644
--- a/public/icons/docs/vue_router/SOURCE
+++ b/public/icons/docs/vue_router/SOURCE
@@ -1 +1 @@
-http://vuejs.org/
+https://github.com/vuejs/vuejs.org/blob/master/assets/logo.ai
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]