Skip to content

Cannot use [[File:|link=page]] syntax in a marker #828

Open

Description

@jrbray1

Setup

  • Maps version: 12.0.0
  • MW version: 1.43.3
  • PHP version: 8/4
  • SMW version (if applicable):

Issue

{{#display_map:
51.0915,1.1877~[[Abbotscliffe Tunnel]]~[[File:Abbotscliffe%20Tunnel%200252.JPG|thumb|100px|link=Abbotscliffe Tunnel]];
| service=leaflet
| zoom=15
| width=600
| height=400
}}

Which hopes to create a link to the article via text and through the image leaves the Map without markers, because it does not handle the equals sign in the link= properly. Removing the link= does display the marker with popup image, but the click through link is to the image file in Commons, not the desired page. Attempts to circumvent this with {{=}} and raw HTML have all failed. And of course you can't even display the image without a link, because that would require link=

Activity

  1. baillyk commented on Jun 5, 2026

    @baillyk

    This is because "=" is used by mediawiki parser as a seperator for arguments for parser functions (param=value).
    If one uses the equal sign within the locationtext (no matter at which position), mediawiki parser will fail to deliver the text correctly to the Maps extension. So it's not a bug in Maps.
    It can be solved for example by editing the File extensions/Maps/src/WikitextParsers/LocationParser.php.

    in Maps 12.1.5, change Line 81-83 from:

    if ( $metaData !== [] ) {
    	$location->setText( array_shift( $metaData ) );
    }
    

    to

    
    if ( $metaData !== [] ) {
        $text = preg_replace(
            '/(\[\[(?:File|Image):[^\]]*?)\|link:/i',
            '$1|link=',
            array_shift( $metaData )
        );
    
        $location->setText( $text ); 
    }
    

    This adds a regex replace that replaces "link:" to "link=" in image definitions within the location text. Afterwards you can add links to images using ":" instead of "=". By using the colon sign, the text gets delivered correctly to Maps and within Maps it is replaced by the equal sign to that it get parsed correctly to a linked image.

    Example:

    [[File:Abbotscliffe%20Tunnel%200252.JPG|thumb|100px|link:Abbotscliffe Tunnel]]
    
  2. jrbray1 commented on Jul 3, 2026

    @jrbray1
    Author

    Thanks for looking into this. Its making progress, as now the image appears, but the pop-up title and pop-up text now appear in separate boxes, as can be seen here and at https://warlike.info/Sandbox. I am using 12.0.0

    {{#display_map:
    51.0915,1.1877~[[Dover Castle]]~no image;
    | service=leaflet
    | zoom=15
    | width=600
    | height=400
    }}

    {{#display_map:
    51.0915,1.1877~[[Dover Castle]][[File:Abbotscliffe%20Tunnel%200252.JPG|thumb|100px|link:Abbotscliffe Tunnel]];
    | service=leaflet
    | zoom=15
    | width=600
    | height=400
    }}
    {{#display_map:
    51.0915,1.1877
    [[Dover Castle]] no tilde [[File:Abbotscliffe%20Tunnel%200252.JPG|thumb|100px|link:Abbotscliffe Tunnel]];
    | service=leaflet
    | zoom=15
    | width=600
    | height=400
    }}

    Image
  3. baillyk commented on Jul 6, 2026

    @baillyk

    Not sure, but try to remove the "thumb" option from your images

  4. jrbray1 commented on Jul 6, 2026

    @jrbray1
    Author
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions