|
|
@ -12,8 +12,6 @@ module Docs
|
|
|
|
node.before(node.children).remove
|
|
|
|
node.before(node.children).remove
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
css('> br').remove
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
css('> font[size="+1"]:first-child').each do |node|
|
|
|
|
css('> font[size="+1"]:first-child').each do |node|
|
|
|
|
node.name = 'h1'
|
|
|
|
node.name = 'h1'
|
|
|
|
end
|
|
|
|
end
|
|
|
@ -30,63 +28,55 @@ module Docs
|
|
|
|
|
|
|
|
|
|
|
|
# others
|
|
|
|
# others
|
|
|
|
|
|
|
|
|
|
|
|
css('a[name]').each do |node|
|
|
|
|
# Remove JS on-hover highlighting
|
|
|
|
# parent = node.parent
|
|
|
|
css('h3.title-link', 'h4.title-link', 'div.data-type-name', 'div.func-head').each do |node|
|
|
|
|
# parent = parent.parent while parent.name == 'span'
|
|
|
|
node.remove_attribute('onmouseover')
|
|
|
|
(node.next_element || node.parent)['id'] ||= node['name']
|
|
|
|
node.remove_attribute('onmouseout')
|
|
|
|
node.before(node.children).remove
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
css('h3').each do |node|
|
|
|
|
css('h3').each do |node|
|
|
|
|
node.name = 'h2'
|
|
|
|
|
|
|
|
content = node.content
|
|
|
|
content = node.content
|
|
|
|
node.content = content.capitalize if content == content.upcase
|
|
|
|
node.content = content.capitalize if content == content.upcase
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
css('p > .bold_code:first-child ~ br:last-child').each do |node|
|
|
|
|
# Subsume "Types" heading under function head heading
|
|
|
|
|
|
|
|
css('h4.func-head + .fun-types > h3.func-types-title')
|
|
|
|
|
|
|
|
.each { |node| node.name = 'h5' }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
css('p > a[name]').each do |node|
|
|
|
|
parent = node.parent
|
|
|
|
parent = node.parent
|
|
|
|
parent.name = 'h3'
|
|
|
|
parent.name = 'h4'
|
|
|
|
parent.css('> br').remove
|
|
|
|
parent['id'] ||= node['name']
|
|
|
|
parent.css('> code').each do |code|
|
|
|
|
parent.css('> br:last-child').remove
|
|
|
|
code.css('*:not(a):not(br)').each { |n| n.before(n.children).remove }
|
|
|
|
end
|
|
|
|
code.inner_html = code.inner_html.gsub('<br>', "\n").strip
|
|
|
|
css('a[name]:empty').each { |n| (n.next_element || n.parent)['id'] ||= n['name'] }
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
css('h3', 'h4', 'h5').each do |node|
|
|
|
|
|
|
|
|
node.name = node.name.sub(/\d/) { |i| i.to_i - 1 }
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Convert <span/> code blocks to <code/> if inline otherwise <pre><code/></pre>
|
|
|
|
|
|
|
|
css('span.bold_code', 'span.code', '.func-head > span.title-name').each do |node|
|
|
|
|
|
|
|
|
node.remove_attribute('class')
|
|
|
|
|
|
|
|
node.css('span.bold_code', 'span.code')
|
|
|
|
|
|
|
|
.each { |n| n.before(n.children).remove }
|
|
|
|
|
|
|
|
if node.at_css('br') then
|
|
|
|
|
|
|
|
node.name = 'pre'
|
|
|
|
|
|
|
|
node.inner_html = "<code>" +
|
|
|
|
|
|
|
|
node.inner_html.remove(/\n/).gsub('<br>', "\n").strip +
|
|
|
|
|
|
|
|
"</code>"
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
node.name = 'code'
|
|
|
|
|
|
|
|
node.inner_html = node.inner_html.strip.gsub(/\s+/, ' ')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
css('pre:not(.REFTYPES) *:not(a)', 'a[href^=javascript]').each do |node|
|
|
|
|
|
|
|
|
node.before(node.children).remove
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
css('pre:not(.REFTYPES)').each do |node|
|
|
|
|
css('*:not(.REFTYPES) > pre').each do |node|
|
|
|
|
node['data-language'] = 'erlang'
|
|
|
|
node['data-language'] = 'erlang'
|
|
|
|
node.inner_html = node.inner_html.strip_heredoc
|
|
|
|
node.inner_html = node.inner_html.strip_heredoc
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
css('.REFBODY').each do |node|
|
|
|
|
css('a[href^=javascript]').each { |n| n.before(n.children).remove }
|
|
|
|
if node.element_children.length == 0
|
|
|
|
|
|
|
|
node.name = 'p'
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
node.before(node.children).remove
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
css('.REFTYPES').each do |node|
|
|
|
|
|
|
|
|
next unless node.parent
|
|
|
|
|
|
|
|
html = "<pre>"
|
|
|
|
|
|
|
|
while node['class'] == 'REFTYPES'
|
|
|
|
|
|
|
|
node.inner_html = node.inner_html.remove(/\n/).gsub('<br>', "\n")
|
|
|
|
|
|
|
|
node.css('*:not(a)').each { |n| n.before(n.children).remove }
|
|
|
|
|
|
|
|
html << node.inner_html.strip + "\n"
|
|
|
|
|
|
|
|
node = node.next_element
|
|
|
|
|
|
|
|
node.previous_element.remove
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
html.gsub! %r{\n{2,}}, "\n"
|
|
|
|
|
|
|
|
html.strip!
|
|
|
|
|
|
|
|
html << "</pre>"
|
|
|
|
|
|
|
|
node.before(html)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
css('.REFTYPES').remove
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
css('table').each do |node|
|
|
|
|
css('table').each do |node|
|
|
|
|
node.remove_attribute('border')
|
|
|
|
node.remove_attribute('border')
|
|
|
@ -99,8 +89,6 @@ module Docs
|
|
|
|
node.remove_attribute('valign')
|
|
|
|
node.remove_attribute('valign')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
css('.bold_code').remove_attr('class')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
doc
|
|
|
|
doc
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|