Index: migrate_from_trac.rake =================================================================== --- migrate_from_trac.rake (revision 1928) +++ migrate_from_trac.rake (working copy) @@ -284,9 +284,39 @@ s end end - # Preformatted blocks - text = text.gsub(/\{\{\{/, '
') - text = text.gsub(/\}\}\}/, '') + # We would like to convert the Code highlighting too + # This will go into the next line. + shebang_line = false + # Reguar expression for start of code + pre_re = /\{\{\{/ + # Code hightlighing... + shebang_re = /^\#\!([a-z]+)/ + # Regular expression for end of code + pre_end_re = /\}\}\}/ + + # Go through the whole text..extract it line by line + text = text.gsub(/^(.*)$/) do |line| + puts "Line: '" + line + "'" + m_pre = pre_re.match(line) + if m_pre + line = '
'
+ else
+ m_sl = shebang_re.match(line)
+ if m_sl
+ shebang_line = true
+ line = ''
+ end
+ m_pre_end = pre_end_re.match(line)
+ if m_pre_end
+ line = '
'
+ if shebang_line
+ line = '' + line
+ end
+ end
+ end
+ line
+ end
+
# Highlighting
text = text.gsub(/'''''([^\s])/, '_*\1')
text = text.gsub(/([^\s])'''''/, '\1*_')