MtDu has uploaded a new change for review. https://gerrit.wikimedia.org/r/325343
Change subject: Support $1 as insertables in the Intuition Project ...................................................................... Support $1 as insertables in the Intuition Project Bug: T150242 Change-Id: I058da157d016054aa3c593aafccf193a9e70690a --- M groups/Intuition/IntuitionAgg.yaml A groups/Intuition/IntuitionInsertablesSuggester.php M groups/Intuition/dcatap.yaml M groups/Intuition/heritage.yaml M groups/Intuition/orphantalk.yaml M groups/Intuition/raun.yaml M groups/Intuition/refill.yaml 7 files changed, 63 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/translatewiki refs/changes/43/325343/1 diff --git a/groups/Intuition/IntuitionAgg.yaml b/groups/Intuition/IntuitionAgg.yaml index 7fee2f0..67e0cb4 100644 --- a/groups/Intuition/IntuitionAgg.yaml +++ b/groups/Intuition/IntuitionAgg.yaml @@ -10,3 +10,9 @@ GROUPS: - tsint-* - int-* + +INSERTABLES: + class: IntuitionInsertablesSuggester + +AUTOLOAD: + CopyPatrolInsertablesSuggester: IntuitionInsertablesSuggester.php diff --git a/groups/Intuition/IntuitionInsertablesSuggester.php b/groups/Intuition/IntuitionInsertablesSuggester.php new file mode 100644 index 0000000..52c4ce1 --- /dev/null +++ b/groups/Intuition/IntuitionInsertablesSuggester.php @@ -0,0 +1,27 @@ +<?php +/** + * @file + * @author Justin Du + * @license GPL-2.0+ + */ + +class EntryScapeInsertablesSuggester { + public function getInsertables( $text ) { + $insertables = []; + + // $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; + } +} diff --git a/groups/Intuition/dcatap.yaml b/groups/Intuition/dcatap.yaml index d6d86c3..4e93d81 100644 --- a/groups/Intuition/dcatap.yaml +++ b/groups/Intuition/dcatap.yaml @@ -14,3 +14,9 @@ FILES: class: JsonFFS sourcePattern: "%GROUPROOT%/int-dcatap/i18n/%CODE%.json" + +INSERTABLES: + class: IntuitionInsertablesSuggester + +AUTOLOAD: + CopyPatrolInsertablesSuggester: IntuitionInsertablesSuggester.php diff --git a/groups/Intuition/heritage.yaml b/groups/Intuition/heritage.yaml index e02d997..885d2f4 100644 --- a/groups/Intuition/heritage.yaml +++ b/groups/Intuition/heritage.yaml @@ -18,3 +18,9 @@ TAGS: ignored: - monumentsapi-title + +INSERTABLES: + class: IntuitionInsertablesSuggester + +AUTOLOAD: + CopyPatrolInsertablesSuggester: IntuitionInsertablesSuggester.php diff --git a/groups/Intuition/orphantalk.yaml b/groups/Intuition/orphantalk.yaml index 9db64c9..3b5c7af 100644 --- a/groups/Intuition/orphantalk.yaml +++ b/groups/Intuition/orphantalk.yaml @@ -14,3 +14,9 @@ FILES: class: JsonFFS sourcePattern: "%GROUPROOT%/int-orphantalk/messages/%CODE%.json" + +INSERTABLES: + class: IntuitionInsertablesSuggester + +AUTOLOAD: + CopyPatrolInsertablesSuggester: IntuitionInsertablesSuggester.php diff --git a/groups/Intuition/raun.yaml b/groups/Intuition/raun.yaml index 618b584..329d00e 100644 --- a/groups/Intuition/raun.yaml +++ b/groups/Intuition/raun.yaml @@ -18,3 +18,9 @@ TAGS: ignored: - raun-ns* + +INSERTABLES: + class: IntuitionInsertablesSuggester + +AUTOLOAD: + CopyPatrolInsertablesSuggester: IntuitionInsertablesSuggester.php diff --git a/groups/Intuition/refill.yaml b/groups/Intuition/refill.yaml index e6b86d8..2ff41c6 100644 --- a/groups/Intuition/refill.yaml +++ b/groups/Intuition/refill.yaml @@ -22,3 +22,9 @@ - refill-wikitext-support-parameter-* - refill-wikitext-parameter-* - refill-wikitext-template-* + +INSERTABLES: + class: IntuitionInsertablesSuggester + +AUTOLOAD: + CopyPatrolInsertablesSuggester: IntuitionInsertablesSuggester.php -- To view, visit https://gerrit.wikimedia.org/r/325343 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I058da157d016054aa3c593aafccf193a9e70690a 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