Improve Dojo scraper

This commit is contained in:
Thibaut Courouble 2017-07-22 12:38:40 -04:00
parent 150a4b6ab1
commit 384ee20b28
6 changed files with 18 additions and 17 deletions

View file

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

View file

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

View file

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

View file

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

View file

@ -39,6 +39,21 @@ module Docs
node.replace(node.content)
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
end
end

View file

@ -25,7 +25,7 @@ module Docs
options[:skip_patterns] = [/dijit/, /dojox/]
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.
HTML