From 8eb8a9e46dc51963ed331f63b09ecaee1801a24b Mon Sep 17 00:00:00 2001 From: Thibaut Courouble Date: Sun, 4 Feb 2018 10:43:11 -0500 Subject: [PATCH] Finish JSDoc scraper --- assets/javascripts/news.json | 3 ++ .../templates/pages/about_tmpl.coffee | 5 +++ assets/stylesheets/application.css.scss | 1 - assets/stylesheets/components/_content.scss | 2 + assets/stylesheets/global/_icons.scss | 1 + assets/stylesheets/pages/_jsdoc.scss | 25 ------------- lib/docs/filters/jsdoc/clean_html.rb | 35 +++++------------- lib/docs/filters/jsdoc/entries.rb | 7 +++- lib/docs/scrapers/jsdoc.rb | 13 ++----- public/icons/docs/jsdoc/16.png | Bin 246 -> 0 bytes public/icons/docs/jsdoc/16@2x.png | Bin 529 -> 0 bytes public/icons/docs/jsdoc/SOURCE | 1 - 12 files changed, 29 insertions(+), 64 deletions(-) delete mode 100644 assets/stylesheets/pages/_jsdoc.scss delete mode 100644 public/icons/docs/jsdoc/16.png delete mode 100644 public/icons/docs/jsdoc/16@2x.png delete mode 100644 public/icons/docs/jsdoc/SOURCE diff --git a/assets/javascripts/news.json b/assets/javascripts/news.json index c93f8ed9..e998c941 100644 --- a/assets/javascripts/news.json +++ b/assets/javascripts/news.json @@ -1,5 +1,8 @@ [ [ + "2018-2-4", + "New documentation: JSDoc" + ], [ "2017-11-26", "New documentations: Bluebird, ESLint and Homebrew" ], [ diff --git a/assets/javascripts/templates/pages/about_tmpl.coffee b/assets/javascripts/templates/pages/about_tmpl.coffee index 0e2e4912..adabe626 100644 --- a/assets/javascripts/templates/pages/about_tmpl.coffee +++ b/assets/javascripts/templates/pages/about_tmpl.coffee @@ -345,6 +345,11 @@ credits = [ '2009-2016 Jeff Bezanson, Stefan Karpinski, Viral B. Shah, and other contributors', 'MIT', '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', 'Steven Sanderson, the Knockout.js team, and other contributors', diff --git a/assets/stylesheets/application.css.scss b/assets/stylesheets/application.css.scss index fb0c08cd..e4314a0f 100644 --- a/assets/stylesheets/application.css.scss +++ b/assets/stylesheets/application.css.scss @@ -56,7 +56,6 @@ 'pages/go', 'pages/haskell', 'pages/jquery', - 'pages/jsdoc', 'pages/julia', 'pages/knockout', 'pages/kotlin', diff --git a/assets/stylesheets/components/_content.scss b/assets/stylesheets/components/_content.scss index 9b8e299a..18f2e51d 100644 --- a/assets/stylesheets/components/_content.scss +++ b/assets/stylesheets/components/_content.scss @@ -382,6 +382,8 @@ ._table { width: 100%; } ._mobile ._table { overflow-x: auto; } +._pre-heading { @extend %pre-heading; } + ._pre-clip { display: none; position: absolute; diff --git a/assets/stylesheets/global/_icons.scss b/assets/stylesheets/global/_icons.scss index b4b433f1..08dcc4dd 100644 --- a/assets/stylesheets/global/_icons.scss +++ b/assets/stylesheets/global/_icons.scss @@ -92,6 +92,7 @@ ._icon-nginx_lua_module:before { background-position: -4rem -5rem; } ._icon-svg:before { background-position: -5rem -5rem; } ._icon-marionette:before { background-position: -6rem -5rem; } +._icon-jsdoc:before, ._icon-mongoose:before { background-position: -7rem -5rem; } ._icon-phpunit:before { background-position: -8rem -5rem; } ._icon-nokogiri:before { background-position: -9rem -5rem; @extend %darkIconFix !optional; } diff --git a/assets/stylesheets/pages/_jsdoc.scss b/assets/stylesheets/pages/_jsdoc.scss deleted file mode 100644 index 05e83f1d..00000000 --- a/assets/stylesheets/pages/_jsdoc.scss +++ /dev/null @@ -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; - } -} diff --git a/lib/docs/filters/jsdoc/clean_html.rb b/lib/docs/filters/jsdoc/clean_html.rb index f61593e2..ce44598b 100644 --- a/lib/docs/filters/jsdoc/clean_html.rb +++ b/lib/docs/filters/jsdoc/clean_html.rb @@ -2,38 +2,21 @@ module Docs class Jsdoc class CleanHtmlFilter < Filter def call - css('h2').each do |node| - next unless node.content.strip == 'Table of Contents' - toc_ul = node.next_element - toc_block = node.add_next_sibling('').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 + at_css('h1').content = 'JSDoc' if root_page? css('.prettyprint').each do |node| - match = /lang-(\w+)/.match(node['class']) - next unless match - - lang = match[1] + node.content = node.content + node['data-language'] = node['class'][/lang-(\w+)/, 1] node.remove_attribute('class') - node['data-language'] = lang end - css('figure').each do |node| - caption = node.at_css 'figcaption' - next unless caption + css('figcaption').each do |node| + node.name = 'div' + node['class'] = '_pre-heading' + end - node.children.last.add_next_sibling(caption) + css('figure').each do |node| + node.before(node.children).remove end doc diff --git a/lib/docs/filters/jsdoc/entries.rb b/lib/docs/filters/jsdoc/entries.rb index 62170151..ea6fa84c 100644 --- a/lib/docs/filters/jsdoc/entries.rb +++ b/lib/docs/filters/jsdoc/entries.rb @@ -2,8 +2,11 @@ module Docs class Jsdoc class EntriesFilter < Docs::EntriesFilter def get_name - at_css('h1').content + name = at_css('h1').content + name.prepend 'JSDoc: ' if !name.include?('@') && !name.include?('JSDoc') + name end + def get_type case slug when /^about-/ @@ -17,7 +20,7 @@ module Docs when /^tags-/ 'Tags' 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 diff --git a/lib/docs/scrapers/jsdoc.rb b/lib/docs/scrapers/jsdoc.rb index de43eb4e..bb3781ca 100644 --- a/lib/docs/scrapers/jsdoc.rb +++ b/lib/docs/scrapers/jsdoc.rb @@ -1,9 +1,10 @@ module Docs class Jsdoc < UrlScraper self.name = 'JSDoc' - self.type = 'jsdoc' + self.type = 'simple' self.release = '3.5.5' self.base_url = 'http://usejsdoc.org/' + self.root_path = 'index.html' self.links = { home: 'http://usejsdoc.org/', code: 'https://github.com/jsdoc3/jsdoc' @@ -17,14 +18,8 @@ module Docs 'about-license-jsdoc3.html' ] options[:attribution] = <<-HTML - © 2011–2017 - - JSDoc 3 contributors -
- Licensed under - - CC BY-SA 3.0 - + © 2011–2017 the contributors to the JSDoc 3 documentation project
+ Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0. HTML end end diff --git a/public/icons/docs/jsdoc/16.png b/public/icons/docs/jsdoc/16.png deleted file mode 100644 index 6f1ad033fc675878a26f555b3d5ed3e2bb20c5df..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 246 zcmVFFHBu!2_DY>{fO7sT4hR@Oq1T~0gErQ_a-d&UygIdmA zoVvK=S-!&={+#bS91gxpp*_^GMH_2;{snM^2TX8`3!LJ-$QF%%k-n<#Aj0{b=O*c^%Vip!t7AA$%7z?ta5k;(QSecTQ&6NBBn(op$Uk&@~y$c!49hn!_jY7{}3tZ@8JUX((kphkIz?CHCgq3_gdQ_gH8)1Et*VJVvAY zjx*R0hZZ7NTHyfP2m@_HH962hTd;PCybD|KrJ&o6!Bj^NhOjjive-NJU?Zkiab_8Z zup3iF2Tq_5+maWrqaVZ=uHy|hqZeOsHWl&#BeB09yILyhSL7b7OVypiCG?gG4m5BW z`!in-jr52KJdbV~*KirbVR15jhocF>E&N=DS~!rK z?!dFGzkp+SkaZ2b!@kwz$!Yw~d^Vf@NNDclmi2_B9_nYqz5|7!YAH=ZQ6|3@FFVm;;xx>_imYlQ>FG8{<8 z4iz3I