Finish webpack scraper

pull/229/merge
Thibaut 10 years ago
parent ba165ae8b4
commit f0cb4b69cf

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 76 KiB

After

Width:  |  Height:  |  Size: 78 KiB

@ -1,7 +1,7 @@
[ [
[ [
"2015-07-05", "2015-07-05",
"New documentation: <a href=\"/drupal/\">Drupal</a>" "New documentations: <a href=\"/drupal/\">Drupal</a> and <a href=\"/webpack/\">webpack</a>"
], [ ], [
"2015-05-24", "2015-05-24",
"New <a href=\"/rust/\">Rust</a> documentation" "New <a href=\"/rust/\">Rust</a> documentation"

@ -355,6 +355,11 @@ credits = [
'2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors', '2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors',
'MIT', 'MIT',
'https://raw.github.com/jashkenas/underscore/master/LICENSE' 'https://raw.github.com/jashkenas/underscore/master/LICENSE'
], [
'Webpack',
'2012-2015 Tobias Koppers',
'MIT',
'https://raw.githubusercontent.com/webpack/webpack/master/LICENSE'
], [ ], [
'Yii', 'Yii',
'2008-2015 by Yii Software LLC', '2008-2015 by Yii Software LLC',

@ -28,6 +28,7 @@ app.views.NodePage =
app.views.RethinkdbPage = app.views.RethinkdbPage =
app.views.SinonPage = app.views.SinonPage =
app.views.UnderscorePage = app.views.UnderscorePage =
app.views.WebpackPage =
app.views.JavascriptPage app.views.JavascriptPage
app.views.RequirejsPage = app.views.RequirejsPage =

@ -67,6 +67,5 @@
'pages/socketio', 'pages/socketio',
'pages/sphinx', 'pages/sphinx',
'pages/underscore', 'pages/underscore',
'pages/webpack',
'pages/yard', 'pages/yard',
'pages/yii'; 'pages/yii';

@ -68,5 +68,4 @@
'pages/sphinx', 'pages/sphinx',
'pages/underscore', 'pages/underscore',
'pages/yard', 'pages/yard',
'pages/webpack',
'pages/yii'; 'pages/yii';

@ -102,3 +102,4 @@
._icon-npm:before { background-position: -8rem -7rem; } ._icon-npm:before { background-position: -8rem -7rem; }
._icon-apache_http_server:before { background-position: -9rem -7rem; } ._icon-apache_http_server:before { background-position: -9rem -7rem; }
._icon-drupal:before { background-position: 0 -8rem; } ._icon-drupal:before { background-position: 0 -8rem; }
._icon-webpack:before { background-position: -1rem -8rem; @extend %darkIconFix !optional; }

@ -24,7 +24,8 @@
._markdown, ._markdown,
._mocha, ._mocha,
._mongoose, ._mongoose,
._sinon { ._sinon,
._webpack {
@extend %simple; @extend %simple;
} }

@ -1,55 +0,0 @@
._webpack {
> h2 { @extend %block-heading; }
> h3 { @extend %block-label, %label-blue; }
> h4 { font-size: 1em; }
/*
Copied from the original webpack css
https://webpack.github.io/docs/css/doc.css
*/
code .comment {
color: #998;
font-style: italic
}
code .keyword {
color: #333;
font-weight: 700
}
code .number {
color: #099
}
code .string {
color: #d14
}
code .tag {
color: navy;
font-weight: 400
}
code .attribute {
color: teal
}
code .regexp {
color: #009926
}
code .preprocessor {
color: #999;
font-weight: 700
}
code .deletion {
background: #fdd;
display: block
}
code .addition {
background: #dfd;
display: block
}
}

@ -14,32 +14,20 @@ module Docs
# in devdocs. # in devdocs.
hr_index = doc.children.find_index { |node| node.name == "hr" } hr_index = doc.children.find_index { |node| node.name == "hr" }
doc.children[0..hr_index].each(&:remove) doc.children[0..hr_index].each(&:remove)
# Add a page header :)
page_header_node = Nokogiri::XML::Node.new "h1", @doc
page_header_node.content = "Webpack"
@doc.children.first.add_previous_sibling page_header_node
end end
def other def other
# Re-create the header element # Re-create the header element
page_header = at_css("#wikititle").content.upcase at_css("#wiki").child.before("<h1>#{at_css("#wikititle").content}</h1>")
page_header_node = Nokogiri::XML::Node.new "h1", @doc
page_header_node.content = page_header
# Change the scope of the page
@doc = at_css("#wiki") @doc = at_css("#wiki")
# Add the page header css('.contents', 'a.anchor', 'hr').remove
@doc.children.first.add_previous_sibling page_header_node
# Remove the sidebar links in each page
css(".contents").remove
# Remove all anchors
css("a.anchor").remove
css('pre').each do |node|
node.content = node.content
end
end end
end end
end end

@ -2,7 +2,7 @@ module Docs
class Webpack class Webpack
class EntriesFilter < Docs::EntriesFilter class EntriesFilter < Docs::EntriesFilter
def get_name def get_name
entry_link.content.strip.titleize entry_link.content
end end
def get_type def get_type
@ -20,16 +20,6 @@ module Docs
current_type.children.first.content.strip.titleize current_type.children.first.content.strip.titleize
end end
def additional_entries
return [] unless root_page?
css('.sidebar a').each_with_object [] do |link, entries|
name = link.content.strip
entries << [name, link['href']]
end
end
private private
def entry_link def entry_link

@ -1,13 +1,20 @@
module Docs module Docs
class Webpack < UrlScraper class Webpack < UrlScraper
self.name = 'Webpack' self.name = 'webpack'
self.type = 'webpack' self.type = 'webpack'
self.version = '1.9' self.version = '1.10'
self.base_url = 'https://webpack.github.io/docs/' self.base_url = 'https://webpack.github.io/docs/'
self.root_path = 'index.html' self.links = {
home: 'https://webpack.github.io/',
code: 'https://github.com/webpack/webpack'
}
html_filters.push 'webpack/entries', 'webpack/clean_html' html_filters.push 'webpack/entries', 'webpack/clean_html', 'title'
options[:title] = false
options[:root_title] = 'webpack'
options[:skip] = %w(list-of-tutorials.html examples.html changelog.html ideas.html roadmap.html)
options[:attribution] = <<-HTML options[:attribution] = <<-HTML
&copy; 2012&ndash;2015 Tobias Koppers<br> &copy; 2012&ndash;2015 Tobias Koppers<br>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

After

Width:  |  Height:  |  Size: 579 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Loading…
Cancel
Save