migration.patch

The patch to fix the behaviour. - Karl Heinz Marbaise, 2008-10-11 20:28

Download (1.52 KB)

View differences:

migrate_from_trac.rake (working copy)
284 284
            s
285 285
          end
286 286
        end
287
        # Preformatted blocks
288
        text = text.gsub(/\{\{\{/, '<pre>')
289
        text = text.gsub(/\}\}\}/, '</pre>')          
287
        # We would like to convert the Code highlighting too
288
        # This will go into the next line.
289
        shebang_line = false
290
        # Reguar expression for start of code
291
        pre_re = /\{\{\{/
292
        # Code hightlighing...
293
        shebang_re = /^\#\!([a-z]+)/
294
        # Regular expression for end of code
295
        pre_end_re = /\}\}\}/
296
        
297
        # Go through the whole text..extract it line by line
298
        text = text.gsub(/^(.*)$/) do |line|
299
          puts "Line: '" + line + "'"
300
          m_pre = pre_re.match(line)
301
          if m_pre
302
            line = '<pre>'
303
          else
304
            m_sl = shebang_re.match(line)
305
            if m_sl
306
              shebang_line = true
307
              line = '<code class="' + m_sl[1] + '">'
308
            end
309
            m_pre_end = pre_end_re.match(line)
310
            if m_pre_end
311
              line = '</pre>'
312
              if shebang_line
313
                line = '</code>' + line
314
              end
315
            end
316
          end
317
          line        
318
        end
319

  
290 320
        # Highlighting
291 321
        text = text.gsub(/'''''([^\s])/, '_*\1')
292 322
        text = text.gsub(/([^\s])'''''/, '\1*_')