Patch #2023 ยป migration.patch
| migrate_from_trac.rake (working copy) | ||
|---|---|---|
|
s
|
||
|
end
|
||
|
end
|
||
|
# Preformatted blocks
|
||
|
text = text.gsub(/\{\{\{/, '<pre>')
|
||
|
text = text.gsub(/\}\}\}/, '</pre>')
|
||
|
# 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 = '<pre>'
|
||
|
else
|
||
|
m_sl = shebang_re.match(line)
|
||
|
if m_sl
|
||
|
shebang_line = true
|
||
|
line = '<code class="' + m_sl[1] + '">'
|
||
|
end
|
||
|
m_pre_end = pre_end_re.match(line)
|
||
|
if m_pre_end
|
||
|
line = '</pre>'
|
||
|
if shebang_line
|
||
|
line = '</code>' + line
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
line
|
||
|
end
|
||
|
# Highlighting
|
||
|
text = text.gsub(/'''''([^\s])/, '_*\1')
|
||
|
text = text.gsub(/([^\s])'''''/, '\1*_')
|
||