Add XSLT to XPath doc

pull/382/head
Thibaut Courouble 9 years ago
parent a5ed27165a
commit 9b4f4c2ef4

@ -101,6 +101,7 @@
for slug in @settings.getDocs() when not @docs.findBy('slug', slug)
needsSaving = true
doc = @disabledDocs.findBy('slug', 'node~4_lts') if slug == 'node~4.2_lts'
doc = @disabledDocs.findBy('slug', 'xslt_xpath') if slug == 'xpath'
doc ||= @disabledDocs.findBy('slug_without_version', slug)
if doc
@disabledDocs.remove(doc)

@ -75,7 +75,7 @@
._icon-cordova:before { background-position: 0 -5rem; }
._icon-markdown:before { background-position: -1rem -5rem; @extend %darkIconFix !optional; }
._icon-django:before { background-position: -2rem -5rem; }
._icon-xpath:before { background-position: -3rem -5rem; }
._icon-xslt_xpath:before { background-position: -3rem -5rem; }
._icon-nginx:before,
._icon-nginx_lua_module:before { background-position: -4rem -5rem; }
._icon-svg:before { background-position: -5rem -5rem; }

@ -273,7 +273,8 @@ class App < Sinatra::Application
DOC_REDIRECTS = {
'iojs' => 'node',
'yii1' => 'yii~1.1',
'python2' => 'python~2.7'
'python2' => 'python~2.7',
'xpath' => 'xslt_xpath'
}
get %r{\A/([\w~\.]+)(\-[\w\-]+)?(/.*)?\z} do |doc, type, rest|

@ -9,7 +9,8 @@ module Docs
'.todo',
'.draftHeader',
'.hidden',
'.button.section-edit']
'.button.section-edit',
'hr']
def call
css(*REMOVE_NODES).remove

@ -1,22 +0,0 @@
module Docs
class Xpath
class EntriesFilter < Docs::EntriesFilter
def get_name
name = super
name.remove!('Axes.')
name << '()' if name.gsub!('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

@ -1,8 +1,8 @@
module Docs
class Xpath
class XsltXpath
class CleanHtmlFilter < Filter
def call
root_page? ? root : other
initial_page? ? root : other
doc
end

@ -0,0 +1,27 @@
module Docs
class XsltXpath
class EntriesFilter < Docs::EntriesFilter
def get_name
name = super
name.remove! 'XPath.'
name.remove! 'XSLT.'
name.remove! 'Axes.'
name.prepend 'xsl:' if slug =~ /\AXSLT\/[a-z]/
name << '()' if name.gsub!('Functions.', '')
name
end
def get_type
if slug =~ /\AXSLT\/[a-z]/
'XSLT Elements'
elsif slug.start_with?('XPath/Axes')
'XPath Axes'
elsif slug.start_with?('XPath/Functions')
'XPath Functions'
else
'Miscellaneous'
end
end
end
end
end

@ -1,16 +0,0 @@
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

@ -0,0 +1,21 @@
module Docs
class XsltXpath < Mdn
self.name = 'XSLT & XPath'
self.slug = 'xslt_xpath'
self.base_url = 'https://developer.mozilla.org/en-US/docs/Web'
self.root_path = '/XSLT'
self.initial_paths = %w(/XPath)
html_filters.push 'xslt_xpath/clean_html', 'xslt_xpath/entries', 'title'
options[:only_patterns] = [/\A\/XSLT/, /\A\/XPath/]
options[:fix_urls] = ->(url) do
url.sub! 'https://developer.mozilla.org/en/XPath', "#{XsltXpath.base_url}/XPath"
url.sub! 'https://developer.mozilla.org/en/XSLT', "#{XsltXpath.base_url}/XSLT"
url.sub! 'https://developer.mozilla.org/en-US/docs/XPath', "#{XsltXpath.base_url}/XPath"
url.sub! 'https://developer.mozilla.org/en-US/docs/XSLT', "#{XsltXpath.base_url}/XSLT"
url
end
end
end
Loading…
Cancel
Save