History

Update Vue Router documentation (5.0.2)

Simon Legner committed 9 months ago

Commit 54b0fc41 parent 43d05243 files · +31 −9Browse files

Unified · Split

3 files
  1. lib/docs/filters/vue_router/clean_html.rb +13 −2
  2. lib/docs/filters/vue_router/entries.rb +12 −6
  3. lib/docs/scrapers/vue_router.rb +6 −1
lib/docs/filters/vue_router/clean_html.rb+13−2
@@ -2,10 +2,15 @@ module Docs · 1 unmodified line
22 class VueRouter
33 class CleanHtmlFilter < Filter
44 def call
5− @doc = at_css('main')
5+ @doc = at_css('main > div:only-child > div:only-child', 'main', '.main')
6+ css('p + h1').each do |node|
7+ # breadcrumbs
8+ node.previous_element.remove
9+ end
610
711 # Remove unneeded elements
8− css('.bit-sponsor, .header-anchor').remove
12+ css('.bit-sponsor, .header-anchor', '.rulekit', 'div[hidden]', '.sponsors_outer').remove
13+ css('.vp-code-group > .tabs').remove
914
1015 css('.custom-block').each do |node|
1116 node.name = 'blockquote'
@@ -14,6 +19,12 @@ module Docs · 2 unmodified lines
1419 title.name = 'strong' unless title.nil?
1520 end
1621
22+ css('span.lang').remove
23+ css('pre > code:first-child').each do |node|
24+ node.parent['data-language'] = 'js'
25+ node.parent.content = node.css('.line').map(&:content).join("\n")
26+ end
27+
1728 # Remove data-v-* attributes
1829 css('*').each do |node|
1930 node.attributes.each_key do |attribute|
lib/docs/filters/vue_router/entries.rb+12−6
@@ -3,7 +3,8 @@ module Docs · 2 unmodified lines
33 class EntriesFilter < Docs::EntriesFilter
44 def get_name
55 name = at_css('h1').content
6− name.sub! %r{#\s*}, ''
6+ name.sub! %r{#\s*|\s*\u200B\s*}, ''
7+ name.strip!
78 name
89 end
910
@@ -18,6 +19,7 @@ module Docs · 8 unmodified lines
1819 end
1920
2021 def additional_entries
22+ return []
2123 return [] unless subpath.start_with?('api')
2224
2325 entries = [
@@ -29,14 +31,18 @@ module Docs · 5 unmodified lines
2931
3032 css('h3').each do |node|
3133 entry_name = node.content.strip
34+ entry_name.sub! %r{#\s*|\s*\u200B\s*}, ''
3235
3336 # Get the previous h2 title
3437 title = node
35− title = title.previous_element until title.name == 'h2'
36− title = title.content.strip
37− title.sub! %r{#\s*}, ''
38−
39− entry_name.sub! %r{#\s*}, ''
38+ begin
39+ title = title.previous_element until title.name == 'h2'
40+ title = title.content.strip
41+ title.sub! %r{#\s*}, ''
42+ rescue
43+ title = ''
44+ entry_name = "#{name}.#{entry_name}"
45+ end
4046
4147 case title
4248 when 'Router Construction Options'
lib/docs/scrapers/vue_router.rb+6−1
@@ -16,10 +16,15 @@ module Docs · 15 unmodified lines
1616 ]
1717
1818 options[:attribution] = <<-HTML
19− &copy; 2013&ndash;present Evan You<br>
19+ &copy; 2014-present Evan You, Eduardo San Martin Morote<br>
2020 Licensed under the MIT License.
2121 HTML
2222
23+ version '5' do
24+ self.release = '5.0.2'
25+ self.base_url = 'https://router.vuejs.org/'
26+ end
27+
2328 version '4' do
2429 self.release = '4.0.12'
2530 self.base_url = 'https://next.router.vuejs.org/'

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t