Project

General

Profile

Actions

Defect #2826

open

trac import breaks images

Added by Daniel Svensson almost 16 years ago. Updated almost 12 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Importers
Target version:
-
Start date:
2009-02-24
Due date:
% Done:

0%

Estimated time:
Resolution:
Affected version:

Description

[[Image(myimage.png)]]
and similar should be converted to
!myimage.png!
Actions #1

Updated by Daniel Svensson almost 16 years ago

The following regexp, should be placed first in the convert_wiki_text block:

text = text.gsub(/\[\[Image\(([a-zA-Z]+\:(\d+\:)?)?([^\)^,]+)[^\)]*\)\]\]/, '!\3!')

The following test cases:

puts convert_wiki_text("[[Image(myimage1.png)]]")
puts convert_wiki_text("[[Image(wiki:myimage2.png)]]")
puts convert_wiki_text("[[Image(ticket:1:myimage3.png)]]")
puts convert_wiki_text("[[Image(myimage4.png, 120px)]]")
puts convert_wiki_text("[[Image(myimage5.png, align=right)]]")

Will then output:

!myimage1.png!
!myimage2.png!
!myimage3.png!
!myimage4.png!
!myimage5.png!

I think the only supported extended Image attribute supported by Redmine is align=right, which could have been converted to:

!>myimage5.png!

...but it's probably pretty rare, and would make the already complex regexp almost unreadable.

Actions #2

Updated by Daniel Felix almost 12 years ago

Any news on this?
Is anyone able to reproduce this with the current trunk?

Actions

Also available in: Atom PDF