History

Improve Dojo scraper

Thibaut Courouble committed 9 years ago

Commit 384ee201 parent 150a4b66 files · +18 −17Browse files

Showing the changes to lib/docs (2 of 6 files). Show all

Unified · Split

2 files
  1. lib/docs/filters/dojo/clean_html.rb +15 −0
  2. lib/docs/scrapers/dojo.rb +1 −1
lib/docs/filters/dojo/clean_html.rb+15−0
@@ -39,6 +39,21 @@ module Docs · 38 unmodified lines
3939 node.replace(node.content)
4040 end
4141
42+ css('.functionIcon', '.parameters').each do |node|
43+ node.name = 'code'
44+ node.content = node.content.strip
45+ end
46+
47+ css('pre').each do |node|
48+ node['data-language'] = node.content =~ /\A\s*</ ? 'markup' : 'javascript'
49+ end
50+
51+ css('.jsdoc-function-information', '.jsdoc-examples', '.jsdoc-example', 'span').each do |node|
52+ node.before(node.children).remove
53+ end
54+
55+ css('table', 'a', 'h2', 'h3', 'td', 'strong').remove_attr('class')
56+
4257 doc
4358 end
4459 end
lib/docs/scrapers/dojo.rb+1−1
@@ -25,7 +25,7 @@ module Docs · 24 unmodified lines
2525 options[:skip_patterns] = [/dijit/, /dojox/]
2626
2727 options[:attribution] = <<-HTML
28− &copy; 2005&ndash;2015 The Dojo Foundation<br>
28+ &copy; 2005&ndash;2017 JS Foundation<br>
2929 Licensed under the AFL 2.1 and BSD 3-Clause licenses.
3030 HTML
3131