jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/326174 )
Change subject: Support %1$s as insertable parameters in the NOCC Project ...................................................................... Support %1$s as insertable parameters in the NOCC Project Bug: T150251 Change-Id: Ic812a6512616e3e5d85523879144bc8bd4c10e46 --- M groups/Nocc/Nocc.yaml A groups/Nocc/NoccInsertablesSuggester.php 2 files changed, 33 insertions(+), 0 deletions(-) Approvals: Amire80: Looks good to me, approved jenkins-bot: Verified diff --git a/groups/Nocc/Nocc.yaml b/groups/Nocc/Nocc.yaml index 9a4d0db..a177256 100644 --- a/groups/Nocc/Nocc.yaml +++ b/groups/Nocc/Nocc.yaml @@ -83,3 +83,9 @@ class: MessageChecker checks: - printfCheck + +INSERTABLES: + class: NoccInsertablesSuggester + +AUTOLOAD: + NoccInsertablesSuggester: NoccInsertablesSuggester.php diff --git a/groups/Nocc/NoccInsertablesSuggester.php b/groups/Nocc/NoccInsertablesSuggester.php new file mode 100644 index 0000000..c29326d --- /dev/null +++ b/groups/Nocc/NoccInsertablesSuggester.php @@ -0,0 +1,27 @@ +<?php +/** + * @file + * @author Justin Du + * @license GPL-2.0+ + */ + +class NoccInsertablesSuggester { + public function getInsertables( $text ) { + $insertables = []; + + // %1$s + $matches = []; + preg_match_all( + '/%\d\$s/', + $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/326174 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ic812a6512616e3e5d85523879144bc8bd4c10e46 Gerrit-PatchSet: 1 Gerrit-Project: translatewiki Gerrit-Branch: master Gerrit-Owner: MtDu <justin.d...@gmail.com> Gerrit-Reviewer: Amire80 <amir.ahar...@mail.huji.ac.il> Gerrit-Reviewer: Nikerabbit <niklas.laxst...@gmail.com> Gerrit-Reviewer: Siebrand <siebr...@kitano.nl> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits