Skip to content

Commit 8eb8a9e

Browse files
committed
Finish JSDoc scraper
1 parent abbd43b commit 8eb8a9e

File tree

12 files changed

+29
-64
lines changed

12 files changed

+29
-64
lines changed

assets/javascripts/news.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
[
22
[
3+
"2018-2-4",
4+
"New documentation: <a href=\"/jsdoc/\">JSDoc</a>"
5+
], [
36
"2017-11-26",
47
"New documentations: <a href=\"/bluebird/\">Bluebird</a>, <a href=\"/eslint/\">ESLint</a> and <a href=\"/homebrew/\">Homebrew</a>"
58
], [

assets/javascripts/templates/pages/about_tmpl.coffee

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,11 @@ credits = [
345345
'2009-2016 Jeff Bezanson, Stefan Karpinski, Viral B. Shah, and other contributors',
346346
'MIT',
347347
'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'
348353
], [
349354
'Knockout.js',
350355
'Steven Sanderson, the Knockout.js team, and other contributors',

assets/stylesheets/application.css.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@
5656
'pages/go',
5757
'pages/haskell',
5858
'pages/jquery',
59-
'pages/jsdoc',
6059
'pages/julia',
6160
'pages/knockout',
6261
'pages/kotlin',

assets/stylesheets/components/_content.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,8 @@
382382
._table { width: 100%; }
383383
._mobile ._table { overflow-x: auto; }
384384

385+
._pre-heading { @extend %pre-heading; }
386+
385387
._pre-clip {
386388
display: none;
387389
position: absolute;

assets/stylesheets/global/_icons.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@
9292
._icon-nginx_lua_module:before { background-position: -4rem -5rem; }
9393
._icon-svg:before { background-position: -5rem -5rem; }
9494
._icon-marionette:before { background-position: -6rem -5rem; }
95+
._icon-jsdoc:before,
9596
._icon-mongoose:before { background-position: -7rem -5rem; }
9697
._icon-phpunit:before { background-position: -8rem -5rem; }
9798
._icon-nokogiri:before { background-position: -9rem -5rem; @extend %darkIconFix !optional; }

assets/stylesheets/pages/_jsdoc.scss

Lines changed: 0 additions & 25 deletions
This file was deleted.

lib/docs/filters/jsdoc/clean_html.rb

Lines changed: 9 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,38 +2,21 @@ module Docs
22
class Jsdoc
33
class CleanHtmlFilter < Filter
44
def call
5-
css('h2').each do |node|
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
5+
at_css('h1').content = 'JSDoc' if root_page?
226

237
css('.prettyprint').each do |node|
24-
match = /lang-(\w+)/.match(node['class'])
25-
next unless match
26-
27-
lang = match[1]
8+
node.content = node.content
9+
node['data-language'] = node['class'][/lang-(\w+)/, 1]
2810
node.remove_attribute('class')
29-
node['data-language'] = lang
3011
end
3112

32-
css('figure').each do |node|
33-
caption = node.at_css 'figcaption'
34-
next unless caption
13+
css('figcaption').each do |node|
14+
node.name = 'div'
15+
node['class'] = '_pre-heading'
16+
end
3517

36-
node.children.last.add_next_sibling(caption)
18+
css('figure').each do |node|
19+
node.before(node.children).remove
3720
end
3821

3922
doc

lib/docs/filters/jsdoc/entries.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@ module Docs
22
class Jsdoc
33
class EntriesFilter < Docs::EntriesFilter
44
def get_name
5-
at_css('h1').content
5+
name = at_css('h1').content
6+
name.prepend 'JSDoc: ' if !name.include?('@') && !name.include?('JSDoc')
7+
name
68
end
9+
710
def get_type
811
case slug
912
when /^about-/
@@ -17,7 +20,7 @@ def get_type
1720
when /^tags-/
1821
'Tags'
1922
else
20-
'Other' # Only shown if a new category gets added in the upstream docs
23+
'Miscellaneous' # Only shown if a new category gets added in the upstream docs
2124
end
2225
end
2326
end

lib/docs/scrapers/jsdoc.rb

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
module Docs
22
class Jsdoc < UrlScraper
33
self.name = 'JSDoc'
4-
self.type = 'jsdoc'
4+
self.type = 'simple'
55
self.release = '3.5.5'
66
self.base_url = 'http://usejsdoc.org/'
7+
self.root_path = 'index.html'
78
self.links = {
89
home: 'http://usejsdoc.org/',
910
code: 'https://github.com/jsdoc3/jsdoc'
@@ -17,14 +18,8 @@ class Jsdoc < UrlScraper
1718
'about-license-jsdoc3.html'
1819
]
1920
options[:attribution] = <<-HTML
20-
&copy; 2011&ndash;2017
21-
<a href="https://github.com/jsdoc3/jsdoc3.github.com/contributors">
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>
21+
&copy; 2011&ndash;2017 the contributors to the JSDoc 3 documentation project<br>
22+
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
2823
HTML
2924
end
3025
end

public/icons/docs/jsdoc/16.png

-246 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)