Merge pull request #1477 from baelter/crystal0.36.1

Update crystal to 0.36.1
pull/1485/head
Simon Legner 4 years ago committed by GitHub
commit 38e07247a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -2,14 +2,17 @@ module Docs
class Crystal class Crystal
class CleanHtmlFilter < Filter class CleanHtmlFilter < Filter
def call def call
slug.start_with?('docs') ? book : api slug.start_with?('reference') ? book : api
doc doc
end end
def book def book
@doc = at_css('.page-inner section') @doc = at_css('main article')
css('.headerlink').remove
css('pre > code').each do |node| css('pre > code').each do |node|
node.parent['data-language'] = 'crystal'
node.parent['data-language'] = node['class'][/lang-(\w+)/, 1] if node['class'] node.parent['data-language'] = node['class'][/lang-(\w+)/, 1] if node['class']
node.parent.content = node.parent.content node.parent.content = node.parent.content
end end

@ -2,10 +2,11 @@ module Docs
class Crystal class Crystal
class EntriesFilter < Docs::EntriesFilter class EntriesFilter < Docs::EntriesFilter
def get_name def get_name
if slug.start_with?('docs/') if slug.start_with?('reference/')
name = at_css('.page-inner h1').content.strip name = at_css('main h1').content.strip
name.remove! '¶'
if slug.start_with?('docs/syntax_and_semantics') if slug.start_with?('reference/syntax_and_semantics')
name.prepend "#{slug.split('/')[2].titleize}: " if slug.split('/').length > 3 name.prepend "#{slug.split('/')[2].titleize}: " if slug.split('/').length > 3
elsif slug.split('/').length > 1 elsif slug.split('/').length > 1
chapter = slug.split('/')[1].titleize.capitalize chapter = slug.split('/')[1].titleize.capitalize
@ -23,9 +24,9 @@ module Docs
def get_type def get_type
return if root_page? return if root_page?
if slug.start_with?('docs/syntax_and_semantics') if slug.start_with?('reference/syntax_and_semantics')
'Book: Language' 'Book: Language'
elsif slug.start_with?('docs/') elsif slug.start_with?('reference/')
'Book' 'Book'
else else
hierarchy = at_css('.superclass-hierarchy') hierarchy = at_css('.superclass-hierarchy')

@ -2,7 +2,7 @@ module Docs
class Crystal < UrlScraper class Crystal < UrlScraper
self.type = 'crystal' self.type = 'crystal'
self.base_url = 'https://crystal-lang.org/' self.base_url = 'https://crystal-lang.org/'
self.initial_paths = %w(docs/index.html) self.initial_paths = %w(reference/index.html)
self.links = { self.links = {
home: 'https://crystal-lang.org/', home: 'https://crystal-lang.org/',
code: 'https://github.com/crystal-lang/crystal' code: 'https://github.com/crystal-lang/crystal'
@ -11,7 +11,7 @@ module Docs
html_filters.push 'crystal/entries', 'crystal/clean_html' html_filters.push 'crystal/entries', 'crystal/clean_html'
options[:attribution] = ->(filter) { options[:attribution] = ->(filter) {
if filter.slug.start_with?('docs') if filter.slug.start_with?('reference')
<<-HTML <<-HTML
To the extent possible under law, the persons who contributed to this work To the extent possible under law, the persons who contributed to this work
have waived<br>all copyright and related or neighboring rights to this work have waived<br>all copyright and related or neighboring rights to this work
@ -26,15 +26,15 @@ module Docs
} }
version do version do
self.release = '0.35.1' self.release = '0.36.1'
self.root_path = "api/#{release}/index.html" self.root_path = "api/#{release}/index.html"
options[:only_patterns] = [/\Adocs\//, /\Aapi\/#{release}\//] options[:only_patterns] = [/\Aapi\/#{release}\//, /\Areference\//]
options[:skip_patterns] = [/debug/i] options[:skip_patterns] = [/debug/i]
options[:replace_paths] = { options[:replace_paths] = {
"api/#{release}/" => "api/#{release}/index.html", "api/#{release}/" => "api/#{release}/index.html",
'docs/' => 'docs/index.html' 'reference/' => 'reference/index.html'
} }
end end

Loading…
Cancel
Save