Page MenuHomePhabricator

Translation: <tvar> should accept multi-line content
Closed, ResolvedPublic

Description

Currently, the extension uses this regex:

	$re = '~<tvar\|([^>]+)>(.*?)</>~u';

when parsing the content of "tvar"[1], but this does not work if the content spans multiple lines, as in
https://www.mediawiki.org/w/index.php?title=Thumbnail_style_update&diff=1074482&oldid=1074458

I believe it would work if we set PCRE_DOTALL for this regex (if that is the case, this is an easy bug to fix, so I'm adding the appropriated keyword to the bug report).

[1] https://github.com/wikimedia/mediawiki-extensions-Translate/blob/bdd2d990d3785360a0377d32f32188396bbe8b45/tag/TPSection.php#L42-L52

Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 3:26 AM
bzimport set Reference to bz68451.
bzimport added a subscriber: Unknown Object (MLST).

PCRE_DOTALL is the suffix 's'. http://fi2.php.net/manual/en/reference.pcre.pattern.modifiers.php

Please add a test case if submitting a patch.

He7d3r set Security to None.

Change 406421 had a related patch set uploaded (by D3r1ck01; owner: Alangi Derick):
[mediawiki/extensions/Translate@master] Add support for multiple line in <tvar>

https://gerrit.wikimedia.org/r/406421

xSavitar subscribed.

@Nikerabbit, have a look at the patch if it's okay! Thanks.

xSavitar raised the priority of this task from Low to Medium.Feb 19 2018, 7:42 PM

As I'm working on it currently! :)

Change 406421 merged by jenkins-bot:
[mediawiki/extensions/Translate@master] Add multi-line content for <tvar> & its unit tests

https://gerrit.wikimedia.org/r/406421

Thanks so much @Nikerabbit for reviewing this :). Marking as resolved :)

But please @D3r1ck01 how can someone determine if it has been resolved or not?
I'm still trying to get familiar with how we work around here

@Tamgue, usually, when a ticket is open and you're interested in working on it, try to see if the problem still exist by reproducing it. If it still exist, you can claim the task if you think you can do it and then fix the problem, then submit a patch. Members of the community will review your patch and if it's okay, it will be merged else you will need to improve on it until it's okay for merge. Then when you finish the task and it's merged, you or any other person can close the ticket on phabricator by marking it as resolved as it's completed.