Setting an image as a link is broken

Bug #1051547 reported by Alistair Marshall
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
RedNotebook
Triaged
Undecided
Unassigned

Bug Description

According to http://txt2tags.org/markup.html it should be possible to create an image as a link (near the bottom of the page)

An image [[t2t.png] as-a-link.html].

Unfortunately I have been unable to use this in RNB.

After playing around, I have found that the image source and the link are swapped, ie if you were to put [[""http://google.com"".png] ""path-to-image""] it does work.

I suspect it is caused by the link destination appearing before the image src path:
<a href="http://www.google.com"><img align="middle" src="file:///home/amar/Desktop/image.png" border="0" alt=""/></a>

I suspect this may be an issue with the txt2tags code itself but am not sure.
It might be caused by the extra quotation marks that aren't shown in the origional txt2tags markup

* Tried on trunk and older versions both ubuntu and windows
* Have only tried html and preview so far, not touched plain text or latex yet.

Revision history for this message
Alistair Marshall (thatscottishengineer) wrote :

Further update:

If the extra quotation marks are removed from the link, it works the correct way round.
[[""file:///home/amar/Desktop/image"".png] http://www.google.com]

AFAICT the quotation marks around the image need to remain unless it is a relative url.

Revision history for this message
Jendrik Seipp (jendrikseipp) wrote : Re: [Bug 1051547] Re: Setting an image as a link is broken

> If the extra quotation marks are removed from the link, it works the correct way round.
> [[""file:///home/amar/Desktop/image"".png]http://www.google.com]
Nice detective work ;) Could you please try if this peculiarity
(difference between using quotes and no quotes) persists in vanilla
txt2tags and report a bug at their tracker [1] if it does?

[1] https://code.google.com/p/txt2tags/issues/list

Revision history for this message
Alistair Marshall (thatscottishengineer) wrote :

Currently having a look at doing just that.

I believe it it because txt2tags replaces the protected links with vvvRAWvvv and stores the links in the rawbank. The conversion then happens and the link locations are rearranged before the links are pasted back into the body (this time in the wrong locations).

The only way I can see to fix this would be to change the rawbank from a list to a dictionary and put an id in each vvvRAWvvv placeholder. This would be a rather large change and whilst would improve robustness of the system, it may be considered extra bloat.

This all started because I was investigating if I could set all the images in the preview to link to themselves (effectively allow you to zoom in on an image)

Revision history for this message
Alistair Marshall (thatscottishengineer) wrote :
Revision history for this message
Jendrik Seipp (jendrikseipp) wrote :

Thanks for your investigation! This will be fixed when a new txt2tags is released and integrated into RedNotebook.

Changed in rednotebook:
status: New → Triaged
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.