diff --git a/assets/images/icons.png b/assets/images/icons.png index 50c24465..3e34973d 100644 Binary files a/assets/images/icons.png and b/assets/images/icons.png differ diff --git a/assets/images/icons@2x.png b/assets/images/icons@2x.png index 29e3460d..2d72015f 100644 Binary files a/assets/images/icons@2x.png and b/assets/images/icons@2x.png differ diff --git a/assets/javascripts/templates/pages/about_tmpl.coffee b/assets/javascripts/templates/pages/about_tmpl.coffee index 437052ff..9c79c5c2 100644 --- a/assets/javascripts/templates/pages/about_tmpl.coffee +++ b/assets/javascripts/templates/pages/about_tmpl.coffee @@ -108,7 +108,7 @@ credits = [ 'Apache', 'https://raw.githubusercontent.com/apache/cordova-docs/master/LICENSE' ], [ - 'CSS
DOM
HTML
JavaScript', + 'CSS
DOM
HTML
JavaScript
XPath', '2005-2014 Mozilla Developer Network and individual contributors', 'CC BY-SA', 'http://creativecommons.org/licenses/by-sa/2.5/' diff --git a/assets/javascripts/templates/pages/news_tmpl.coffee b/assets/javascripts/templates/pages/news_tmpl.coffee index df89db6f..42e8dd1e 100644 --- a/assets/javascripts/templates/pages/news_tmpl.coffee +++ b/assets/javascripts/templates/pages/news_tmpl.coffee @@ -32,7 +32,10 @@ newsItem = (date, news) -> result app.news = [ - [ 1410048000000, # September 7, 2014 + [ 1413158400000, # October 13, 2014 + """ New XPath documentation """, + ], [ + 1410048000000, # September 7, 2014 """ Updated the HTML, CSS, JavaScript, and DOM documentations with additional content. """, ], [ 1407110400000, # August 4, 2014 diff --git a/assets/stylesheets/global/_icons.scss b/assets/stylesheets/global/_icons.scss index 69167033..293cdb3b 100644 --- a/assets/stylesheets/global/_icons.scss +++ b/assets/stylesheets/global/_icons.scss @@ -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; } diff --git a/lib/docs/filters/xpath/clean_html.rb b/lib/docs/filters/xpath/clean_html.rb new file mode 100644 index 00000000..6e3ee759 --- /dev/null +++ b/lib/docs/filters/xpath/clean_html.rb @@ -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 diff --git a/lib/docs/filters/xpath/entries.rb b/lib/docs/filters/xpath/entries.rb new file mode 100644 index 00000000..62728b63 --- /dev/null +++ b/lib/docs/filters/xpath/entries.rb @@ -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 diff --git a/lib/docs/scrapers/mdn/xpath.rb b/lib/docs/scrapers/mdn/xpath.rb new file mode 100644 index 00000000..fd2d486c --- /dev/null +++ b/lib/docs/scrapers/mdn/xpath.rb @@ -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 diff --git a/public/icons/docs/xpath/16.png b/public/icons/docs/xpath/16.png new file mode 100644 index 00000000..9f3e43f4 Binary files /dev/null and b/public/icons/docs/xpath/16.png differ diff --git a/public/icons/docs/xpath/16@2x.png b/public/icons/docs/xpath/16@2x.png new file mode 100644 index 00000000..e7a3b00e Binary files /dev/null and b/public/icons/docs/xpath/16@2x.png differ