Unified · Split
| @@ -12,6 +12,7 @@ app.views.BootstrapPage = · 11 unmodified lines | ||
| 12 | 12 | app.views.CPage = |
| 13 | 13 | app.views.CakephpPage = |
| 14 | 14 | app.views.ChaiPage = |
| 15 | +app.views.CordovaPage = | |
| 15 | 16 | app.views.CrystalPage = |
| 16 | 17 | app.views.D3Page = |
| 17 | 18 | app.views.DrupalPage = |
| @@ -40,6 +40,7 @@ · 39 unmodified lines | ||
| 40 | 40 | 'pages/cakephp', |
| 41 | 41 | 'pages/clojure', |
| 42 | 42 | 'pages/coffeescript', |
| 43 | + 'pages/cordova', | |
| 43 | 44 | 'pages/crystal', |
| 44 | 45 | 'pages/d3', |
| 45 | 46 | 'pages/dojo', |
| @@ -40,6 +40,7 @@ · 39 unmodified lines | ||
| 40 | 40 | 'pages/cakephp', |
| 41 | 41 | 'pages/clojure', |
| 42 | 42 | 'pages/coffeescript', |
| 43 | + 'pages/cordova', | |
| 43 | 44 | 'pages/crystal', |
| 44 | 45 | 'pages/d3', |
| 45 | 46 | 'pages/dojo', |
| @@ -0,0 +1,9 @@ | ||
| 1 | +._cordova { | |
| 2 | + @extend %simple; | |
| 3 | + | |
| 4 | + .alert { @extend %note; } | |
| 5 | + | |
| 6 | + .compat .n { background: pink; } | |
| 7 | + .compat .y { background: lightgreen; } | |
| 8 | + .compat .p { background: khaki; } | |
| 9 | +} | |
| @@ -19,7 +19,6 @@ · 18 unmodified lines | ||
| 19 | 19 | |
| 20 | 20 | ._apache_pig, |
| 21 | 21 | ._chai, |
| 22 | −._cordova, | |
| 23 | 22 | ._docker, |
| 24 | 23 | ._gnu, |
| 25 | 24 | ._grunt, |
| @@ -2,21 +2,31 @@ module Docs · 1 unmodified line | ||
| 2 | 2 | class Cordova |
| 3 | 3 | class CleanHtmlFilter < Filter |
| 4 | 4 | def call |
| 5 | − if root_page? | |
| 6 | − css('h1').each { |node| node.name = 'h2' } | |
| 7 | − css('li > h2').each { |node| node.name = 'div' } | |
| 8 | − end | |
| 5 | + @doc = at_css('.page-content > div') | |
| 6 | + | |
| 7 | + at_css('h1').content = 'Apache Cordova' if root_page? | |
| 9 | 8 | |
| 10 | − css('hr').remove | |
| 9 | + css('hr', '.content-header', 'button').remove | |
| 11 | 10 | |
| 12 | − css('a[name]').each do |node| | |
| 13 | − node.parent['id'] = node['name'] | |
| 11 | + css('.home', '#page-toc-source', '.highlight', 'th h2').each do |node| | |
| 14 | 12 | node.before(node.children).remove |
| 15 | 13 | end |
| 16 | 14 | |
| 17 | − # Remove code highlighting | |
| 15 | + css('img[src*="travis-ci"]').each do |node| | |
| 16 | + node.ancestors('p').first.remove | |
| 17 | + end | |
| 18 | + | |
| 18 | 19 | css('pre').each do |node| |
| 19 | − node.content = node.content.remove(/^\ {4,5}/) | |
| 20 | + node['data-language'] = node.at_css('code')['data-lang'] | |
| 21 | + node.content = node.content.strip_heredoc | |
| 22 | + end | |
| 23 | + | |
| 24 | + css('> .alert + h1').each do |node| | |
| 25 | + node.previous_element.before(node) | |
| 26 | + end | |
| 27 | + | |
| 28 | + css('h1, h2, h3, h4, h5, h6').each do |node| | |
| 29 | + node['id'] = node.content.strip.parameterize | |
| 20 | 30 | end |
| 21 | 31 | |
| 22 | 32 | doc |
| @@ -2,16 +2,56 @@ module Docs · 1 unmodified line | ||
| 2 | 2 | class Cordova |
| 3 | 3 | class EntriesFilter < Docs::EntriesFilter |
| 4 | 4 | def get_name |
| 5 | − at_css('h1').content.remove(' Guide') | |
| 5 | + return 'CLI' if slug == 'reference/cordova-cli/index' | |
| 6 | + name = at_css('#page-toc-source h1').content.strip | |
| 7 | + name.remove! ' Guide' | |
| 8 | + name | |
| 6 | 9 | end |
| 7 | 10 | |
| 8 | 11 | def get_type |
| 9 | − if subpath.start_with?('guide/platforms') | |
| 10 | − name[/Amazon\ Fire\ OS|Android|BlackBerry|Firefox OS|iOS|Windows/] || 'Platform Guides' | |
| 11 | − elsif subpath.start_with?('cordova/events') | |
| 12 | − 'Events' | |
| 12 | + return 'Platforms' if subpath.include?('guide/platforms/') | |
| 13 | + return 'Plugins' if name.start_with?('cordova-plugin') | |
| 14 | + at_css('.site-toc .this-page').ancestors('li').last.at_css('span').content | |
| 15 | + end | |
| 16 | + | |
| 17 | + def additional_entries | |
| 18 | + case slug | |
| 19 | + when 'reference/cordova-cli/index' | |
| 20 | + css('#page-toc-source h2').each_with_object [] do |node, entries| | |
| 21 | + name = node.content.strip | |
| 22 | + id = name.parameterize | |
| 23 | + next unless name =~ /cordova .+ command/ | |
| 24 | + name.remove! ' command' | |
| 25 | + entries << [name, id, 'Reference: CLI'] | |
| 26 | + end | |
| 27 | + when 'config_ref/index' | |
| 28 | + namespace = '' | |
| 29 | + css('#page-toc-source > *').each_with_object [] do |node, entries| | |
| 30 | + case node.name | |
| 31 | + when 'h1' | |
| 32 | + name = node.content.strip | |
| 33 | + next unless name =~ /\A[a-z]+\z/ | |
| 34 | + entries << ["<#{name}>", name.parameterize, 'Reference: config.xml'] | |
| 35 | + when 'h2' | |
| 36 | + name = node.content.strip | |
| 37 | + next unless name =~ /\A[a-z]+\z/ | |
| 38 | + namespace = name | |
| 39 | + entries << ["<#{name}>", name.parameterize, 'Reference: config.xml'] | |
| 40 | + when 'h3' | |
| 41 | + name = node.content.strip | |
| 42 | + next unless name =~ /\A[a-z]+\z/ | |
| 43 | + entries << ["<#{namespace}> <#{name}>", name.parameterize, 'Reference: config.xml'] | |
| 44 | + end | |
| 45 | + end | |
| 46 | + when 'cordova/events/events' | |
| 47 | + css('#page-toc-source h2').each_with_object [] do |node, entries| | |
| 48 | + name = node.content.strip | |
| 49 | + id = name.parameterize | |
| 50 | + next unless name =~ /\A[a-z]+\z/ | |
| 51 | + entries << [name, id, 'Reference: events'] | |
| 52 | + end | |
| 13 | 53 | else |
| 14 | − 'Guides' | |
| 54 | + [] | |
| 15 | 55 | end |
| 16 | 56 | end |
| 17 | 57 | end |
| @@ -2,23 +2,34 @@ module Docs · 1 unmodified line | ||
| 2 | 2 | class Cordova < UrlScraper |
| 3 | 3 | self.name = 'Cordova' |
| 4 | 4 | self.type = 'cordova' |
| 5 | − self.release = '6.0.0' | |
| 6 | − self.base_url = "https://cordova.apache.org/docs/en/#{release}/" | |
| 7 | − self.root_path = 'index.html' | |
| 5 | + self.root_path = 'guide/overview/index.html' | |
| 8 | 6 | self.links = { |
| 9 | 7 | home: 'https://cordova.apache.org/' |
| 10 | 8 | } |
| 11 | 9 | |
| 12 | − html_filters.push 'cordova/clean_html', 'cordova/entries', 'title' | |
| 10 | + html_filters.push 'cordova/entries', 'cordova/clean_html' | |
| 13 | 11 | |
| 14 | − options[:container] = ->(filter) { filter.root_page? ? '#home' : '#page-toc-source' } | |
| 15 | − options[:title] = false | |
| 16 | − options[:root_title] = 'Apache Cordova' | |
| 17 | − options[:skip] = %w(page_index.html) | |
| 12 | + options[:container] = '.docs' | |
| 13 | + options[:skip] = %w(index.html) | |
| 14 | + | |
| 15 | + options[:fix_urls] = ->(url) do | |
| 16 | + if url.include?('https://cordova.apache.org/docs') && !url.end_with?('.html') | |
| 17 | + if url.end_with?('/') | |
| 18 | + url << 'index.html' | |
| 19 | + else | |
| 20 | + url << '/index.html' | |
| 21 | + end | |
| 22 | + end | |
| 23 | + end | |
| 18 | 24 | |
| 19 | 25 | options[:attribution] = <<-HTML |
| 20 | 26 | © 2012–2016 The Apache Software Foundation<br> |
| 21 | 27 | Licensed under the Apache License 2.0. |
| 22 | 28 | HTML |
| 29 | + | |
| 30 | + version '6' do | |
| 31 | + self.release = '6.3.1' | |
| 32 | + self.base_url = 'https://cordova.apache.org/docs/en/6.x/' | |
| 33 | + end | |
| 23 | 34 | end |
| 24 | 35 | end |