Fix Marionette anchor links and improve readability

Fixes #235.
pull/229/merge
Thibaut 10 years ago
parent 7827f25c63
commit 066a0cf86a

@ -12,17 +12,21 @@ module Docs
end end
def other def other
css('#source + h2', '#improve', '#source', '.glyphicon').remove css('#source + h2', '#improve', '#source', '.glyphicon', 'p > br').remove
css('pre > code').each do |node| css('pre > code').each do |node|
node.before(node.children).remove node.before(node.children).remove
end end
css('h2', 'h3').each do |node| css('h2', 'h3').each do |node|
if anchor = node.at_css('a.anchor[name]')
id = anchor['name']
else
id = node.content.strip id = node.content.strip
id.downcase! id.downcase!
id.remove! %r{['"\/\.:]} id.remove! %r{['"\/\.:]}
id.gsub! %r{[\ _]}, '-' id.gsub! %r{[\ _]}, '-'
end
node['id'] = id node['id'] = id
end end
end end

Loading…
Cancel
Save