|
|
|
@ -4,6 +4,24 @@ module Docs
|
|
|
|
|
def call
|
|
|
|
|
css('hr').remove
|
|
|
|
|
|
|
|
|
|
css('pre').each do |node|
|
|
|
|
|
next unless (node.css('code').to_a.length > 1)
|
|
|
|
|
|
|
|
|
|
node.css('code').each do |subnode|
|
|
|
|
|
|
|
|
|
|
if subnode.classes.include?('mjs')
|
|
|
|
|
node.before('<p class=module-type>MJS modules</p>')
|
|
|
|
|
elsif subnode.classes.include?('cjs')
|
|
|
|
|
node.before('<p class=module-type>CJS modules</p>')
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
node.before(subnode)
|
|
|
|
|
subnode.wrap('<pre>')
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
node.remove
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
# Remove "#" links
|
|
|
|
|
css('.mark').each do |node|
|
|
|
|
|
node.parent.parent['id'] = node['id']
|
|
|
|
@ -17,9 +35,7 @@ module Docs
|
|
|
|
|
css('pre').each do |node|
|
|
|
|
|
next unless node.at_css('code')
|
|
|
|
|
|
|
|
|
|
if lang = node.at_css('code')['class']
|
|
|
|
|
node['data-language'] = lang.remove(%r{lang(uage)?-})
|
|
|
|
|
end
|
|
|
|
|
node['data-language'] = 'js'
|
|
|
|
|
|
|
|
|
|
node.content = node.content
|
|
|
|
|
end
|
|
|
|
|