mirror of https://github.com/freeCodeCamp/devdocs
parent
44daeb0e9d
commit
78beda8974
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 56 KiB After Width: | Height: | Size: 57 KiB |
@ -0,0 +1,5 @@
|
||||
._nginx {
|
||||
h4 { @extend %block-heading; }
|
||||
.note { @extend %note; }
|
||||
.directive { margin: 2.5em 0 1em; }
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
module Docs
|
||||
class Nginx
|
||||
class CleanHtmlFilter < Filter
|
||||
def call
|
||||
at_css('h2').name = 'h1'
|
||||
|
||||
css('center').each do |node|
|
||||
node.before(node.children).remove
|
||||
end
|
||||
|
||||
css('blockquote > pre', 'blockquote > table:only-child').each do |node|
|
||||
node.parent.before(node).remove
|
||||
end
|
||||
|
||||
css('a[name]').each do |node|
|
||||
node.next_element['id'] = node['name']
|
||||
node.remove
|
||||
end
|
||||
|
||||
links = css('h1 + table > tr:only-child > td:only-child > a').map(&:to_html)
|
||||
if links.present?
|
||||
at_css('h1 + table').replace("<ul><li>#{links.join('</li><li>')}</li></ul>")
|
||||
end
|
||||
|
||||
doc
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,33 @@
|
||||
module Docs
|
||||
class Nginx
|
||||
class EntriesFilter < Docs::EntriesFilter
|
||||
def get_name
|
||||
name = at_css('h1').content.strip
|
||||
name.sub! %r{\AModule ngx}, 'ngx'
|
||||
name
|
||||
end
|
||||
|
||||
def get_type
|
||||
if name.starts_with?('ngx_')
|
||||
name
|
||||
elsif slug == 'ngx_core_module'
|
||||
'Core'
|
||||
else
|
||||
'Guides'
|
||||
end
|
||||
end
|
||||
|
||||
def additional_entries
|
||||
css('h1 + ul a').each_with_object [] do |node, entries|
|
||||
name = node.content.strip
|
||||
next if name =~ /\A[A-Z]/
|
||||
|
||||
id = node['href'].remove('#')
|
||||
next if id.blank?
|
||||
|
||||
entries << [name, id]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,25 @@
|
||||
module Docs
|
||||
class Nginx < UrlScraper
|
||||
self.name = 'nginx'
|
||||
self.type = 'nginx'
|
||||
self.version = '1.7.6'
|
||||
self.base_url = 'http://nginx.org/en/docs/'
|
||||
|
||||
html_filters.push 'nginx/clean_html', 'nginx/entries'
|
||||
|
||||
options[:container] = '#content'
|
||||
|
||||
options[:skip] = %w(
|
||||
contributing_changes.html
|
||||
dirindex.html
|
||||
varindex.html)
|
||||
|
||||
options[:skip_patterns] = [/\/faq\//]
|
||||
|
||||
options[:attribution] = <<-HTML
|
||||
© 2002-2014 Igor Sysoev<br>
|
||||
© 2011-2014 Nginx, Inc.<br>
|
||||
Licensed under the BSD License.
|
||||
HTML
|
||||
end
|
||||
end
|
After Width: | Height: | Size: 377 B |
After Width: | Height: | Size: 613 B |
@ -0,0 +1 @@
|
||||
http://nginx.org/
|
Loading…
Reference in new issue