|
|
|
@ -3,10 +3,12 @@ module Docs
|
|
|
|
|
class FixCodeFilter < Filter
|
|
|
|
|
def call
|
|
|
|
|
css('div > span.source-c', 'div > span.source-cpp').each do |node|
|
|
|
|
|
node.inner_html = node.inner_html.gsub(/<br>\n?/, "\n").gsub("\n</p>\n", "</p>\n")
|
|
|
|
|
node.parent.name = 'pre'
|
|
|
|
|
node.parent['class'] = node['class']
|
|
|
|
|
node.parent.content = node.content
|
|
|
|
|
if (node.parent.classes||[]).none?{|className| ['t-li1','t-li2','t-li3'].include?(className) }
|
|
|
|
|
node.inner_html = node.inner_html.gsub(/<br>\n?/, "\n").gsub("\n</p>\n", "</p>\n")
|
|
|
|
|
node.parent.name = 'pre'
|
|
|
|
|
node.parent['class'] = node['class']
|
|
|
|
|
node.parent.content = node.content
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
nbsp = Nokogiri::HTML(' ').text
|
|
|
|
|