Image link deletion leaves stray square brackets

Issue #12 resolved
Peter Bowman created an issue

Image links seem to not be correctly parsed if they include square brackets in their captions, especially in such a configuration as the following:

[[File:filename.jpg|thumb|[1]]]

See this edit on es.wiktionary.

Comments (6)

  1. Peter Bowman reporter

    The regex on line 350 takes into account the presence of wikilinks (those in double square brackets):

    $pattern_link = "\[\[\s*$pattern_file.*?(\[\[[^\]\[]+?\]\].*?)*\]\]" ;

    Something like this should include single square bracket links (and plain text like [1]) as well:

    \[\[\s*$pattern_file(\[\[.*?\]\]|\[.*?\]|.*?)*\]\]

  2. Log in to comment