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