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.
pull/359/merge
Julien Desgats 9 years ago committed by Thibaut Courouble
parent a5ffc1fb3b
commit acac755eb1

@ -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

@ -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

@ -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

@ -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
Loading…
Cancel
Save