mirror of https://github.com/freeCodeCamp/devdocs
parent
acac755eb1
commit
ac3aaea531
@ -0,0 +1,6 @@
|
||||
#= require views/pages/base
|
||||
|
||||
class app.views.GithubPage extends app.views.BasePage
|
||||
prepare: ->
|
||||
@highlightCode @findAll('pre.highlight-source-lua'), 'lua'
|
||||
return
|
@ -1,8 +0,0 @@
|
||||
#= 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,20 @@
|
||||
module Docs
|
||||
class Github
|
||||
class CleanHtmlFilter < Filter
|
||||
def call
|
||||
css('.anchor').each do |node|
|
||||
node.parent['id'] = node['href'].remove('#')
|
||||
node.remove
|
||||
end
|
||||
|
||||
css('.highlight > pre').each do |node|
|
||||
node['class'] = node.parent['class']
|
||||
node.content = node.content.strip_heredoc.gsub(' ', ' ')
|
||||
node.parent.replace(node)
|
||||
end
|
||||
|
||||
doc
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -1,22 +0,0 @@
|
||||
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
|
@ -1,17 +0,0 @@
|
||||
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,15 @@
|
||||
module Docs
|
||||
class NginxLuaModule
|
||||
class CleanHtmlFilter < Filter
|
||||
def call
|
||||
css('a[href="#table-of-contents"]', 'a:contains("Back to TOC")').remove
|
||||
|
||||
css('h1, h2, h3').each do |node|
|
||||
node.name = node.name.sub(/\d/) { |i| i.to_i + 1 }
|
||||
end
|
||||
|
||||
doc
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,20 @@
|
||||
module Docs
|
||||
class NginxLuaModule
|
||||
class EntriesFilter < Docs::EntriesFilter
|
||||
def additional_entries
|
||||
entries = []
|
||||
|
||||
css('#directives + ul > li > a').each do |node|
|
||||
entries << [node.content, node['href'].remove('#'), 'Directives']
|
||||
end
|
||||
|
||||
css('#nginx-api-for-lua + ul > li > a').each do |node|
|
||||
next if node.content == 'Introduction'
|
||||
entries << [node.content, node['href'].remove('#'), 'Nginx API for Lua']
|
||||
end
|
||||
|
||||
entries
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,8 @@
|
||||
module Docs
|
||||
class Github < UrlScraper
|
||||
self.abstract = true
|
||||
self.type = 'github'
|
||||
|
||||
html_filters.push 'github/clean_html'
|
||||
end
|
||||
end
|
@ -1,19 +0,0 @@
|
||||
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
|
@ -0,0 +1,19 @@
|
||||
module Docs
|
||||
class NginxLuaModule < Github
|
||||
self.name = 'nginx / Lua Module'
|
||||
self.slug = 'nginx_lua_module'
|
||||
self.release = '0.10.0'
|
||||
self.base_url = 'https://github.com/openresty/lua-nginx-module/tree/v0.10.0/'
|
||||
|
||||
html_filters.push 'nginx_lua_module/clean_html', 'nginx_lua_module/entries', 'title'
|
||||
|
||||
options[:root_title] = 'ngx_http_lua_module'
|
||||
options[:container] = '#readme > article'
|
||||
|
||||
options[:attribution] = <<-HTML
|
||||
© 2009–2016 Xiaozhe Wang (chaoslawful)<br>
|
||||
© 2009–2016 Yichun "agentzh" Zhang (章亦春), CloudFlare Inc.<br>
|
||||
Licensed under the BSD License.
|
||||
HTML
|
||||
end
|
||||
end
|
Loading…
Reference in new issue