Unified · Split
| @@ -12,6 +12,7 @@ app.views.BootstrapPage = · 11 unmodified lines | |||
| 12 | app.views.CPage = | 12 | app.views.CPage = |
| 13 | app.views.CakephpPage = | 13 | app.views.CakephpPage = |
| 14 | app.views.ChaiPage = | 14 | app.views.ChaiPage = |
| 15 | app.views.CordovaPage = | ||
| 15 | app.views.CrystalPage = | 16 | app.views.CrystalPage = |
| 16 | app.views.D3Page = | 17 | app.views.D3Page = |
| 17 | app.views.DrupalPage = | 18 | app.views.DrupalPage = |
| @@ -40,6 +40,7 @@ · 39 unmodified lines | |||
| 40 | 'pages/cakephp', | 40 | 'pages/cakephp', |
| 41 | 'pages/clojure', | 41 | 'pages/clojure', |
| 42 | 'pages/coffeescript', | 42 | 'pages/coffeescript', |
| 43 | 'pages/cordova', | ||
| 43 | 'pages/crystal', | 44 | 'pages/crystal', |
| 44 | 'pages/d3', | 45 | 'pages/d3', |
| 45 | 'pages/dojo', | 46 | 'pages/dojo', |
| @@ -40,6 +40,7 @@ · 39 unmodified lines | |||
| 40 | 'pages/cakephp', | 40 | 'pages/cakephp', |
| 41 | 'pages/clojure', | 41 | 'pages/clojure', |
| 42 | 'pages/coffeescript', | 42 | 'pages/coffeescript', |
| 43 | 'pages/cordova', | ||
| 43 | 'pages/crystal', | 44 | 'pages/crystal', |
| 44 | 'pages/d3', | 45 | 'pages/d3', |
| 45 | 'pages/dojo', | 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 | ._apache_pig, | 20 | ._apache_pig, |
| 21 | ._chai, | 21 | ._chai, |
| 22 | ._cordova, | ||
| 23 | ._docker, | 22 | ._docker, |
| 24 | ._gnu, | 23 | ._gnu, |
| 25 | ._grunt, | 24 | ._grunt, |
| @@ -2,21 +2,31 @@ module Docs · 1 unmodified line | |||
| 2 | class Cordova | 2 | class Cordova |
| 3 | class CleanHtmlFilter < Filter | 3 | class CleanHtmlFilter < Filter |
| 4 | def call | 4 | def call |
| 5 | if root_page? | 5 | @doc = at_css('.page-content > div') |
| 6 | css('h1').each { |node| node.name = 'h2' } | 6 | |
| 7 | css('li > h2').each { |node| node.name = 'div' } | 7 | at_css('h1').content = 'Apache Cordova' if root_page? |
| 8 | end | ||
| 9 | 8 | ||
| 10 | css('hr').remove | 9 | css('hr', '.content-header', 'button').remove |
| 11 | 10 | ||
| 12 | css('a[name]').each do |node| | 11 | css('.home', '#page-toc-source', '.highlight', 'th h2').each do |node| |
| 13 | node.parent['id'] = node['name'] | ||
| 14 | node.before(node.children).remove | 12 | node.before(node.children).remove |
| 15 | end | 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 | css('pre').each do |node| | 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 | end | 30 | end |
| 21 | 31 | ||
| 22 | doc | 32 | doc |
| @@ -2,16 +2,56 @@ module Docs · 1 unmodified line | |||
| 2 | class Cordova | 2 | class Cordova |
| 3 | class EntriesFilter < Docs::EntriesFilter | 3 | class EntriesFilter < Docs::EntriesFilter |
| 4 | def get_name | 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 | end | 9 | end |
| 7 | 10 | ||
| 8 | def get_type | 11 | def get_type |
| 9 | if subpath.start_with?('guide/platforms') | 12 | return 'Platforms' if subpath.include?('guide/platforms/') |
| 10 | name[/Amazon\ Fire\ OS|Android|BlackBerry|Firefox OS|iOS|Windows/] || 'Platform Guides' | 13 | return 'Plugins' if name.start_with?('cordova-plugin') |
| 11 | elsif subpath.start_with?('cordova/events') | 14 | at_css('.site-toc .this-page').ancestors('li').last.at_css('span').content |
| 12 | 'Events' | 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 | else | 53 | else |
| 14 | 'Guides' | 54 | [] |
| 15 | end | 55 | end |
| 16 | end | 56 | end |
| 17 | end | 57 | end |
| @@ -2,23 +2,34 @@ module Docs · 1 unmodified line | |||
| 2 | class Cordova < UrlScraper | 2 | class Cordova < UrlScraper |
| 3 | self.name = 'Cordova' | 3 | self.name = 'Cordova' |
| 4 | self.type = 'cordova' | 4 | self.type = 'cordova' |
| 5 | self.release = '6.0.0' | 5 | self.root_path = 'guide/overview/index.html' |
| 6 | self.base_url = "https://cordova.apache.org/docs/en/#{release}/" | ||
| 7 | self.root_path = 'index.html' | ||
| 8 | self.links = { | 6 | self.links = { |
| 9 | home: 'https://cordova.apache.org/' | 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' } | 12 | options[:container] = '.docs' |
| 15 | options[:title] = false | 13 | options[:skip] = %w(index.html) |
| 16 | options[:root_title] = 'Apache Cordova' | 14 | |
| 17 | options[:skip] = %w(page_index.html) | 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 | options[:attribution] = <<-HTML | 25 | options[:attribution] = <<-HTML |
| 20 | © 2012–2016 The Apache Software Foundation<br> | 26 | © 2012–2016 The Apache Software Foundation<br> |
| 21 | Licensed under the Apache License 2.0. | 27 | Licensed under the Apache License 2.0. |
| 22 | HTML | 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 | end | 34 | end |
| 24 | end | 35 | end |