|
|
|
@ -21,32 +21,19 @@ module Docs
|
|
|
|
|
node.name = 'strong'
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
# Remove CodePen div
|
|
|
|
|
css('.codepen').each do |node|
|
|
|
|
|
next if node.previous_element.nil?
|
|
|
|
|
span = node.css('span:contains("See the Pen")').remove
|
|
|
|
|
node.previous_element.add_child(' ')
|
|
|
|
|
node.previous_element.add_child(span)
|
|
|
|
|
node.remove
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
# Remove code highlighting
|
|
|
|
|
css('figure').each do |node|
|
|
|
|
|
node.name = 'pre'
|
|
|
|
|
node.content = node.at_css('td.code pre').css('.line').map(&:content).join("\n")
|
|
|
|
|
node['data-language'] = node['class'][/highlight (\w+)/, 1]
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
css('.line-numbers-wrapper').remove
|
|
|
|
|
css('pre').each do |node|
|
|
|
|
|
node.content = node.content.strip
|
|
|
|
|
node['data-language'] = 'javascript'
|
|
|
|
|
node.parent.name = 'pre'
|
|
|
|
|
node.parent['data-language'] = node.parent['class'][/language-(\w+)/, 1]
|
|
|
|
|
node.parent['data-language'] = 'javascript' if node.parent['data-language'][/vue/] # unsupported by prism.js
|
|
|
|
|
node.parent.remove_attribute 'class'
|
|
|
|
|
node.parent.content = node.content.strip
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
css('iframe').each do |node|
|
|
|
|
|
node['sandbox'] = 'allow-forms allow-scripts allow-same-origin'
|
|
|
|
|
node.remove if node['src'][/player.vimeo.com/] # https://v3.vuejs.org/guide/migration/introduction.html#overview
|
|
|
|
|
end
|
|
|
|
|
css('.vue-mastery-link').remove
|
|
|
|
|
css('.vuejobs-wrapper').remove
|
|
|
|
|
css('.vueschool').remove
|
|
|
|
|
|
|
|
|
|
css('details').each do |node|
|
|
|
|
|
node.name = 'div'
|
|
|
|
|