Showing the changes to lib/docs (6 of 9 files). Show all
Unified · Split
| @@ -9,7 +9,8 @@ module Docs · 8 unmodified lines | |||
| 9 | '.todo', | 9 | '.todo', |
| 10 | '.draftHeader', | 10 | '.draftHeader', |
| 11 | '.hidden', | 11 | '.hidden', |
| 12 | '.button.section-edit'] | 12 | '.button.section-edit', |
| 13 | 'hr'] | ||
| 13 | 14 | ||
| 14 | def call | 15 | def call |
| 15 | css(*REMOVE_NODES).remove | 16 | css(*REMOVE_NODES).remove |
| @@ -1,22 +0,0 @@ | |||
| 1 | module Docs | ||
| 2 | class Xpath | ||
| 3 | class EntriesFilter < Docs::EntriesFilter | ||
| 4 | def get_name | ||
| 5 | name = super | ||
| 6 | name.remove!('Axes.') | ||
| 7 | name << '()' if name.gsub!('Functions.', '') | ||
| 8 | name | ||
| 9 | end | ||
| 10 | |||
| 11 | def get_type | ||
| 12 | if slug.start_with?('Axes') | ||
| 13 | 'Axes' | ||
| 14 | elsif slug.start_with?('Functions') | ||
| 15 | 'Functions' | ||
| 16 | else | ||
| 17 | 'Miscellaneous' | ||
| 18 | end | ||
| 19 | end | ||
| 20 | end | ||
| 21 | end | ||
| 22 | end | ||
| @@ -1,8 +1,8 @@ | |||
| 1 | module Docs | 1 | module Docs |
| 2 | class Xpath | 2 | class XsltXpath |
| 3 | class CleanHtmlFilter < Filter | 3 | class CleanHtmlFilter < Filter |
| 4 | def call | 4 | def call |
| 5 | root_page? ? root : other | 5 | initial_page? ? root : other |
| 6 | doc | 6 | doc |
| 7 | end | 7 | end |
| 8 | 8 | ||
| @@ -0,0 +1,27 @@ | |||
| 1 | module Docs | ||
| 2 | class XsltXpath | ||
| 3 | class EntriesFilter < Docs::EntriesFilter | ||
| 4 | def get_name | ||
| 5 | name = super | ||
| 6 | name.remove! 'XPath.' | ||
| 7 | name.remove! 'XSLT.' | ||
| 8 | name.remove! 'Axes.' | ||
| 9 | name.prepend 'xsl:' if slug =~ /\AXSLT\/[a-z]/ | ||
| 10 | name << '()' if name.gsub!('Functions.', '') | ||
| 11 | name | ||
| 12 | end | ||
| 13 | |||
| 14 | def get_type | ||
| 15 | if slug =~ /\AXSLT\/[a-z]/ | ||
| 16 | 'XSLT Elements' | ||
| 17 | elsif slug.start_with?('XPath/Axes') | ||
| 18 | 'XPath Axes' | ||
| 19 | elsif slug.start_with?('XPath/Functions') | ||
| 20 | 'XPath Functions' | ||
| 21 | else | ||
| 22 | 'Miscellaneous' | ||
| 23 | end | ||
| 24 | end | ||
| 25 | end | ||
| 26 | end | ||
| 27 | end | ||
| @@ -1,16 +0,0 @@ | |||
| 1 | module Docs | ||
| 2 | class Xpath < Mdn | ||
| 3 | self.name = 'XPath' | ||
| 4 | self.base_url = 'https://developer.mozilla.org/en-US/docs/Web/XPath' | ||
| 5 | |||
| 6 | html_filters.push 'xpath/clean_html', 'xpath/entries', 'title' | ||
| 7 | |||
| 8 | options[:root_title] = 'XPath' | ||
| 9 | |||
| 10 | options[:fix_urls] = ->(url) do | ||
| 11 | url.sub! 'https://developer.mozilla.org/en/XPath', Xpath.base_url | ||
| 12 | url.sub! 'https://developer.mozilla.org/en-US/docs/XPath', Xpath.base_url | ||
| 13 | url | ||
| 14 | end | ||
| 15 | end | ||
| 16 | end | ||
| @@ -0,0 +1,21 @@ | |||
| 1 | module Docs | ||
| 2 | class XsltXpath < Mdn | ||
| 3 | self.name = 'XSLT & XPath' | ||
| 4 | self.slug = 'xslt_xpath' | ||
| 5 | self.base_url = 'https://developer.mozilla.org/en-US/docs/Web' | ||
| 6 | self.root_path = '/XSLT' | ||
| 7 | self.initial_paths = %w(/XPath) | ||
| 8 | |||
| 9 | html_filters.push 'xslt_xpath/clean_html', 'xslt_xpath/entries', 'title' | ||
| 10 | |||
| 11 | options[:only_patterns] = [/\A\/XSLT/, /\A\/XPath/] | ||
| 12 | |||
| 13 | options[:fix_urls] = ->(url) do | ||
| 14 | url.sub! 'https://developer.mozilla.org/en/XPath', "#{XsltXpath.base_url}/XPath" | ||
| 15 | url.sub! 'https://developer.mozilla.org/en/XSLT', "#{XsltXpath.base_url}/XSLT" | ||
| 16 | url.sub! 'https://developer.mozilla.org/en-US/docs/XPath', "#{XsltXpath.base_url}/XPath" | ||
| 17 | url.sub! 'https://developer.mozilla.org/en-US/docs/XSLT', "#{XsltXpath.base_url}/XSLT" | ||
| 18 | url | ||
| 19 | end | ||
| 20 | end | ||
| 21 | end | ||