Add nginx documentation

pull/129/head
Thibaut 10 years ago
parent 44daeb0e9d
commit 78beda8974

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

After

Width:  |  Height:  |  Size: 57 KiB

@ -207,6 +207,11 @@ credits = [
'2011-2014 Tim Wood, Iskren Chernev, Moment.js contributors',
'MIT',
'https://raw.github.com/moment/moment/master/LICENSE'
], [
'nginx',
'2002-2014 Igor Sysoev<br>&copy; 2011-2014 Nginx, Inc.',
'BSD',
'http://nginx.org/LICENSE'
], [
'Node.js',
'Joyent, Inc. and other Node contributors<br>Node.js is a trademark of Joyent, Inc.',

@ -33,7 +33,10 @@ newsItem = (date, news) ->
result
app.news = [
[ 1413158400000, # October 13, 2014
[ 1413590400000, # October 18, 2014
""" New <a href="/nginx/">nginx</a> documentation """,
], [
1413158400000, # October 13, 2014
""" New <a href="/xpath/">XPath</a> documentation """,
], [
1410048000000, # September 7, 2014

@ -49,6 +49,7 @@
'pages/maxcdn',
'pages/mdn',
'pages/moment',
'pages/nginx',
'pages/node',
'pages/php',
'pages/postgres',

@ -65,3 +65,4 @@
._icon-markdown:before { background-position: -1rem -10rem; }
._icon-django:before { background-position: -2rem -10rem; }
._icon-xpath:before { background-position: -3rem -10rem; }
._icon-nginx:before { background-position: -4rem -10rem; }

@ -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
&copy; 2002-2014 Igor Sysoev<br>
&copy; 2011-2014 Nginx, Inc.<br>
Licensed under the BSD License.
HTML
end
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 377 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 613 B

@ -0,0 +1 @@
http://nginx.org/
Loading…
Cancel
Save