mirror of https://github.com/freeCodeCamp/devdocs
parent
91862dbfbd
commit
ec0e9f0b44
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 49 KiB After Width: | Height: | Size: 50 KiB |
@ -0,0 +1,11 @@
|
||||
#= require views/pages/base
|
||||
|
||||
class app.views.RequirejsPage extends app.views.BasePage
|
||||
afterRender: ->
|
||||
for el in @findAllByTag 'pre'
|
||||
language = if el.textContent.match(/^\s*</)
|
||||
'markup'
|
||||
else
|
||||
'javascript'
|
||||
@highlightCode el, language
|
||||
return
|
@ -0,0 +1,10 @@
|
||||
._requirejs {
|
||||
padding-left: 1rem;
|
||||
|
||||
h1, h2, h3, ul.index { margin-left: -1rem; }
|
||||
h2 { @extend %block-heading; }
|
||||
h3 { @extend %block-label, %label-blue; }
|
||||
h4 { font-size: 1em; }
|
||||
|
||||
ul.index ul { margin: .5em 0; }
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
module Docs
|
||||
class Requirejs
|
||||
class CleanHtmlFilter < Filter
|
||||
def call
|
||||
css('.sectionMark', '.hbox > .sect').remove
|
||||
css('h1 + .note').remove if root_page?
|
||||
|
||||
css('.section', 'pre > code').each do |node|
|
||||
node.before(node.children).remove
|
||||
end
|
||||
|
||||
css('h2', 'h3', 'h4').each do |node|
|
||||
next unless link = node.at_css('a[name]')
|
||||
node['id'] = link['name']
|
||||
link.before(link.children).remove
|
||||
end
|
||||
|
||||
doc
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,35 @@
|
||||
module Docs
|
||||
class Requirejs
|
||||
class EntriesFilter < Docs::EntriesFilter
|
||||
def get_name
|
||||
at_css('h1').content
|
||||
end
|
||||
|
||||
def get_type
|
||||
'Guides'
|
||||
end
|
||||
|
||||
def additional_entries
|
||||
return [] unless root_page?
|
||||
|
||||
entries = []
|
||||
type = nil
|
||||
|
||||
css('*').each do |node|
|
||||
if node.name == 'h2'
|
||||
type = node.content
|
||||
elsif node.name == 'h3' || node.name == 'h4'
|
||||
entries << [node.content, node['id'], type]
|
||||
end
|
||||
end
|
||||
|
||||
css('p[id^="config-"]').each do |node|
|
||||
next if node['id'].include?('note')
|
||||
entries << [node.at_css('strong').content, node['id'], 'Configuration Options']
|
||||
end
|
||||
|
||||
entries
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,29 @@
|
||||
module Docs
|
||||
class Requirejs < UrlScraper
|
||||
self.name = 'RequireJS'
|
||||
self.type = 'requirejs'
|
||||
self.version = '2.1.4'
|
||||
self.base_url = 'http://requirejs.org/docs/'
|
||||
self.root_path = 'api.html'
|
||||
self.initial_paths = %w(
|
||||
optimization.html
|
||||
jquery.html
|
||||
node.html
|
||||
dojo.html
|
||||
commonjs.html
|
||||
plugins.html
|
||||
why.html
|
||||
whyamd.html)
|
||||
|
||||
html_filters.push 'requirejs/clean_html', 'requirejs/entries'
|
||||
|
||||
options[:container] = '#content'
|
||||
options[:follow_links] = false
|
||||
options[:only] = self.initial_paths
|
||||
|
||||
options[:attribution] = <<-HTML
|
||||
© 2010–2014 The Dojo Foundation<br>
|
||||
Licensed under the MIT License.
|
||||
HTML
|
||||
end
|
||||
end
|
After Width: | Height: | Size: 309 B |
After Width: | Height: | Size: 693 B |
@ -0,0 +1 @@
|
||||
http://requirejs.org/
|
Loading…
Reference in new issue