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