Unified · Split
| @@ -2,14 +2,17 @@ module Docs · 1 unmodified line | ||
| 2 | 2 | class Crystal |
| 3 | 3 | class CleanHtmlFilter < Filter |
| 4 | 4 | def call |
| 5 | − slug.start_with?('docs') ? book : api | |
| 5 | + slug.start_with?('reference') ? book : api | |
| 6 | 6 | doc |
| 7 | 7 | end |
| 8 | 8 | |
| 9 | 9 | def book |
| 10 | − @doc = at_css('.page-inner section') | |
| 10 | + @doc = at_css('main article') | |
| 11 | + | |
| 12 | + css('.headerlink').remove | |
| 11 | 13 | |
| 12 | 14 | css('pre > code').each do |node| |
| 15 | + node.parent['data-language'] = 'crystal' | |
| 13 | 16 | node.parent['data-language'] = node['class'][/lang-(\w+)/, 1] if node['class'] |
| 14 | 17 | node.parent.content = node.parent.content |
| 15 | 18 | end |
| @@ -2,10 +2,11 @@ module Docs · 1 unmodified line | ||
| 2 | 2 | class Crystal |
| 3 | 3 | class EntriesFilter < Docs::EntriesFilter |
| 4 | 4 | def get_name |
| 5 | − if slug.start_with?('docs/') | |
| 6 | − name = at_css('.page-inner h1').content.strip | |
| 5 | + if slug.start_with?('reference/') | |
| 6 | + name = at_css('main h1').content.strip | |
| 7 | + name.remove! '¶' | |
| 7 | 8 | |
| 8 | − if slug.start_with?('docs/syntax_and_semantics') | |
| 9 | + if slug.start_with?('reference/syntax_and_semantics') | |
| 9 | 10 | name.prepend "#{slug.split('/')[2].titleize}: " if slug.split('/').length > 3 |
| 10 | 11 | elsif slug.split('/').length > 1 |
| 11 | 12 | chapter = slug.split('/')[1].titleize.capitalize |
| @@ -23,9 +24,9 @@ module Docs · 11 unmodified lines | ||
| 23 | 24 | def get_type |
| 24 | 25 | return if root_page? |
| 25 | 26 | |
| 26 | − if slug.start_with?('docs/syntax_and_semantics') | |
| 27 | + if slug.start_with?('reference/syntax_and_semantics') | |
| 27 | 28 | 'Book: Language' |
| 28 | − elsif slug.start_with?('docs/') | |
| 29 | + elsif slug.start_with?('reference/') | |
| 29 | 30 | 'Book' |
| 30 | 31 | else |
| 31 | 32 | hierarchy = at_css('.superclass-hierarchy') |
| @@ -2,7 +2,7 @@ module Docs · 1 unmodified line | ||
| 2 | 2 | class Crystal < UrlScraper |
| 3 | 3 | self.type = 'crystal' |
| 4 | 4 | self.base_url = 'https://crystal-lang.org/' |
| 5 | − self.initial_paths = %w(docs/index.html) | |
| 5 | + self.initial_paths = %w(reference/index.html) | |
| 6 | 6 | self.links = { |
| 7 | 7 | home: 'https://crystal-lang.org/', |
| 8 | 8 | code: 'https://github.com/crystal-lang/crystal' |
| @@ -11,7 +11,7 @@ module Docs · 2 unmodified lines | ||
| 11 | 11 | html_filters.push 'crystal/entries', 'crystal/clean_html' |
| 12 | 12 | |
| 13 | 13 | options[:attribution] = ->(filter) { |
| 14 | − if filter.slug.start_with?('docs') | |
| 14 | + if filter.slug.start_with?('reference') | |
| 15 | 15 | <<-HTML |
| 16 | 16 | To the extent possible under law, the persons who contributed to this work |
| 17 | 17 | have waived<br>all copyright and related or neighboring rights to this work |
| @@ -29,12 +29,12 @@ module Docs · 11 unmodified lines | ||
| 29 | 29 | self.release = '0.36.1' |
| 30 | 30 | self.root_path = "api/#{release}/index.html" |
| 31 | 31 | |
| 32 | − options[:only_patterns] = [/\Adocs\//, /\Aapi\/#{release}\//] | |
| 32 | + options[:only_patterns] = [/\Aapi\/#{release}\//, /\Areference\//] | |
| 33 | 33 | options[:skip_patterns] = [/debug/i] |
| 34 | 34 | |
| 35 | 35 | options[:replace_paths] = { |
| 36 | 36 | "api/#{release}/" => "api/#{release}/index.html", |
| 37 | − 'docs/' => 'docs/index.html' | |
| 37 | + 'reference/' => 'reference/index.html' | |
| 38 | 38 | } |
| 39 | 39 | end |
| 40 | 40 | |