Finish JSDoc scraper

pull/712/merge
Thibaut Courouble 7 years ago
parent abbd43b85e
commit 8eb8a9e46d

@ -1,5 +1,8 @@
[ [
[ [
"2018-2-4",
"New documentation: <a href=\"/jsdoc/\">JSDoc</a>"
], [
"2017-11-26", "2017-11-26",
"New documentations: <a href=\"/bluebird/\">Bluebird</a>, <a href=\"/eslint/\">ESLint</a> and <a href=\"/homebrew/\">Homebrew</a>" "New documentations: <a href=\"/bluebird/\">Bluebird</a>, <a href=\"/eslint/\">ESLint</a> and <a href=\"/homebrew/\">Homebrew</a>"
], [ ], [

@ -345,6 +345,11 @@ credits = [
'2009-2016 Jeff Bezanson, Stefan Karpinski, Viral B. Shah, and other contributors', '2009-2016 Jeff Bezanson, Stefan Karpinski, Viral B. Shah, and other contributors',
'MIT', 'MIT',
'https://raw.githubusercontent.com/JuliaLang/julia/master/LICENSE.md' 'https://raw.githubusercontent.com/JuliaLang/julia/master/LICENSE.md'
], [
'JSDoc',
'2011-2017 the contributors to the JSDoc 3 documentation project',
'CC BY-SA',
'https://raw.githubusercontent.com/jsdoc3/jsdoc3.github.com/master/LICENSE'
], [ ], [
'Knockout.js', 'Knockout.js',
'Steven Sanderson, the Knockout.js team, and other contributors', 'Steven Sanderson, the Knockout.js team, and other contributors',

@ -56,7 +56,6 @@
'pages/go', 'pages/go',
'pages/haskell', 'pages/haskell',
'pages/jquery', 'pages/jquery',
'pages/jsdoc',
'pages/julia', 'pages/julia',
'pages/knockout', 'pages/knockout',
'pages/kotlin', 'pages/kotlin',

@ -382,6 +382,8 @@
._table { width: 100%; } ._table { width: 100%; }
._mobile ._table { overflow-x: auto; } ._mobile ._table { overflow-x: auto; }
._pre-heading { @extend %pre-heading; }
._pre-clip { ._pre-clip {
display: none; display: none;
position: absolute; position: absolute;

@ -92,6 +92,7 @@
._icon-nginx_lua_module:before { background-position: -4rem -5rem; } ._icon-nginx_lua_module:before { background-position: -4rem -5rem; }
._icon-svg:before { background-position: -5rem -5rem; } ._icon-svg:before { background-position: -5rem -5rem; }
._icon-marionette:before { background-position: -6rem -5rem; } ._icon-marionette:before { background-position: -6rem -5rem; }
._icon-jsdoc:before,
._icon-mongoose:before { background-position: -7rem -5rem; } ._icon-mongoose:before { background-position: -7rem -5rem; }
._icon-phpunit:before { background-position: -8rem -5rem; } ._icon-phpunit:before { background-position: -8rem -5rem; }
._icon-nokogiri:before { background-position: -9rem -5rem; @extend %darkIconFix !optional; } ._icon-nokogiri:before { background-position: -9rem -5rem; @extend %darkIconFix !optional; }

@ -1,25 +0,0 @@
._jsdoc {
> h2 { @extend %block-heading; }
> h3 {
@extend %lined-heading;
font-size: 1.1em;
}
figure {
margin-left: 0;
font-size: inherit;
pre {
margin-bottom: 0.5em;
}
figcaption {
font-style: italic;
}
}
pre {
font-size: inherit;
}
}

@ -2,38 +2,21 @@ module Docs
class Jsdoc class Jsdoc
class CleanHtmlFilter < Filter class CleanHtmlFilter < Filter
def call def call
css('h2').each do |node| at_css('h1').content = 'JSDoc' if root_page?
next unless node.content.strip == 'Table of Contents'
toc_ul = node.next_element
toc_block = node.add_next_sibling('<nav class="_toc" role="directory"></nav>').first
node.name = 'h3'
node['class'] = '_toc-title'
node.remove
toc_block.add_child(node)
toc_ul.remove
toc_ul['class'] = '_toc-list'
toc_ul.css('ul').each do |child_list|
child_list.remove
end
toc_block.add_child(toc_ul)
end
css('.prettyprint').each do |node| css('.prettyprint').each do |node|
match = /lang-(\w+)/.match(node['class']) node.content = node.content
next unless match node['data-language'] = node['class'][/lang-(\w+)/, 1]
lang = match[1]
node.remove_attribute('class') node.remove_attribute('class')
node['data-language'] = lang
end end
css('figure').each do |node| css('figcaption').each do |node|
caption = node.at_css 'figcaption' node.name = 'div'
next unless caption node['class'] = '_pre-heading'
end
node.children.last.add_next_sibling(caption) css('figure').each do |node|
node.before(node.children).remove
end end
doc doc

@ -2,8 +2,11 @@ module Docs
class Jsdoc class Jsdoc
class EntriesFilter < Docs::EntriesFilter class EntriesFilter < Docs::EntriesFilter
def get_name def get_name
at_css('h1').content name = at_css('h1').content
name.prepend 'JSDoc: ' if !name.include?('@') && !name.include?('JSDoc')
name
end end
def get_type def get_type
case slug case slug
when /^about-/ when /^about-/
@ -17,7 +20,7 @@ module Docs
when /^tags-/ when /^tags-/
'Tags' 'Tags'
else else
'Other' # Only shown if a new category gets added in the upstream docs 'Miscellaneous' # Only shown if a new category gets added in the upstream docs
end end
end end
end end

@ -1,9 +1,10 @@
module Docs module Docs
class Jsdoc < UrlScraper class Jsdoc < UrlScraper
self.name = 'JSDoc' self.name = 'JSDoc'
self.type = 'jsdoc' self.type = 'simple'
self.release = '3.5.5' self.release = '3.5.5'
self.base_url = 'http://usejsdoc.org/' self.base_url = 'http://usejsdoc.org/'
self.root_path = 'index.html'
self.links = { self.links = {
home: 'http://usejsdoc.org/', home: 'http://usejsdoc.org/',
code: 'https://github.com/jsdoc3/jsdoc' code: 'https://github.com/jsdoc3/jsdoc'
@ -17,14 +18,8 @@ module Docs
'about-license-jsdoc3.html' 'about-license-jsdoc3.html'
] ]
options[:attribution] = <<-HTML options[:attribution] = <<-HTML
&copy; 2011&ndash;2017 &copy; 2011&ndash;2017 the contributors to the JSDoc 3 documentation project<br>
<a href="https://github.com/jsdoc3/jsdoc3.github.com/contributors"> Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
JSDoc 3 contributors
</a><br>
Licensed under
<a href="http://creativecommons.org/licenses/by-sa/3.0/">
CC BY-SA 3.0
</a>
HTML HTML
end end
end end

Binary file not shown.

Before

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 529 B

@ -1 +0,0 @@
https://avatars2.githubusercontent.com/u/1530630
Loading…
Cancel
Save