mirror of https://github.com/freeCodeCamp/devdocs
parent
d2c210286a
commit
5f6f8a7194
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 44 KiB |
@ -0,0 +1,4 @@
|
||||
#= require views/pages/base
|
||||
#= require views/pages/underscore
|
||||
|
||||
app.views.ExpressPage = app.views.UnderscorePage
|
@ -0,0 +1,8 @@
|
||||
._express {
|
||||
padding-left: 1rem;
|
||||
|
||||
h1, h2, h3 { margin-left: -1rem; }
|
||||
h2 { @extend %block-heading; }
|
||||
h3 { @extend %block-label, %label-blue; }
|
||||
p > code { @extend %label; }
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
module Docs
|
||||
class Express
|
||||
class CleanHtmlFilter < Filter
|
||||
def call
|
||||
css('section').each do |node|
|
||||
node.before(node.children).remove
|
||||
end
|
||||
|
||||
# Put id attributes on headings
|
||||
css('h2 + a[name]').each do |node|
|
||||
node.previous_element['id'] = node['name']
|
||||
node.remove
|
||||
end
|
||||
|
||||
# Remove code highlighting
|
||||
css('pre').each do |node|
|
||||
node.content = node.content
|
||||
end
|
||||
|
||||
doc
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,21 @@
|
||||
module Docs
|
||||
class Express
|
||||
class EntriesFilter < Docs::EntriesFilter
|
||||
def additional_entries
|
||||
type = 'Application'
|
||||
|
||||
doc.children.each_with_object [] do |node, entries|
|
||||
if node.name == 'h2'
|
||||
type = node.content
|
||||
next
|
||||
elsif node.name == 'h3'
|
||||
name = node.content.strip
|
||||
name.sub! %r{\(.+\)}, '()'
|
||||
|
||||
entries << [name, node['id'], type]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,19 @@
|
||||
module Docs
|
||||
class Express < UrlScraper
|
||||
self.name = 'Express'
|
||||
self.type = 'express'
|
||||
self.version = '4.1.1'
|
||||
self.base_url = 'http://expressjs.com/4x/api.html'
|
||||
|
||||
html_filters.push 'express/clean_html', 'express/entries', 'title'
|
||||
|
||||
options[:title] = 'Express'
|
||||
options[:container] = '#right'
|
||||
options[:skip_links] = true
|
||||
|
||||
options[:attribution] = <<-HTML
|
||||
© 2009–2014 TJ Holowaychuk<br>
|
||||
Licensed under the MIT License.
|
||||
HTML
|
||||
end
|
||||
end
|
After Width: | Height: | Size: 202 B |
After Width: | Height: | Size: 409 B |
Loading…
Reference in new issue