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

Details

Reference
bz68451
Related Gerrit Patches:
mediawiki/extensions/Translate : masterAdd multi-line content for <tvar> & its unit tests

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).
He7d3r created this task.Jul 23 2014, 5:04 PM

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 updated the task description. (Show Details)Jan 19 2016, 12:04 PM
He7d3r set Security to None.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJan 19 2016, 12:04 PM
Restricted Application added a subscriber: TerraCodes. · View Herald TranscriptJul 2 2017, 2:16 PM
D3r1ck01 updated the task description. (Show Details)Jan 27 2018, 5:55 PM

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

D3r1ck01 claimed this task.Jan 27 2018, 9:06 PM
D3r1ck01 added a subscriber: D3r1ck01.

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

D3r1ck01 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

D3r1ck01 closed this task as Resolved.Feb 22 2018, 2:43 PM

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.