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",
"New documentation: <a href=\"/drupal/\">Drupal</a>"
"New documentations: <a href=\"/drupal/\">Drupal</a> and <a href=\"/webpack/\">webpack</a>"
], [
"2015-05-24",
"New <a href=\"/rust/\">Rust</a> documentation"

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

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

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

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

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

@ -24,7 +24,8 @@
._markdown,
._mocha,
._mongoose,
._sinon {
._sinon,
._webpack {
@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
}
}

@ -1,5 +1,5 @@
module Docs
class Webpack
class Webpack
class CleanHtmlFilter < Filter
def call
root_page? ? root : other
@ -14,32 +14,20 @@ module Docs
# in devdocs.
hr_index = doc.children.find_index { |node| node.name == "hr" }
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
def other
# Re-create the header element
page_header = at_css("#wikititle").content.upcase
page_header_node = Nokogiri::XML::Node.new "h1", @doc
page_header_node.content = page_header
at_css("#wiki").child.before("<h1>#{at_css("#wikititle").content}</h1>")
# Change the scope of the page
@doc = at_css("#wiki")
# Add the page header
@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('.contents', 'a.anchor', 'hr').remove
css('pre').each do |node|
node.content = node.content
end
end
end
end

@ -2,7 +2,7 @@ module Docs
class Webpack
class EntriesFilter < Docs::EntriesFilter
def get_name
entry_link.content.strip.titleize
entry_link.content
end
def get_type
@ -10,7 +10,7 @@ module Docs
type_links_list = link_li.parent
current_type = type_links_list.parent
# current type is a
# current type is a
# <li>
# TYPE
# <li> <ul> .. links .. </ul> </li>
@ -20,16 +20,6 @@ module Docs
current_type.children.first.content.strip.titleize
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
def entry_link

@ -1,13 +1,20 @@
module Docs
class Webpack < UrlScraper
self.name = 'Webpack'
self.name = 'webpack'
self.type = 'webpack'
self.version = '1.9'
self.version = '1.10'
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
&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