Update Cordova documentation (6.3.1)

pull/481/head
Thibaut Courouble 9 years ago
parent 0ebd9fac8e
commit 818fa97bb0

@ -12,6 +12,7 @@ app.views.BootstrapPage =
app.views.CPage = app.views.CPage =
app.views.CakephpPage = app.views.CakephpPage =
app.views.ChaiPage = app.views.ChaiPage =
app.views.CordovaPage =
app.views.CrystalPage = app.views.CrystalPage =
app.views.D3Page = app.views.D3Page =
app.views.DrupalPage = app.views.DrupalPage =

@ -40,6 +40,7 @@
'pages/cakephp', 'pages/cakephp',
'pages/clojure', 'pages/clojure',
'pages/coffeescript', 'pages/coffeescript',
'pages/cordova',
'pages/crystal', 'pages/crystal',
'pages/d3', 'pages/d3',
'pages/dojo', 'pages/dojo',

@ -40,6 +40,7 @@
'pages/cakephp', 'pages/cakephp',
'pages/clojure', 'pages/clojure',
'pages/coffeescript', 'pages/coffeescript',
'pages/cordova',
'pages/crystal', 'pages/crystal',
'pages/d3', 'pages/d3',
'pages/dojo', 'pages/dojo',

@ -0,0 +1,9 @@
._cordova {
@extend %simple;
.alert { @extend %note; }
.compat .n { background: pink; }
.compat .y { background: lightgreen; }
.compat .p { background: khaki; }
}

@ -19,7 +19,6 @@
._apache_pig, ._apache_pig,
._chai, ._chai,
._cordova,
._docker, ._docker,
._gnu, ._gnu,
._grunt, ._grunt,

@ -2,21 +2,31 @@ module Docs
class Cordova class Cordova
class CleanHtmlFilter < Filter class CleanHtmlFilter < Filter
def call def call
if root_page? @doc = at_css('.page-content > div')
css('h1').each { |node| node.name = 'h2' }
css('li > h2').each { |node| node.name = 'div' } at_css('h1').content = 'Apache Cordova' if root_page?
end
css('hr').remove css('hr', '.content-header', 'button').remove
css('a[name]').each do |node| css('.home', '#page-toc-source', '.highlight', 'th h2').each do |node|
node.parent['id'] = node['name']
node.before(node.children).remove node.before(node.children).remove
end end
# Remove code highlighting css('img[src*="travis-ci"]').each do |node|
node.ancestors('p').first.remove
end
css('pre').each do |node| css('pre').each do |node|
node.content = node.content.remove(/^\ {4,5}/) node['data-language'] = node.at_css('code')['data-lang']
node.content = node.content.strip_heredoc
end
css('> .alert + h1').each do |node|
node.previous_element.before(node)
end
css('h1, h2, h3, h4, h5, h6').each do |node|
node['id'] = node.content.strip.parameterize
end end
doc doc

@ -2,16 +2,56 @@ module Docs
class Cordova class Cordova
class EntriesFilter < Docs::EntriesFilter class EntriesFilter < Docs::EntriesFilter
def get_name def get_name
at_css('h1').content.remove(' Guide') return 'CLI' if slug == 'reference/cordova-cli/index'
name = at_css('#page-toc-source h1').content.strip
name.remove! ' Guide'
name
end end
def get_type def get_type
if subpath.start_with?('guide/platforms') return 'Platforms' if subpath.include?('guide/platforms/')
name[/Amazon\ Fire\ OS|Android|BlackBerry|Firefox OS|iOS|Windows/] || 'Platform Guides' return 'Plugins' if name.start_with?('cordova-plugin')
elsif subpath.start_with?('cordova/events') at_css('.site-toc .this-page').ancestors('li').last.at_css('span').content
'Events' end
def additional_entries
case slug
when 'reference/cordova-cli/index'
css('#page-toc-source h2').each_with_object [] do |node, entries|
name = node.content.strip
id = name.parameterize
next unless name =~ /cordova .+ command/
name.remove! ' command'
entries << [name, id, 'Reference: CLI']
end
when 'config_ref/index'
namespace = ''
css('#page-toc-source > *').each_with_object [] do |node, entries|
case node.name
when 'h1'
name = node.content.strip
next unless name =~ /\A[a-z]+\z/
entries << ["<#{name}>", name.parameterize, 'Reference: config.xml']
when 'h2'
name = node.content.strip
next unless name =~ /\A[a-z]+\z/
namespace = name
entries << ["<#{name}>", name.parameterize, 'Reference: config.xml']
when 'h3'
name = node.content.strip
next unless name =~ /\A[a-z]+\z/
entries << ["<#{namespace}> <#{name}>", name.parameterize, 'Reference: config.xml']
end
end
when 'cordova/events/events'
css('#page-toc-source h2').each_with_object [] do |node, entries|
name = node.content.strip
id = name.parameterize
next unless name =~ /\A[a-z]+\z/
entries << [name, id, 'Reference: events']
end
else else
'Guides' []
end end
end end
end end

@ -2,23 +2,34 @@ module Docs
class Cordova < UrlScraper class Cordova < UrlScraper
self.name = 'Cordova' self.name = 'Cordova'
self.type = 'cordova' self.type = 'cordova'
self.release = '6.0.0' self.root_path = 'guide/overview/index.html'
self.base_url = "https://cordova.apache.org/docs/en/#{release}/"
self.root_path = 'index.html'
self.links = { self.links = {
home: 'https://cordova.apache.org/' home: 'https://cordova.apache.org/'
} }
html_filters.push 'cordova/clean_html', 'cordova/entries', 'title' html_filters.push 'cordova/entries', 'cordova/clean_html'
options[:container] = ->(filter) { filter.root_page? ? '#home' : '#page-toc-source' } options[:container] = '.docs'
options[:title] = false options[:skip] = %w(index.html)
options[:root_title] = 'Apache Cordova'
options[:skip] = %w(page_index.html) options[:fix_urls] = ->(url) do
if url.include?('https://cordova.apache.org/docs') && !url.end_with?('.html')
if url.end_with?('/')
url << 'index.html'
else
url << '/index.html'
end
end
end
options[:attribution] = <<-HTML options[:attribution] = <<-HTML
&copy; 2012&ndash;2016 The Apache Software Foundation<br> &copy; 2012&ndash;2016 The Apache Software Foundation<br>
Licensed under the Apache License 2.0. Licensed under the Apache License 2.0.
HTML HTML
version '6' do
self.release = '6.3.1'
self.base_url = 'https://cordova.apache.org/docs/en/6.x/'
end
end end
end end

Loading…
Cancel
Save