Add XPath documentation

pull/129/head
Thibaut 10 years ago
parent eabd270a94
commit 7cade1d4fc

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 55 KiB

After

Width:  |  Height:  |  Size: 56 KiB

@ -108,7 +108,7 @@ credits = [
'Apache',
'https://raw.githubusercontent.com/apache/cordova-docs/master/LICENSE'
], [
'CSS<br>DOM<br>HTML<br>JavaScript',
'CSS<br>DOM<br>HTML<br>JavaScript<br>XPath',
'2005-2014 Mozilla Developer Network and individual contributors',
'CC BY-SA',
'http://creativecommons.org/licenses/by-sa/2.5/'

@ -32,7 +32,10 @@ newsItem = (date, news) ->
result
app.news = [
[ 1410048000000, # September 7, 2014
[ 1413158400000, # October 13, 2014
""" New <a href="/xpath/">XPath</a> documentation """,
], [
1410048000000, # September 7, 2014
""" Updated the HTML, CSS, JavaScript, and DOM documentations with additional content. """,
], [
1407110400000, # August 4, 2014

@ -64,3 +64,4 @@
._icon-cordova:before { background-position: 0 -10rem; }
._icon-markdown:before { background-position: -1rem -10rem; }
._icon-django:before { background-position: -2rem -10rem; }
._icon-xpath:before { background-position: -3rem -10rem; }

@ -0,0 +1,30 @@
module Docs
class Xpath
class CleanHtmlFilter < Filter
def call
root_page? ? root : other
doc
end
def root
if table = at_css('.topicpage-table')
table.after(table.css('td').children).remove
end
end
def other
css('div[style*="background: #f5f5f5;"]').remove
css('h3[id]').each do |node|
node.name = 'h2'
end
css('p').each do |node|
child = node.child
child = child.next while child && child.text? && child.content.blank?
child.remove if child.try(:name) == 'br'
end
end
end
end
end

@ -0,0 +1,22 @@
module Docs
class Xpath
class EntriesFilter < Docs::EntriesFilter
def get_name
name = super
name.remove!('Axes.')
name << '()' if name.remove!('Functions.')
name
end
def get_type
if slug.start_with?('Axes')
'Axes'
elsif slug.start_with?('Functions')
'Functions'
else
'Miscellaneous'
end
end
end
end
end

@ -0,0 +1,16 @@
module Docs
class Xpath < Mdn
self.name = 'XPath'
self.base_url = 'https://developer.mozilla.org/en-US/docs/Web/XPath'
html_filters.push 'xpath/clean_html', 'xpath/entries', 'title'
options[:root_title] = 'XPath'
options[:fix_urls] = ->(url) do
url.sub! 'https://developer.mozilla.org/en/XPath', Xpath.base_url
url.sub! 'https://developer.mozilla.org/en-US/docs/XPath', Xpath.base_url
url
end
end
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 324 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 659 B

Loading…
Cancel
Save