Unified · Split
| @@ -4,13 +4,16 @@ module Docs · 3 unmodified lines | |||
| 4 | def get_name | 4 | def get_name |
| 5 | name = at_css('h1').content | 5 | name = at_css('h1').content |
| 6 | 6 | ||
| 7 | unless type == 'CLI' | ||
| 8 | name.prepend "#{css('.guide-nav a').to_a.index(at_css('.guide-nav a.active')) + 1}. " | ||
| 9 | end | ||
| 10 | |||
| 7 | name | 11 | name |
| 8 | end | 12 | end |
| 9 | 13 | ||
| 10 | def get_type | 14 | def get_type |
| 11 | type = at_css('.guide-nav a').content.strip | 15 | type = at_css('.guide-nav a').content.strip |
| 12 | type.sub! 'CLI Introduction', 'CLI Commands' | 16 | type.sub 'CLI Introduction', 'CLI Commands' |
| 13 | type | ||
| 14 | end | 17 | end |
| 15 | end | 18 | end |
| 16 | end | 19 | end |
| @@ -2,24 +2,31 @@ module Docs · 1 unmodified line | |||
| 2 | class Yarn | 2 | class Yarn |
| 3 | class EntriesBerryFilter < Docs::EntriesFilter | 3 | class EntriesBerryFilter < Docs::EntriesFilter |
| 4 | def get_name | 4 | def get_name |
| 5 | if slug.start_with?('configuration') | ||
| 6 | filename = at_css('main .active code') | ||
| 7 | content = filename.content | ||
| 8 | return filename.parent.content.sub content, " (#{content})" | ||
| 9 | end | ||
| 10 | |||
| 5 | name = at_css('h1').content | 11 | name = at_css('h1').content |
| 6 | 12 | ||
| 7 | # TODO: remove when https://github.com/yarnpkg/berry/issues/3809 is resolved | 13 | if slug.start_with?('getting-started') |
| 8 | if slug.start_with?('sdks') || slug.start_with?('pnpify') | 14 | name.remove! /\d - / |
| 9 | name.prepend('yarn ') | 15 | |
| 16 | active_link = at_css('main .active') | ||
| 17 | links = active_link.parent.children.to_a | ||
| 18 | name.prepend "#{links.index(active_link) + 1}. " | ||
| 10 | end | 19 | end |
| 11 | 20 | ||
| 21 | # TODO: remove when https://github.com/yarnpkg/berry/issues/3809 is resolved | ||
| 22 | name.prepend('yarn ') if slug.start_with?('sdks', 'pnpify') | ||
| 23 | |||
| 12 | name | 24 | name |
| 13 | end | 25 | end |
| 14 | 26 | ||
| 15 | def get_type | 27 | def get_type |
| 16 | if slug.start_with?('sdks') || slug.start_with?('pnpify') | 28 | return 'CLI' if slug.start_with?('sdks', 'pnpify') |
| 17 | 'CLI' | 29 | at_css('header .active').content |
| 18 | else | ||
| 19 | type = at_css('header div:nth-child(2) .active').content.strip | ||
| 20 | type.remove! 'Home' | ||
| 21 | type | ||
| 22 | end | ||
| 23 | end | 30 | end |
| 24 | end | 31 | end |
| 25 | end | 32 | end |
| @@ -20,6 +20,7 @@ module Docs · 19 unmodified lines | |||
| 20 | code: 'https://github.com/yarnpkg/berry' | 20 | code: 'https://github.com/yarnpkg/berry' |
| 21 | } | 21 | } |
| 22 | html_filters.push 'yarn/entries_berry', 'yarn/clean_html_berry', 'title' | 22 | html_filters.push 'yarn/entries_berry', 'yarn/clean_html_berry', 'title' |
| 23 | options[:skip] = ['features', 'cli', 'configuration', 'advanced'] | ||
| 23 | options[:skip_patterns] = [/\Aapi/, /\Apackage/] | 24 | options[:skip_patterns] = [/\Aapi/, /\Apackage/] |
| 24 | end | 25 | end |
| 25 | 26 | ||