Finish ESLint scraper

This commit is contained in:
Thibaut Courouble 2017-11-26 18:31:40 -05:00
parent 9fdaf078bd
commit 66d3228f76
12 changed files with 43 additions and 39 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 37 KiB

View file

@ -1,7 +1,7 @@
[
[
"2017-11-26",
"New documentation: <a href=\"/bluebird/\">Bluebird</a>"
"New documentations: <a href=\"/bluebird/\">Bluebird</a> and <a href=\"/eslint/\">ESLint</a>"
], [
"2017-11-18",
"Added print & PDF stylesheet.\nFeedback welcome on <a href=\"https://twitter.com/DevDocs\" target=\"_blank\" rel=\"noopener\">Twitter</a> and <a href=\"https://github.com/Thibaut/devdocs\" target=\"_blank\" rel=\"noopener\">GitHub</a>."

View file

@ -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.',

View file

@ -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; }

View file

@ -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

View file

@ -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

View file

@ -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
&copy; Copyright JS Foundation and other contributors, https://js.foundation/<br>
&copy; JS Foundation and other contributors<br>
Licensed under the MIT License.
HTML
end

Binary file not shown.

Before

Width:  |  Height:  |  Size: 505 B

After

Width:  |  Height:  |  Size: 330 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 747 B

View file

@ -0,0 +1 @@
https://github.com/eslint/eslint.github.io/tree/master/img

View file

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 15.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 294.825 258.982"
xml:space="preserve">
<g>
<path fill="#8080F2" d="M97.021,99.016l48.432-27.962c1.212-0.7,2.706-0.7,3.918,0l48.433,27.962
c1.211,0.7,1.959,1.993,1.959,3.393v55.924c0,1.399-0.748,2.693-1.959,3.394l-48.433,27.962c-1.212,0.7-2.706,0.7-3.918,0
l-48.432-27.962c-1.212-0.7-1.959-1.994-1.959-3.394v-55.924C95.063,101.009,95.81,99.716,97.021,99.016"/>
<path fill="#4B32C3" d="M273.336,124.488L215.469,23.816c-2.102-3.64-5.985-6.325-10.188-6.325H89.545
c-4.204,0-8.088,2.685-10.19,6.325l-57.867,100.45c-2.102,3.641-2.102,8.236,0,11.877l57.867,99.847
c2.102,3.64,5.986,5.501,10.19,5.501h115.735c4.203,0,8.087-1.805,10.188-5.446l57.867-100.01
C275.439,132.396,275.439,128.128,273.336,124.488 M225.419,172.898c0,1.48-0.891,2.849-2.174,3.59l-73.71,42.527
c-1.282,0.74-2.888,0.74-4.17,0l-73.767-42.527c-1.282-0.741-2.179-2.109-2.179-3.59V87.843c0-1.481,0.884-2.849,2.167-3.59
l73.707-42.527c1.282-0.741,2.886-0.741,4.168,0l73.772,42.527c1.283,0.741,2.186,2.109,2.186,3.59V172.898z"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 1.3 KiB