MtDu has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/326197 )
Change subject: Support $1 as insertable parameters in the FUDforum project ...................................................................... Support $1 as insertable parameters in the FUDforum project Bug: T150239 Change-Id: I16ddf5dc6ac286d99e187d7cab077acf2831822d --- M groups/FUDforum/Suggester.php 1 file changed, 20 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/translatewiki refs/changes/97/326197/1 diff --git a/groups/FUDforum/Suggester.php b/groups/FUDforum/Suggester.php index 0d2a9ae..5310ff8 100644 --- a/groups/FUDforum/Suggester.php +++ b/groups/FUDforum/Suggester.php @@ -2,6 +2,7 @@ /** * @author Siebrand Mazeland + * @author Justin Du * @license GPL-2.0+ */ class FudForumSuggester implements InsertablesSuggester { @@ -10,12 +11,30 @@ // Variables like {VAR: <string>} $matches = []; - preg_match_all( '/{VAR: [^}]+}/', $text, $matches, PREG_SET_ORDER ); + preg_match_all( + '/{VAR: [^}]+}/', + $text, + $matches, + PREG_SET_ORDER + ); $new = array_map( function( $match ) { return new Insertable( "{$match[0]}", $match[0] ); }, $matches ); $insertables = array_merge( $insertables, $new ); + // $1 + $matches = []; + preg_match_all( + '/\$\d/', + $text, + $matches, + PREG_SET_ORDER + ); + $new = array_map( function( $match ) { + return new Insertable( $match[0], $match[0] ); + }, $matches ); + $insertables = array_merge( $insertables, $new ); + return $insertables; } } -- To view, visit https://gerrit.wikimedia.org/r/326197 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I16ddf5dc6ac286d99e187d7cab077acf2831822d Gerrit-PatchSet: 1 Gerrit-Project: translatewiki Gerrit-Branch: master Gerrit-Owner: MtDu <justin.d...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits