|
|
|
@ -4,28 +4,12 @@ module Docs
|
|
|
|
|
def call
|
|
|
|
|
css('hr', '.showcode', '.sourcecode').remove
|
|
|
|
|
|
|
|
|
|
if slug == 'api'
|
|
|
|
|
at_css('.controls').after('<h1>Mongoose API</h1>')
|
|
|
|
|
|
|
|
|
|
css('.private', '.controls').remove
|
|
|
|
|
|
|
|
|
|
css('a + .method').each do |node|
|
|
|
|
|
node.previous_element.replace("<h2>#{node.previous_element.to_html}</h2>")
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
css('h2:empty + p').each do |node| # /customschematypes.html
|
|
|
|
|
node.previous_element.content = node.content
|
|
|
|
|
node.remove
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
at_css('h2').name = 'h1'
|
|
|
|
|
|
|
|
|
|
css('h3').each do |node|
|
|
|
|
|
node.name = 'h2'
|
|
|
|
|
end
|
|
|
|
|
css('h2:empty + p').each do |node| # /customschematypes.html
|
|
|
|
|
node.previous_element.content = node.content
|
|
|
|
|
node.remove
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
css('pre > code', 'h1 + ul', '.module', '.item', 'h3 > a', 'h3 code').each do |node|
|
|
|
|
|
css('pre > code', 'h1 + ul', '.module', '.item', 'h1 > a', 'h2 > a', 'h3 > a', 'h3 code').each do |node|
|
|
|
|
|
node.before(node.children).remove
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
@ -33,6 +17,21 @@ module Docs
|
|
|
|
|
node['data-language'] = 'javascript'
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
css('.native-inline', '.api-nav', '.toc', '.api-content ul:first-child').remove
|
|
|
|
|
|
|
|
|
|
if !at_css('h1')
|
|
|
|
|
if css('h2').count > 1
|
|
|
|
|
# Mongoose vX.Y.Z: [title here]
|
|
|
|
|
title = doc.document.at_css('title').content.split(': ')[1]
|
|
|
|
|
doc.prepend_child("<h1>#{title}</title>")
|
|
|
|
|
else
|
|
|
|
|
at_css('h2').name = 'h1'
|
|
|
|
|
css('h3').each do |el|
|
|
|
|
|
el.name = 'h2'
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
doc
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|