diff --git a/assets/images/docs-2.png b/assets/images/docs-2.png index 6ef8e809..f60694b4 100644 Binary files a/assets/images/docs-2.png and b/assets/images/docs-2.png differ diff --git a/assets/images/docs-2@2x.png b/assets/images/docs-2@2x.png index e79cbd68..734e3147 100644 Binary files a/assets/images/docs-2@2x.png and b/assets/images/docs-2@2x.png differ diff --git a/assets/javascripts/news.json b/assets/javascripts/news.json index 17376fc0..b99986f7 100644 --- a/assets/javascripts/news.json +++ b/assets/javascripts/news.json @@ -1,7 +1,7 @@ [ [ "2017-11-26", - "New documentation: Bluebird" + "New documentations: Bluebird and ESLint" ], [ "2017-11-18", "Added print & PDF stylesheet.\nFeedback welcome on Twitter and GitHub." diff --git a/assets/javascripts/templates/pages/about_tmpl.coffee b/assets/javascripts/templates/pages/about_tmpl.coffee index 85cc62ea..9156cb82 100644 --- a/assets/javascripts/templates/pages/about_tmpl.coffee +++ b/assets/javascripts/templates/pages/about_tmpl.coffee @@ -247,6 +247,11 @@ credits = [ '2010-2017 Ericsson AB', 'Apache', 'https://raw.githubusercontent.com/erlang/otp/maint/LICENSE.txt' + ], [ + 'ESLint', + 'JS Foundation and other contributors', + 'MIT', + 'https://raw.githubusercontent.com/eslint/eslint/master/LICENSE' ], [ 'Express', '2017 StrongLoop, IBM, and other expressjs.com contributors.', diff --git a/assets/stylesheets/global/_icons.scss b/assets/stylesheets/global/_icons.scss index 0f8c2aed..26ed1cab 100644 --- a/assets/stylesheets/global/_icons.scss +++ b/assets/stylesheets/global/_icons.scss @@ -165,3 +165,4 @@ ._icon-vulkan:before { background-position: -6rem -2rem; @extend %doc-icon-2; @extend %darkIconFix !optional; } ._icon-d:before { background-position: -7rem -2rem; @extend %doc-icon-2; } ._icon-bluebird:before { background-position: -8rem -2rem; @extend %doc-icon-2; } +._icon-eslint:before { background-position: -9rem -2rem; @extend %doc-icon-2; } diff --git a/lib/docs/filters/eslint/clean_html.rb b/lib/docs/filters/eslint/clean_html.rb index b5225038..c87e1ab7 100644 --- a/lib/docs/filters/eslint/clean_html.rb +++ b/lib/docs/filters/eslint/clean_html.rb @@ -3,6 +3,24 @@ module Docs class CleanHtmlFilter < Filter def call @doc = at_css('.doc') if at_css('.doc') + + css('.glyphicon').remove + css('hr', 'colgroup', 'td:empty').remove + + css('.container').each do |node| + node.before(node.children).remove + end + + css('div.highlighter-rouge').each do |node| + lang = node['class'][/language-(\w+)/, 1] + node['data-language'] = lang if lang + node.content = node.content.strip + node.name = 'pre' + node.remove_attribute('class') + end + + css('code', 'p').remove_attr('class') + doc end end diff --git a/lib/docs/filters/eslint/entries.rb b/lib/docs/filters/eslint/entries.rb index c8451bf2..d231829c 100644 --- a/lib/docs/filters/eslint/entries.rb +++ b/lib/docs/filters/eslint/entries.rb @@ -2,24 +2,22 @@ module Docs class Eslint class EntriesFilter < Docs::EntriesFilter def get_name - at_css('h1').content + name = at_css('h1').content.strip + + if subpath.start_with?('rules/') && subpath != 'rules/' + name = name[/\(([\w\-]+?)\)\z/, 1] || name[/\A([\w\-]+?):/, 1] + end + + name end def get_type - if subpath.start_with?('docs/developer-guide/') - type = 'Developer Guide' - elsif subpath.start_with?('docs/user-guide/') - type = 'User Guide' - elsif subpath.start_with?('docs/rules') + if subpath.include?('guide') + type = 'Guide' + elsif subpath.start_with?('rules') type = 'Rules' - elsif subpath.start_with?('docs/about') - type = 'User Guide' - else - type = nil end - type end - end end end diff --git a/lib/docs/scrapers/eslint.rb b/lib/docs/scrapers/eslint.rb index d0a3f636..fffedc35 100644 --- a/lib/docs/scrapers/eslint.rb +++ b/lib/docs/scrapers/eslint.rb @@ -1,11 +1,10 @@ module Docs class Eslint < UrlScraper self.name = 'ESLint' - self.type = 'eslint' - self.release = '4.9.0' - self.base_url = 'https://eslint.org/' - self.root_path = 'docs/user-guide/getting-started' - + self.type = 'simple' + self.release = '4.12.0' + self.base_url = 'https://eslint.org/docs/' + self.root_path = 'user-guide/getting-started' self.links = { home: 'https://eslint.org/', code: 'https://github.com/eslint/eslint' @@ -13,12 +12,11 @@ module Docs html_filters.push 'eslint/entries', 'eslint/clean_html' - options[:container] = 'body' - - options[:skip_patterns] = [/\Ablog/, /\Ademo/, /\Aparser/, /formatters\//] + options[:skip_patterns] = [/developer-guide/, /maintainer-guide/] + options[:skip] = %w(about about/ rules) options[:attribution] = <<-HTML - © Copyright JS Foundation and other contributors, https://js.foundation/
+ © JS Foundation and other contributors
Licensed under the MIT License. HTML end diff --git a/public/icons/docs/eslint/16.png b/public/icons/docs/eslint/16.png index 10e1edb0..97d48c75 100644 Binary files a/public/icons/docs/eslint/16.png and b/public/icons/docs/eslint/16.png differ diff --git a/public/icons/docs/eslint/16@2x.png b/public/icons/docs/eslint/16@2x.png index 463fc610..04250f9d 100644 Binary files a/public/icons/docs/eslint/16@2x.png and b/public/icons/docs/eslint/16@2x.png differ diff --git a/public/icons/docs/eslint/SOURCE b/public/icons/docs/eslint/SOURCE new file mode 100644 index 00000000..39308027 --- /dev/null +++ b/public/icons/docs/eslint/SOURCE @@ -0,0 +1 @@ +https://github.com/eslint/eslint.github.io/tree/master/img diff --git a/public/icons/docs/eslint/SOURCE. b/public/icons/docs/eslint/SOURCE. deleted file mode 100644 index dd535a89..00000000 --- a/public/icons/docs/eslint/SOURCE. +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - -