Defect #2826

trac import breaks images

Added by Daniel Svensson over 10 years ago. Updated over 6 years ago.

Status:NewStart date:2009-02-24
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Importers
Target version:-
Resolution: Affected version:0.8.1

Description

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

History

#1 Updated by Daniel Svensson over 10 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.

#2 Updated by Daniel Felix over 6 years ago

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

Also available in: Atom PDF