Page MenuHomePhabricator

ISBN links are rendered incorrecly in 1.5-cvs
Closed, ResolvedPublic

Description

Author: avarab

Description:
the "-" in ISBN links is transformed to – in 1.5-cvs, this has to do with
the second regular expression in the $dashReplace array in includes/Parser.php


Version: 1.5.x
Severity: minor

Details

Reference
bz1937

Revisions and Commits

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 8:21 PM
bzimport set Reference to bz1937.
bzimport added a subscriber: Unknown Object (MLST).

avarab wrote:

De-assigned myself.

Michael.Keppler wrote:

patch for HEAD

The main idea of this patch is to check if there are additional dashes or
digit-dash combinations around the combination of digit,dash,digit (which is
currently searched and replaced).
Therefore the look behind and look ahead assertions have been changed a bit:
The look ahead is now
(?=\d+[^-\d])
to check that no other dashes come after some digits.
The look behind assertion needs to be the same in reverse order, at least
theoretically. But look behinds need to have a fixed length, therefore the look
behind has been changed to
(?<=\d)(?<!-\d|-\d{2}|-\d{3}|-\d{4}|-\d{5}|-\d{6})
That checks that there is no additional dash up to 6 digits before the current
dash. The negative assertion part could (in theory) be written as "-\d{1,6}"
but that doesn't compile because of the fixed length requirement.
I have choosen 6 as the maximum number of digits to check in the look behind
assertion, because a 10 digit ISBN should never have more than 6 consecutive
digits (written with dashes), if I understand the details of that standard
right.

Attached:

Michael.Keppler wrote:

After some discussion with other developers it seems that my patch is not
necessary. The problem might be solved better by changing the order of
processing steps in the parser, so that the dash conversion occurs later.
See bug 2021 for a similar problem.

jeluf wrote:

Fixed in CVS HEAD, Parser.php rev 1.431

Diffusion added a commit: Unknown Object (Diffusion Commit).Mar 4 2015, 8:24 AM
Diffusion added a commit: Unknown Object (Diffusion Commit).