|
|
@ -2,21 +2,32 @@ module Docs
|
|
|
|
class Ocaml
|
|
|
|
class Ocaml
|
|
|
|
class CleanHtmlFilter < Filter
|
|
|
|
class CleanHtmlFilter < Filter
|
|
|
|
def call
|
|
|
|
def call
|
|
|
|
css('pre').each do |node|
|
|
|
|
|
|
|
|
|
|
|
|
css('pre, .caml-example').each do |node|
|
|
|
|
|
|
|
|
span = node.at_css('span[id]')
|
|
|
|
|
|
|
|
node['id'] = span['id'] if span
|
|
|
|
|
|
|
|
node['data-type'] = "#{span.content} [#{at_css('h1').content}]" if span
|
|
|
|
node['data-language'] = 'ocaml'
|
|
|
|
node['data-language'] = 'ocaml'
|
|
|
|
|
|
|
|
node.name = 'pre'
|
|
|
|
|
|
|
|
node.content = node.content
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
css('.caml-input').each do |node|
|
|
|
|
css('.caml-input').each do |node|
|
|
|
|
node.content = '# ' + node.content.strip
|
|
|
|
node.content = '# ' + node.content.strip
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
css('.caml-example').each do |node|
|
|
|
|
css('.maintitle *[style]').each do |node|
|
|
|
|
node.name = 'pre'
|
|
|
|
node.remove_attribute 'style'
|
|
|
|
node.traverse { |n| n.remove if n.text? && n.text !~ /\S/ }
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
node['data-language'] = 'ocaml'
|
|
|
|
css('h1').each do |node|
|
|
|
|
|
|
|
|
node.content = node.content
|
|
|
|
|
|
|
|
table = node.ancestors('table.center')
|
|
|
|
|
|
|
|
table.first.before(node).remove if table.present?
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
css('.navbar').remove
|
|
|
|
|
|
|
|
|
|
|
|
doc
|
|
|
|
doc
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|