Unified · Split
| @@ -2,48 +2,28 @@ module Docs · 1 unmodified line | ||
| 2 | 2 | class Webpack |
| 3 | 3 | class CleanHtmlFilter < Filter |
| 4 | 4 | def call |
| 5 | − @doc = at_css('.page__content') | |
| 6 | − | |
| 7 | 5 | at_css('h1').content = 'webpack' if root_page? |
| 8 | 6 | |
| 9 | − css('h3').each do |node| | |
| 10 | − node.name = 'h2' | |
| 11 | − end unless at_css('h2') | |
| 12 | − | |
| 13 | − css('.anchor[id]').each do |node| | |
| 14 | − node.parent['id'] = node['id'] | |
| 15 | − node.remove | |
| 16 | − end | |
| 17 | − | |
| 18 | 7 | css('hr', '.page__edit', 'hr + h3:contains("Contributors")', 'hr + h2:contains("Contributors")', |
| 19 | − '.contributors', '.icon-link', '#maintainers.header', '#maintainers.header + table', | |
| 20 | − '#maintainer.header', '#maintainer.header + table', '.page-links__link', '.page-links__gap').remove | |
| 8 | + 'td > .title', '.adjacent-links', '.contributors', '.icon-link', | |
| 9 | + '#maintainers', '#maintainers + table', | |
| 10 | + '#maintainer', '#maintainer + table', | |
| 11 | + '.page-links__link', '.page-links__gap').remove | |
| 21 | 12 | |
| 22 | 13 | css('> div', '.tip-content', '.header span').each do |node| |
| 23 | 14 | node.before(node.children).remove |
| 24 | 15 | end |
| 25 | 16 | |
| 26 | − css('> h1:first-child + h1').remove | |
| 27 | − | |
| 28 | − css('.code-details-summary-span').each do |node| | |
| 29 | − node.content = node.content.remove(' (click to show)') | |
| 30 | − end | |
| 31 | − | |
| 32 | − css('.table-wrap').each do |node| | |
| 33 | − css('.table-td-title').remove | |
| 34 | − css('.table-th').each { |n| n.name = 'th' } | |
| 35 | − css('.table-td').each { |n| n.name = 'td' } | |
| 36 | − css('.table-tr').each { |n| n.name = 'tr' } | |
| 37 | − css('.table-body').each { |n| n.name = 'tbody' } | |
| 38 | − css('.table-header').each { |n| n.name = 'thead' } | |
| 39 | − node.name = 'table' | |
| 40 | − end | |
| 41 | − | |
| 42 | 17 | css('pre > code').each do |node| |
| 43 | − node.parent['data-language'] = node['class'][/lang-(\w+)/, 1].sub('jsx', 'js') if node['class'] | |
| 18 | + node.parent['data-language'] = 'js' | |
| 19 | + node.parent['data-language'] = node['class'][/language-(\w+)/, 1].sub('jsx', 'js') if node['class'] && node['class'][/language-(\w+)/, 1] | |
| 44 | 20 | node.parent.content = node.parent.content |
| 45 | 21 | end |
| 46 | 22 | |
| 23 | + # for webpack-contrib /loaders and /plugins | |
| 24 | + shields = at_css('img[src*="shields.io"]') | |
| 25 | + shields.ancestors('p')[0].remove if shields | |
| 26 | + | |
| 47 | 27 | doc |
| 48 | 28 | end |
| 49 | 29 | end |
| @@ -3,49 +3,46 @@ module Docs · 2 unmodified lines | ||
| 3 | 3 | self.name = 'webpack' |
| 4 | 4 | self.type = 'webpack' |
| 5 | 5 | |
| 6 | − version do | |
| 7 | − self.release = '4.16.5' | |
| 8 | − self.base_url = 'https://webpack.js.org/' | |
| 9 | − self.root_path = 'guides/' | |
| 10 | − self.initial_paths = %w( | |
| 11 | − concepts/ | |
| 12 | − guides/ | |
| 13 | − api/ | |
| 14 | − configuration/ | |
| 15 | − loaders/ | |
| 16 | − plugins/ | |
| 17 | − ) | |
| 18 | − self.links = { | |
| 19 | − home: 'https://webpack.js.org/', | |
| 20 | − code: 'https://github.com/webpack/webpack' | |
| 21 | − } | |
| 6 | + self.root_path = 'guides/' | |
| 7 | + self.initial_paths = %w( | |
| 8 | + concepts/ | |
| 9 | + guides/ | |
| 10 | + api/ | |
| 11 | + configuration/ | |
| 12 | + loaders/ | |
| 13 | + plugins/ | |
| 14 | + ) | |
| 15 | + self.links = { | |
| 16 | + home: 'https://webpack.js.org/', | |
| 17 | + code: 'https://github.com/webpack/webpack' | |
| 18 | + } | |
| 22 | 19 | |
| 23 | − html_filters.push 'webpack/clean_html', 'webpack/entries' | |
| 20 | + html_filters.push 'webpack/clean_html', 'webpack/entries' | |
| 24 | 21 | |
| 25 | − options[:container] = '.page' | |
| 26 | − options[:trailing_slash] = false | |
| 27 | − options[:only_patterns] = [ | |
| 28 | − /\Aconcepts\//, | |
| 29 | − /\Aguides\//, | |
| 30 | − /\Aapi\//, | |
| 31 | − /\Aconfiguration\//, | |
| 32 | − /\Aloaders\//, | |
| 33 | − /\Aplugins\// | |
| 34 | − ] | |
| 22 | + options[:container] = '.page' | |
| 23 | + options[:trailing_slash] = false | |
| 24 | + options[:only_patterns] = [ | |
| 25 | + /\Aconcepts\//, | |
| 26 | + /\Aguides\//, | |
| 27 | + /\Aapi\//, | |
| 28 | + /\Aconfiguration\//, | |
| 29 | + /\Aloaders\//, | |
| 30 | + /\Aplugins\// | |
| 31 | + ] | |
| 35 | 32 | |
| 36 | − options[:attribution] = <<-HTML | |
| 37 | − © JS Foundation and other contributors<br> | |
| 38 | − Licensed under the Creative Commons Attribution License 4.0. | |
| 39 | − HTML | |
| 33 | + options[:attribution] = <<-HTML | |
| 34 | + © JS Foundation and other contributors<br> | |
| 35 | + Licensed under the Creative Commons Attribution License 4.0. | |
| 36 | + HTML | |
| 37 | + | |
| 38 | + version '5' do | |
| 39 | + self.release = '5.6.0' | |
| 40 | + self.base_url = 'https://webpack.js.org/' | |
| 41 | + end | |
| 40 | 42 | |
| 41 | − ([self.root_path] + self.initial_paths).each do |path| | |
| 42 | − stub(path) do | |
| 43 | − capybara = load_capybara_selenium | |
| 44 | − capybara.app_host = self.base_url.origin | |
| 45 | − capybara.visit("#{self.base_url}#{path}") | |
| 46 | − capybara.execute_script('return document.body.innerHTML') | |
| 47 | − end | |
| 48 | − end | |
| 43 | + version '4' do | |
| 44 | + self.release = '4.44.2' | |
| 45 | + self.base_url = 'https://v4.webpack.js.org/' | |
| 49 | 46 | end |
| 50 | 47 | |
| 51 | 48 | version '1' do |