Add RequireJS documentation

pull/110/head
Thibaut 11 years ago
parent 91862dbfbd
commit ec0e9f0b44

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

After

Width:  |  Height:  |  Size: 50 KiB

@ -210,6 +210,11 @@ credits = [
'2009-2014 Salvatore Sanfilippo',
'CC BY-SA',
'http://creativecommons.org/licenses/by-sa/4.0/'
], [
'RequireJS',
'2010-2014 The Dojo Foundation',
'MIT',
'https://raw.githubusercontent.com/jrburke/requirejs/master/LICENSE'
], [
'Ruby',
'1993-2014 Yukihiro Matsumoto',

@ -24,7 +24,10 @@ newsItem = (date, news) ->
result
app.news = [
[ 1402704000000, # June 14, 2014
[ 1402790400000, # June 15, 2014
""" New <a href="/requirejs/">RequireJS</a> documentation """,
], [
1402704000000, # June 14, 2014
""" New <a href="/haskell/">Haskell</a> documentation """,
], [
1400976000000, # May 25, 2014

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

@ -51,6 +51,7 @@
'pages/postgres',
'pages/rdoc',
'pages/redis',
'pages/requirejs',
'pages/rfc',
'pages/sphinx',
'pages/underscore',

@ -58,3 +58,4 @@
._icon-maxcdn:before { background-position: -4rem -8rem; }
._icon-laravel:before { background-position: 0 -9rem; }
._icon-haskell:before { background-position: -1rem -9rem; }
._icon-requirejs:before { background-position: -2rem -9rem; }

@ -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
&copy; 2010&ndash;2014 The Dojo Foundation<br>
Licensed under the MIT License.
HTML
end
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 309 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 693 B

@ -0,0 +1 @@
http://requirejs.org/
Loading…
Cancel
Save