Unified · Split
| @@ -2,10 +2,15 @@ module Docs · 1 unmodified line | ||
| 2 | 2 | class VueRouter |
| 3 | 3 | class CleanHtmlFilter < Filter |
| 4 | 4 | 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 | |
| 6 | 10 | |
| 7 | 11 | # 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 | |
| 9 | 14 | |
| 10 | 15 | css('.custom-block').each do |node| |
| 11 | 16 | node.name = 'blockquote' |
| @@ -14,6 +19,12 @@ module Docs · 2 unmodified lines | ||
| 14 | 19 | title.name = 'strong' unless title.nil? |
| 15 | 20 | end |
| 16 | 21 | |
| 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 | + | |
| 17 | 28 | # Remove data-v-* attributes |
| 18 | 29 | css('*').each do |node| |
| 19 | 30 | node.attributes.each_key do |attribute| |
| @@ -3,7 +3,8 @@ module Docs · 2 unmodified lines | ||
| 3 | 3 | class EntriesFilter < Docs::EntriesFilter |
| 4 | 4 | def get_name |
| 5 | 5 | name = at_css('h1').content |
| 6 | − name.sub! %r{#\s*}, '' | |
| 6 | + name.sub! %r{#\s*|\s*\u200B\s*}, '' | |
| 7 | + name.strip! | |
| 7 | 8 | name |
| 8 | 9 | end |
| 9 | 10 | |
| @@ -18,6 +19,7 @@ module Docs · 8 unmodified lines | ||
| 18 | 19 | end |
| 19 | 20 | |
| 20 | 21 | def additional_entries |
| 22 | + return [] | |
| 21 | 23 | return [] unless subpath.start_with?('api') |
| 22 | 24 | |
| 23 | 25 | entries = [ |
| @@ -29,14 +31,18 @@ module Docs · 5 unmodified lines | ||
| 29 | 31 | |
| 30 | 32 | css('h3').each do |node| |
| 31 | 33 | entry_name = node.content.strip |
| 34 | + entry_name.sub! %r{#\s*|\s*\u200B\s*}, '' | |
| 32 | 35 | |
| 33 | 36 | # Get the previous h2 title |
| 34 | 37 | 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 | |
| 40 | 46 | |
| 41 | 47 | case title |
| 42 | 48 | when 'Router Construction Options' |
| @@ -16,10 +16,15 @@ module Docs · 15 unmodified lines | ||
| 16 | 16 | ] |
| 17 | 17 | |
| 18 | 18 | options[:attribution] = <<-HTML |
| 19 | − © 2013–present Evan You<br> | |
| 19 | + © 2014-present Evan You, Eduardo San Martin Morote<br> | |
| 20 | 20 | Licensed under the MIT License. |
| 21 | 21 | HTML |
| 22 | 22 | |
| 23 | + version '5' do | |
| 24 | + self.release = '5.0.2' | |
| 25 | + self.base_url = 'https://router.vuejs.org/' | |
| 26 | + end | |
| 27 | + | |
| 23 | 28 | version '4' do |
| 24 | 29 | self.release = '4.0.12' |
| 25 | 30 | self.base_url = 'https://next.router.vuejs.org/' |