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
39 node.replace(node.content)39 node.replace(node.content)
40 end40 end
41 41
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
42 doc57 doc
43 end58 end
44 end59 end
lib/docs/scrapers/dojo.rb+1−1
@@ -25,7 +25,7 @@ module Docs · 24 unmodified lines
25 options[:skip_patterns] = [/dijit/, /dojox/]25 options[:skip_patterns] = [/dijit/, /dojox/]
26 26
27 options[:attribution] = <<-HTML27 options[:attribution] = <<-HTML
28 &copy; 2005&ndash;2015 The Dojo Foundation<br>28 &copy; 2005&ndash;2017 JS Foundation<br>
29 Licensed under the AFL 2.1 and BSD 3-Clause licenses.29 Licensed under the AFL 2.1 and BSD 3-Clause licenses.
30 HTML30 HTML
31 31