Nikerabbit has uploaded a new change for review.

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

Change subject: Add missing PHP file for WikiEduDashboard suggester
......................................................................

Add missing PHP file for WikiEduDashboard suggester

Change-Id: I907af5317b1c4d67f927b203cf10968a46673d07
---
A groups/Wikimedia/WikiEduDashboardSuggester.php
1 file changed, 30 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/translatewiki 
refs/changes/41/218141/1

diff --git a/groups/Wikimedia/WikiEduDashboardSuggester.php 
b/groups/Wikimedia/WikiEduDashboardSuggester.php
new file mode 100644
index 0000000..619f43d
--- /dev/null
+++ b/groups/Wikimedia/WikiEduDashboardSuggester.php
@@ -0,0 +1,30 @@
+<?php
+/**
+ * @file
+ * @author Niklas Laxström
+ * @license GPL-2.0+
+ */
+
+class WikiEduDashboardInsertablesSuggester {
+       public function getInsertables( $text ) {
+               $insertables = array();
+
+               // %{title}
+               $matches = array();
+               preg_match_all( '/\%{[^}]+}|%s/', $text, $matches, 
PREG_SET_ORDER );
+               $new = array_map( function( $match ) {
+                       return new Insertable( $match[0], $match[0] );
+               }, $matches );
+               $insertables = array_merge( $insertables, $new );
+
+               // &nbsp;
+               $matches = array();
+               preg_match_all( '/&(?:[a-z]+|#\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/218141
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I907af5317b1c4d67f927b203cf10968a46673d07
Gerrit-PatchSet: 1
Gerrit-Project: translatewiki
Gerrit-Branch: master
Gerrit-Owner: Nikerabbit <niklas.laxst...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to