diff --git a/assets/javascripts/templates/pages/about_tmpl.coffee b/assets/javascripts/templates/pages/about_tmpl.coffee index fef9a024..56dfadd1 100644 --- a/assets/javascripts/templates/pages/about_tmpl.coffee +++ b/assets/javascripts/templates/pages/about_tmpl.coffee @@ -680,6 +680,11 @@ credits = [ '2013-2018 Evan You, Vue.js contributors', 'MIT', 'https://raw.githubusercontent.com/vuejs/vue/master/LICENSE' + ], [ + 'Vue Router', + '2013-2018 Evan You, Vue.js contributors', + 'MIT', + 'https://github.com/vuejs/vue-router/blob/dev/LICENSE' ], [ 'Vulkan', '2014-2017 Khronos Group Inc.
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 new file mode 100644 index 00000000..6377b0d4 --- /dev/null +++ b/lib/docs/filters/vue_router/clean_html.rb @@ -0,0 +1,14 @@ +module Docs + class VueRouter + class CleanHtmlFilter < Filter + def call + @doc = at_css('.content') + + # Remove unneeded elements + css('.bit-sponsor, .header-anchor').remove + + doc + end + end + end +end \ No newline at end of file diff --git a/lib/docs/filters/vue_router/entries.rb b/lib/docs/filters/vue_router/entries.rb new file mode 100644 index 00000000..c00c99f2 --- /dev/null +++ b/lib/docs/filters/vue_router/entries.rb @@ -0,0 +1,73 @@ +module Docs + class VueRouter + 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 + + def include_default_entry? + name != 'API Reference' + end + + def additional_entries + return [] unless subpath.start_with?('api') + + entries = [ + ['', 'router-link', 'API Reference'], + ['', 'router-view', 'API Reference'], + ['$route', 'the-route-object', 'API Reference'], + ['Component Injections', 'component-injections', 'API Reference'] + ] + + css('h3').each do |node| + entryName = node.content.strip + + # Get the previous h2 title + title = node + title = title.previous_element until title.name == 'h2' + title = title.content.strip + title.remove! '# ' + + entryName.remove! '# ' + + unless entryName.start_with?('router.') + if title == "Router Construction Options" + entryName = "RouterOptions.#{entryName}" + elsif title == " Props" + entryName = " `#{entryName}` prop" + elsif title == " Props" + entryName = " `#{entryName}` prop" + else + entryName = "> #{entryName} (in: #{title})" + end + end + + unless title == "Component Injections" || node['id'] == 'applying-active-class-to-outer-element' || node['id'] == 'route-object-properties' + entries << [entryName, 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.')}" + + node['id'] = id + entries << [entryName, node['id'], 'API Reference'] + end + + entries + end + end + end +end \ No newline at end of file diff --git a/lib/docs/scrapers/vue_router.rb b/lib/docs/scrapers/vue_router.rb new file mode 100644 index 00000000..e19efa11 --- /dev/null +++ b/lib/docs/scrapers/vue_router.rb @@ -0,0 +1,27 @@ +module Docs + class VueRouter < UrlScraper + self.slug = 'vue_router' + self.name = 'Vue Router' + self.type = 'simple' + + self.links = { + home: 'https://router.vuejs.org', + code: 'https://github.com/vuejs/vue-router' + } + + 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)\//, + ] + + options[:attribution] = <<-HTML + © 2013–2018 Evan You, Vue.js contributors
+ Licensed under the MIT License. + HTML + end +end diff --git a/public/icons/docs/vue_router/16.png b/public/icons/docs/vue_router/16.png new file mode 100644 index 00000000..64eb9b34 Binary files /dev/null and b/public/icons/docs/vue_router/16.png differ diff --git a/public/icons/docs/vue_router/16@2x.png b/public/icons/docs/vue_router/16@2x.png new file mode 100644 index 00000000..2a158087 Binary files /dev/null and b/public/icons/docs/vue_router/16@2x.png differ diff --git a/public/icons/docs/vue_router/SOURCE b/public/icons/docs/vue_router/SOURCE new file mode 100644 index 00000000..474e2fca --- /dev/null +++ b/public/icons/docs/vue_router/SOURCE @@ -0,0 +1,2 @@ +http://vuejs.org/ +(Edited from the original logo to distinguish Vue Router from Vue)