Added Lua Nginx Module documentation

Only the Nginx directives and the Lua API are relevant for devdocs, all
the rest has been filtered out for now.
This commit is contained in:
Julien Desgats 2016-01-29 00:02:45 +01:00 committed by Thibaut Courouble
parent a5ffc1fb3b
commit acac755eb1
4 changed files with 66 additions and 0 deletions

View file

@ -0,0 +1,8 @@
#= require views/pages/base
# this may be used for all GitHub pages
class app.views.LuaNginxModulePage extends app.views.BasePage
prepare: ->
@highlightCode @findAll('div.highlight-source-lua pre'), 'lua'
return

View file

@ -0,0 +1,22 @@
module Docs
class LuaNginxModule
class CleanHtmlFilter < Filter
def call
type = nil
doc.children.each do |node|
if node.name == 'h1'
section = node.content.strip
type = section.in?(['Directives', 'Nginx API for Lua']) ? section : nil
end
if type == nil || (node.name == 'ul' && node.previous_element.name == 'h1') || node.content.strip == 'Back to TOC'
node.remove()
elsif node.name == 'h2'
node["id"] = /^user-content-(.+)/.match(node.css('a.anchor').first["id"])[1]
end
end
doc
end
end
end
end

View file

@ -0,0 +1,17 @@
module Docs
class LuaNginxModule
class EntriesFilter < Docs::EntriesFilter
def additional_entries
type = nil
doc.children.each_with_object [] do |node, entries|
if node.name == 'h1'
type = node.content.strip
elsif node.name == 'h2'
entries << [ node.content, node["id"], type ]
end
end
end
end
end
end

View file

@ -0,0 +1,19 @@
module Docs
class LuaNginxModule < UrlScraper
self.type = 'LuaNginxModule'
self.root_path = 'README.markdown'
html_filters.push 'lua_nginx_module/clean_html', 'lua_nginx_module/entries'
options[:container] = '#readme > article'
options[:attribution] = <<-HTML
Copyright (C) 2009-2015, by Xiaozhe Wang (chaoslawful) <a href="mailto:chaoslawful@gmail.com">chaoslawful@gmail.com</a>.<br>
Copyright (C) 2009-2015, by Yichun "agentzh" Zhang () <a href="mailto:agentzh@gmail.com">agentzh@gmail.com</a>, CloudFlare Inc.<br>
Licensed under the BSD License.
HTML
self.release = '0.10.0'
self.base_url = 'https://github.com/openresty/lua-nginx-module/tree/v0.10.0/'
end
end