Improve Dojo scraper

pull/656/head
Thibaut Courouble 8 years ago
parent 150a4b6ab1
commit 384ee20b28

@ -210,7 +210,7 @@ credits = [
'https://raw.githubusercontent.com/docker/docker/master/LICENSE' 'https://raw.githubusercontent.com/docker/docker/master/LICENSE'
], [ ], [
'Dojo', 'Dojo',
'2005-2015 The Dojo Foundation', '2005-2017 JS Foundation',
'BSD + AFL', 'BSD + AFL',
'http://dojotoolkit.org/license.html' 'http://dojotoolkit.org/license.html'
], [ ], [

@ -1,14 +0,0 @@
#= require views/pages/base
class app.views.JavascriptWithMarkupCheckPage extends app.views.BasePage
prepare: ->
for el in @findAllByTag('pre')
language = if el.textContent.match(/^\s*</)
'markup'
else
'javascript'
@highlightCode el, language
return
app.views.DojoPage =
app.views.JavascriptWithMarkupCheckPage

@ -21,6 +21,7 @@ app.views.CordovaPage =
app.views.CrystalPage = app.views.CrystalPage =
app.views.D3Page = app.views.D3Page =
app.views.DockerPage = app.views.DockerPage =
app.views.DojoPage =
app.views.DrupalPage = app.views.DrupalPage =
app.views.ElectronPage = app.views.ElectronPage =
app.views.ElixirPage = app.views.ElixirPage =

@ -1,6 +1,5 @@
._dojo { ._dojo {
@extend %simple; @extend %simple;
.functionIcon, .parameters { @extend %code; }
.jsdoc-inheritance { color: $textColorLight; } .jsdoc-inheritance { color: $textColorLight; }
} }

@ -39,6 +39,21 @@ module Docs
node.replace(node.content) node.replace(node.content)
end end
css('.functionIcon', '.parameters').each do |node|
node.name = 'code'
node.content = node.content.strip
end
css('pre').each do |node|
node['data-language'] = node.content =~ /\A\s*</ ? 'markup' : 'javascript'
end
css('.jsdoc-function-information', '.jsdoc-examples', '.jsdoc-example', 'span').each do |node|
node.before(node.children).remove
end
css('table', 'a', 'h2', 'h3', 'td', 'strong').remove_attr('class')
doc doc
end end
end end

@ -25,7 +25,7 @@ module Docs
options[:skip_patterns] = [/dijit/, /dojox/] options[:skip_patterns] = [/dijit/, /dojox/]
options[:attribution] = <<-HTML options[:attribution] = <<-HTML
&copy; 2005&ndash;2015 The Dojo Foundation<br> &copy; 2005&ndash;2017 JS Foundation<br>
Licensed under the AFL 2.1 and BSD 3-Clause licenses. Licensed under the AFL 2.1 and BSD 3-Clause licenses.
HTML HTML

Loading…
Cancel
Save