Showing the changes to lib/docs (3 of 15 files). Show all
Unified · Split
| @@ -1,5 +1,5 @@ | ||
| 1 | 1 | module Docs |
| 2 | − class Webpack | |
| 2 | + class Webpack | |
| 3 | 3 | class CleanHtmlFilter < Filter |
| 4 | 4 | def call |
| 5 | 5 | root_page? ? root : other |
| @@ -14,32 +14,20 @@ module Docs · 8 unmodified lines | ||
| 14 | 14 | # in devdocs. |
| 15 | 15 | hr_index = doc.children.find_index { |node| node.name == "hr" } |
| 16 | 16 | doc.children[0..hr_index].each(&:remove) |
| 17 | − | |
| 18 | − # Add a page header :) | |
| 19 | − page_header_node = Nokogiri::XML::Node.new "h1", @doc | |
| 20 | − page_header_node.content = "Webpack" | |
| 21 | − @doc.children.first.add_previous_sibling page_header_node | |
| 22 | 17 | end |
| 23 | 18 | |
| 24 | 19 | |
| 25 | 20 | def other |
| 26 | 21 | # Re-create the header element |
| 27 | − page_header = at_css("#wikititle").content.upcase | |
| 28 | − page_header_node = Nokogiri::XML::Node.new "h1", @doc | |
| 29 | − page_header_node.content = page_header | |
| 22 | + at_css("#wiki").child.before("<h1>#{at_css("#wikititle").content}</h1>") | |
| 30 | 23 | |
| 31 | − # Change the scope of the page | |
| 32 | 24 | @doc = at_css("#wiki") |
| 33 | 25 | |
| 34 | − # Add the page header | |
| 35 | − @doc.children.first.add_previous_sibling page_header_node | |
| 36 | − | |
| 37 | − # Remove the sidebar links in each page | |
| 38 | − css(".contents").remove | |
| 39 | − | |
| 40 | − # Remove all anchors | |
| 41 | − css("a.anchor").remove | |
| 26 | + css('.contents', 'a.anchor', 'hr').remove | |
| 42 | 27 | |
| 28 | + css('pre').each do |node| | |
| 29 | + node.content = node.content | |
| 30 | + end | |
| 43 | 31 | end |
| 44 | 32 | end |
| 45 | 33 | end |
| @@ -2,7 +2,7 @@ module Docs · 1 unmodified line | ||
| 2 | 2 | class Webpack |
| 3 | 3 | class EntriesFilter < Docs::EntriesFilter |
| 4 | 4 | def get_name |
| 5 | − entry_link.content.strip.titleize | |
| 5 | + entry_link.content | |
| 6 | 6 | end |
| 7 | 7 | |
| 8 | 8 | def get_type |
| @@ -10,7 +10,7 @@ module Docs · 1 unmodified line | ||
| 10 | 10 | type_links_list = link_li.parent |
| 11 | 11 | current_type = type_links_list.parent |
| 12 | 12 | |
| 13 | − # current type is a | |
| 13 | + # current type is a | |
| 14 | 14 | # <li> |
| 15 | 15 | # TYPE |
| 16 | 16 | # <li> <ul> .. links .. </ul> </li> |
| @@ -20,16 +20,6 @@ module Docs · 3 unmodified lines | ||
| 20 | 20 | current_type.children.first.content.strip.titleize |
| 21 | 21 | end |
| 22 | 22 | |
| 23 | − | |
| 24 | − def additional_entries | |
| 25 | − return [] unless root_page? | |
| 26 | − | |
| 27 | − css('.sidebar a').each_with_object [] do |link, entries| | |
| 28 | − name = link.content.strip | |
| 29 | − entries << [name, link['href']] | |
| 30 | − end | |
| 31 | − end | |
| 32 | − | |
| 33 | 23 | private |
| 34 | 24 | |
| 35 | 25 | def entry_link |
| @@ -1,13 +1,20 @@ | ||
| 1 | 1 | module Docs |
| 2 | 2 | class Webpack < UrlScraper |
| 3 | − self.name = 'Webpack' | |
| 3 | + self.name = 'webpack' | |
| 4 | 4 | self.type = 'webpack' |
| 5 | − self.version = '1.9' | |
| 5 | + self.version = '1.10' | |
| 6 | 6 | self.base_url = 'https://webpack.github.io/docs/' |
| 7 | − self.root_path = 'index.html' | |
| 7 | + self.links = { | |
| 8 | + home: 'https://webpack.github.io/', | |
| 9 | + code: 'https://github.com/webpack/webpack' | |
| 10 | + } | |
| 8 | 11 | |
| 9 | − html_filters.push 'webpack/entries', 'webpack/clean_html' | |
| 12 | + html_filters.push 'webpack/entries', 'webpack/clean_html', 'title' | |
| 10 | 13 | |
| 14 | + options[:title] = false | |
| 15 | + options[:root_title] = 'webpack' | |
| 16 | + | |
| 17 | + options[:skip] = %w(list-of-tutorials.html examples.html changelog.html ideas.html roadmap.html) | |
| 11 | 18 | |
| 12 | 19 | options[:attribution] = <<-HTML |
| 13 | 20 | © 2012–2015 Tobias Koppers<br> |