Page MenuHomePhabricator

ImageMap does not accept links in the image caption
Closed, ResolvedPublic


Author: D.U.Thibault

Any links in the image's caption text become as if marked <nowiki>. For now,
on emust strip links from ImageMap captions. For example:<br/>
Image:EightTNOs.png|thumb|275px|The largest [[Trans-Neptunian object]]s that
prompted the IAU's decision.
rect 646 1714 2142 1994 [[Earth|The Earth]]

desc none

Version: unspecified
Severity: normal
OS: Windows XP
Platform: PC



Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 9:30 PM
bzimport added a project: ImageMap.
bzimport set Reference to bz8835.

The problem is that Parser::makeImage happens halfway through the multi-pass
parsing normally, but those earlier passes haven't been run on ImageMap's text.

So, no links, bold/italics, etc.

Not sure what's the best way around this. Full subparse of the options text?

  • Bug 8924 has been marked as a duplicate of this bug. ***

michaeldaly wrote:

Is there a default line in the real example (not shown in the text above)?

I've noticed that the caption works if there is no default line and is
overridden by the default otherwise.

E.g. default [[Default page]] will override the caption on the first line's options.

D.U.Thibault wrote:

What do you mean by "default line"?

michaeldaly wrote:

As per input documentation:

    This gives the default link, where no other regions are specified.

The format is as I gave in the example:

default [[Default page]]

Clicking on the image where no area is defined with a shape will go to the
default page.

D.U.Thibault wrote:

Ah, you mean the default ''parameter''.

No, specifying the default parameter changes nothing to the bug: the caption is
still unparsed. On Wikipedia, anyway. Have you had experience otherwise?

D.U.Thibault wrote:

Additional: The bug also means the image map will not accept parameters when
embedded within a Template. It is thus impossible to build a template wrapper
around an imagemap that would allow various defaults (image size, alignment,
caption, etc.) to be passed in as parameters (named or default-numbered, doesn't
matter). For example:

Image:EightTNOs.png|thumb|275px|{{{caption|The largest [[Trans-Neptunian
object]]s that prompted the IAU's decision}}}
rect 646 1714 2142 1994 [[Earth|The Earth]]
desc none

publicsean wrote:

parser makeImage patch.txt

Normal image captions are handled in two places:

  • wiki text rendering is done in internalParse() with the doAllQuotes() call
  • links are handled recursively in replaceInternalLinks()

By moving/adding these calls into makeImage(), the caption rendering is done
everytime that makeImage is used.

This doesn't allow for wiki tables or headings(which do work in normal image
links), for that the imagemap extension would have to be reworked.

Produces same result in ParserTests as r22112.

This solves the wiki text and links issues but template arguments cannot be
used without fixing bug 2257 first.


arlas wrote:

Hi! i managed to resolve part of this bug with {{#tag}}, bypassing:
Here's a working copy of imagemap
default [[{{{1}}}]]
desc none

Assigned to extension developer

This was fixed in r40684 / r40685.

Gilles raised the priority of this task from Medium to Unbreak Now!.Dec 4 2014, 10:12 AM
Gilles moved this task from Untriaged to Done on the Multimedia board.
Gilles lowered the priority of this task from Unbreak Now! to Medium.Dec 4 2014, 11:21 AM