mirror of https://github.com/freeCodeCamp/devdocs
parent
20b1c02a3a
commit
060052beb7
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 47 KiB After Width: | Height: | Size: 48 KiB |
@ -0,0 +1,8 @@
|
||||
._sami {
|
||||
h2 { @extend %block-heading; }
|
||||
h3 { @extend %block-label, %label-blue; }
|
||||
h4 { font-size: 1em; }
|
||||
|
||||
blockquote { @extend %note; }
|
||||
p > code { @extend %label; }
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
module Docs
|
||||
class Laravel
|
||||
class CleanHtmlFilter < Filter
|
||||
def call
|
||||
if subpath.start_with?('/api')
|
||||
api
|
||||
else
|
||||
other
|
||||
end
|
||||
|
||||
doc
|
||||
end
|
||||
|
||||
def api
|
||||
css('#footer', '.location').remove
|
||||
|
||||
# Replace .header with <h1>
|
||||
css('.header > h1').each do |node|
|
||||
node.parent.before(node).remove
|
||||
node.content = 'Laravel' if root_page?
|
||||
end
|
||||
|
||||
# Remove <abbr>
|
||||
css('a > abbr').each do |node|
|
||||
node.parent['title'] = node['title']
|
||||
node.before(node.children).remove
|
||||
end
|
||||
|
||||
# Clean up headings
|
||||
css('h1 > a', '.content', 'h3 > code', 'h3 strong', 'abbr').each do |node|
|
||||
node.before(node.children).remove
|
||||
end
|
||||
|
||||
# Remove empty <td>
|
||||
css('td').each do |node|
|
||||
node.remove if node.content =~ /\A\s+\z/
|
||||
end
|
||||
end
|
||||
|
||||
def other
|
||||
@doc = at_css('#docs-content')
|
||||
|
||||
# Clean up headings
|
||||
css('h2 > a').each do |node|
|
||||
node.before(node.children).remove
|
||||
end
|
||||
|
||||
# Remove code highlighting
|
||||
css('pre').each do |node|
|
||||
node.content = node.content
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,40 @@
|
||||
module Docs
|
||||
class Laravel
|
||||
class EntriesFilter < Docs::EntriesFilter
|
||||
def get_name
|
||||
if api_page?
|
||||
at_css('h1').content.strip.split('\\').last
|
||||
else
|
||||
at_css('h1').content.strip
|
||||
end
|
||||
end
|
||||
|
||||
def get_type
|
||||
if api_page?
|
||||
type = at_css('h1').content.strip.remove('Illuminate\\').remove(/\\\w+?\z/)
|
||||
type.end_with?('Console') ? type.split('\\').first : type
|
||||
else
|
||||
'Guides'
|
||||
end
|
||||
end
|
||||
|
||||
def additional_entries
|
||||
return [] unless api_page?
|
||||
|
||||
css('h3[id^="method_"]').each_with_object [] do |node, entries|
|
||||
next if node.at_css('.location').content.start_with?('in')
|
||||
|
||||
name = node['id'].remove('method_')
|
||||
name.prepend "#{self.name}::"
|
||||
name << '()'
|
||||
|
||||
entries << [name, node['id']]
|
||||
end
|
||||
end
|
||||
|
||||
def api_page?
|
||||
subpath.start_with?('/api')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,39 @@
|
||||
module Docs
|
||||
class Laravel < UrlScraper
|
||||
self.name = 'Laravel'
|
||||
self.slug = 'laravel'
|
||||
self.type = 'laravel'
|
||||
self.version = '4.1.29'
|
||||
self.base_url = 'http://laravel.com'
|
||||
self.root_path = '/docs/introduction'
|
||||
self.initial_paths = %w(/api/4.1/namespaces.html)
|
||||
|
||||
html_filters.push 'laravel/entries', 'laravel/clean_html'
|
||||
|
||||
options[:container] = ->(filter) {
|
||||
filter.subpath.start_with?('/api') ? nil : '#documentation > article'
|
||||
}
|
||||
|
||||
options[:only_patterns] = [
|
||||
/\A\/api\/4\.1\//,
|
||||
/\A\/docs\//]
|
||||
|
||||
options[:skip] = %w(
|
||||
/docs/quick
|
||||
/docs/releases
|
||||
/docs/upgrade
|
||||
/docs/artisan
|
||||
/docs/commands
|
||||
/api/4.1/panel.html
|
||||
/api/4.1/classes.html
|
||||
/api/4.1/interfaces.html
|
||||
/api/4.1/traits.html
|
||||
/api/4.1/doc-index.html
|
||||
/api/4.1/Illuminate.html)
|
||||
|
||||
options[:attribution] = <<-HTML
|
||||
© Taylor Otwell<br>
|
||||
Licensed under the MIT License.
|
||||
HTML
|
||||
end
|
||||
end
|
After Width: | Height: | Size: 683 B |
After Width: | Height: | Size: 1.7 KiB |
@ -0,0 +1 @@
|
||||
https://github.com/laravel/art
|
Loading…
Reference in new issue