|
|
@ -2,21 +2,40 @@ module Docs
|
|
|
|
class Yarn
|
|
|
|
class Yarn
|
|
|
|
class CleanHtmlBerryFilter < Filter
|
|
|
|
class CleanHtmlBerryFilter < Filter
|
|
|
|
def call
|
|
|
|
def call
|
|
|
|
# Version notice
|
|
|
|
if slug.empty?
|
|
|
|
css('#gatsby-focus-wrapper > div').remove
|
|
|
|
@doc = at_css('main')
|
|
|
|
|
|
|
|
css(
|
|
|
|
|
|
|
|
(['div:first-child'] * 3).join('>'), # Tagline
|
|
|
|
|
|
|
|
'img',
|
|
|
|
|
|
|
|
'hr', # Footer
|
|
|
|
|
|
|
|
'hr + div', # Footer
|
|
|
|
|
|
|
|
).remove
|
|
|
|
|
|
|
|
|
|
|
|
# Logo and menu
|
|
|
|
css('a').each do |link|
|
|
|
|
css('header > div:first-child').remove
|
|
|
|
link.name = 'div'
|
|
|
|
|
|
|
|
link.css('h3').each do |node|
|
|
|
|
|
|
|
|
node.replace("<h2><a href='#{link['href']}'>#{node.content}</a></h2>")
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
# Left nav and TOC
|
|
|
|
return doc
|
|
|
|
css('main > div > div:first-child', 'aside').remove
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
# Title and edit link
|
|
|
|
@doc = at_css('article')
|
|
|
|
css('article > div:first-child').remove
|
|
|
|
# Heading & edit link
|
|
|
|
|
|
|
|
css('h1', 'h1 + a').remove unless slug.start_with?('configuration')
|
|
|
|
|
|
|
|
|
|
|
|
# Bottom divider on index
|
|
|
|
if slug.start_with?('cli')
|
|
|
|
if slug == ''
|
|
|
|
css('.header-code').each do |node|
|
|
|
|
css('main > hr').remove
|
|
|
|
node.name = 'span'
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if slug.start_with?('configuration')
|
|
|
|
|
|
|
|
css('h1', 'h2').each do |node|
|
|
|
|
|
|
|
|
node.name = node.name.sub(/\d/) { |i| i.to_i + 1 }
|
|
|
|
|
|
|
|
node.remove_attribute('style')
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
doc
|
|
|
|
doc
|
|
|
|