History

Finish JSDoc scraper

Thibaut Courouble committed 8 years ago

Commit 8eb8a9e1 parent abbd43b12 files · +27 −62Browse files

Unified · Split

12 files
  1. assets/javascripts/news.json +3 −0
  2. assets/javascripts/templates/pages/about_tmpl.coffee +5 −0
  3. assets/stylesheets/application.css.scss +0 −1
  4. assets/stylesheets/components/_content.scss +2 −0
  5. assets/stylesheets/global/_icons.scss +1 −0
  6. assets/stylesheets/pages/_jsdoc.scss +0 −25
  7. lib/docs/filters/jsdoc/clean_html.rb +9 −26
  8. lib/docs/filters/jsdoc/entries.rb +5 −2
  9. lib/docs/scrapers/jsdoc.rb +4 −9
  10. public/icons/docs/jsdoc/16.png +0 −0
  11. public/icons/docs/jsdoc/16@2x.png +0 −0
  12. public/icons/docs/jsdoc/SOURCE +0 −1
assets/javascripts/news.json+3−0
@@ -1,5 +1,8 @@
1[1[
2 [2 [
3 "2018-2-4",
4 "New documentation: <a href=\"/jsdoc/\">JSDoc</a>"
5 ], [
3 "2017-11-26",6 "2017-11-26",
4 "New documentations: <a href=\"/bluebird/\">Bluebird</a>, <a href=\"/eslint/\">ESLint</a> and <a href=\"/homebrew/\">Homebrew</a>"7 "New documentations: <a href=\"/bluebird/\">Bluebird</a>, <a href=\"/eslint/\">ESLint</a> and <a href=\"/homebrew/\">Homebrew</a>"
5 ], [8 ], [
assets/javascripts/templates/pages/about_tmpl.coffee+5−0
@@ -345,6 +345,11 @@ credits = [ · 344 unmodified lines
345 '2009-2016 Jeff Bezanson, Stefan Karpinski, Viral B. Shah, and other contributors',345 '2009-2016 Jeff Bezanson, Stefan Karpinski, Viral B. Shah, and other contributors',
346 'MIT',346 'MIT',
347 'https://raw.githubusercontent.com/JuliaLang/julia/master/LICENSE.md'347 'https://raw.githubusercontent.com/JuliaLang/julia/master/LICENSE.md'
348 ], [
349 'JSDoc',
350 '2011-2017 the contributors to the JSDoc 3 documentation project',
351 'CC BY-SA',
352 'https://raw.githubusercontent.com/jsdoc3/jsdoc3.github.com/master/LICENSE'
348 ], [353 ], [
349 'Knockout.js',354 'Knockout.js',
350 'Steven Sanderson, the Knockout.js team, and other contributors',355 'Steven Sanderson, the Knockout.js team, and other contributors',
assets/stylesheets/application.css.scss+0−1
@@ -56,7 +56,6 @@ · 55 unmodified lines
56 'pages/go',56 'pages/go',
57 'pages/haskell',57 'pages/haskell',
58 'pages/jquery',58 'pages/jquery',
59 'pages/jsdoc',
60 'pages/julia',59 'pages/julia',
61 'pages/knockout',60 'pages/knockout',
62 'pages/kotlin',61 'pages/kotlin',
assets/stylesheets/components/_content.scss+2−0
@@ -382,6 +382,8 @@ · 381 unmodified lines
382._table { width: 100%; }382._table { width: 100%; }
383._mobile ._table { overflow-x: auto; }383._mobile ._table { overflow-x: auto; }
384 384
385._pre-heading { @extend %pre-heading; }
386
385._pre-clip {387._pre-clip {
386 display: none;388 display: none;
387 position: absolute;389 position: absolute;
assets/stylesheets/global/_icons.scss+1−0
@@ -92,6 +92,7 @@ · 91 unmodified lines
92._icon-nginx_lua_module:before { background-position: -4rem -5rem; }92._icon-nginx_lua_module:before { background-position: -4rem -5rem; }
93._icon-svg:before { background-position: -5rem -5rem; }93._icon-svg:before { background-position: -5rem -5rem; }
94._icon-marionette:before { background-position: -6rem -5rem; }94._icon-marionette:before { background-position: -6rem -5rem; }
95._icon-jsdoc:before,
95._icon-mongoose:before { background-position: -7rem -5rem; }96._icon-mongoose:before { background-position: -7rem -5rem; }
96._icon-phpunit:before { background-position: -8rem -5rem; }97._icon-phpunit:before { background-position: -8rem -5rem; }
97._icon-nokogiri:before { background-position: -9rem -5rem; @extend %darkIconFix !optional; }98._icon-nokogiri:before { background-position: -9rem -5rem; @extend %darkIconFix !optional; }
assets/stylesheets/pages/_jsdoc.scss+0−25
@@ -1,25 +0,0 @@
1._jsdoc {
2 > h2 { @extend %block-heading; }
3
4 > h3 {
5 @extend %lined-heading;
6 font-size: 1.1em;
7 }
8
9 figure {
10 margin-left: 0;
11 font-size: inherit;
12
13 pre {
14 margin-bottom: 0.5em;
15 }
16
17 figcaption {
18 font-style: italic;
19 }
20 }
21
22 pre {
23 font-size: inherit;
24 }
25}
lib/docs/filters/jsdoc/clean_html.rb+9−26
@@ -2,38 +2,21 @@ module Docs · 1 unmodified line
2 class Jsdoc2 class Jsdoc
3 class CleanHtmlFilter < Filter3 class CleanHtmlFilter < Filter
4 def call4 def call
5 css('h2').each do |node|5 at_css('h1').content = 'JSDoc' if root_page?
6 next unless node.content.strip == 'Table of Contents'
7 toc_ul = node.next_element
8 toc_block = node.add_next_sibling('<nav class="_toc" role="directory"></nav>').first
9
10 node.name = 'h3'
11 node['class'] = '_toc-title'
12 node.remove
13 toc_block.add_child(node)
14
15 toc_ul.remove
16 toc_ul['class'] = '_toc-list'
17 toc_ul.css('ul').each do |child_list|
18 child_list.remove
19 end
20 toc_block.add_child(toc_ul)
21 end
22 6
23 css('.prettyprint').each do |node|7 css('.prettyprint').each do |node|
24 match = /lang-(\w+)/.match(node['class'])8 node.content = node.content
25 next unless match9 node['data-language'] = node['class'][/lang-(\w+)/, 1]
26
27 lang = match[1]
28 node.remove_attribute('class')10 node.remove_attribute('class')
29 node['data-language'] = lang
30 end11 end
31 12
32 css('figure').each do |node|13 css('figcaption').each do |node|
33 caption = node.at_css 'figcaption'14 node.name = 'div'
34 next unless caption15 node['class'] = '_pre-heading'
16 end
35 17
36 node.children.last.add_next_sibling(caption)18 css('figure').each do |node|
19 node.before(node.children).remove
37 end20 end
38 21
39 doc22 doc
lib/docs/filters/jsdoc/entries.rb+5−2
@@ -2,8 +2,11 @@ module Docs · 1 unmodified line
2 class Jsdoc2 class Jsdoc
3 class EntriesFilter < Docs::EntriesFilter3 class EntriesFilter < Docs::EntriesFilter
4 def get_name4 def get_name
5 at_css('h1').content5 name = at_css('h1').content
6 name.prepend 'JSDoc: ' if !name.include?('@') && !name.include?('JSDoc')
7 name
6 end8 end
9
7 def get_type10 def get_type
8 case slug11 case slug
9 when /^about-/12 when /^about-/
@@ -17,7 +20,7 @@ module Docs · 7 unmodified lines
17 when /^tags-/20 when /^tags-/
18 'Tags'21 'Tags'
19 else22 else
20 'Other' # Only shown if a new category gets added in the upstream docs23 'Miscellaneous' # Only shown if a new category gets added in the upstream docs
21 end24 end
22 end25 end
23 end26 end
lib/docs/scrapers/jsdoc.rb+4−9
@@ -1,9 +1,10 @@
1module Docs1module Docs
2 class Jsdoc < UrlScraper2 class Jsdoc < UrlScraper
3 self.name = 'JSDoc'3 self.name = 'JSDoc'
4 self.type = 'jsdoc'4 self.type = 'simple'
5 self.release = '3.5.5'5 self.release = '3.5.5'
6 self.base_url = 'http://usejsdoc.org/'6 self.base_url = 'http://usejsdoc.org/'
7 self.root_path = 'index.html'
7 self.links = {8 self.links = {
8 home: 'http://usejsdoc.org/',9 home: 'http://usejsdoc.org/',
9 code: 'https://github.com/jsdoc3/jsdoc'10 code: 'https://github.com/jsdoc3/jsdoc'
@@ -17,14 +18,8 @@ module Docs · 7 unmodified lines
17 'about-license-jsdoc3.html'18 'about-license-jsdoc3.html'
18 ]19 ]
19 options[:attribution] = <<-HTML20 options[:attribution] = <<-HTML
20 &copy; 2011&ndash;201721 &copy; 2011&ndash;2017 the contributors to the JSDoc 3 documentation project<br>
21 <a href="https://github.com/jsdoc3/jsdoc3.github.com/contributors">22 Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
22 JSDoc 3 contributors
23 </a><br>
24 Licensed under
25 <a href="http://creativecommons.org/licenses/by-sa/3.0/">
26 CC BY-SA 3.0
27 </a>
28 HTML23 HTML
29 end24 end
30end25end
public/icons/docs/jsdoc/16.png+0−0

Binary file not shown.

public/icons/docs/jsdoc/16@2x.png+0−0

Binary file not shown.

public/icons/docs/jsdoc/SOURCE+0−1
@@ -1 +0,0 @@
1https://avatars2.githubusercontent.com/u/1530630