Foxtrott has submitted this change and it was merged.
Change subject: Ability to turn off the recognition of glossary terms in
certain places.
......................................................................
Ability to turn off the recognition of glossary terms in certain places.
Change-Id: Id941519dffe71a35554a24ee851fb1518c7e9e46
---
M Lingo.php
M LingoHooks.php
M LingoTree.php
3 files changed, 23 insertions(+), 1 deletion(-)
Approvals:
Yury Katkov: Looks good to me, but someone else must approve
Foxtrott: Verified; Looks good to me, approved
diff --git a/Lingo.php b/Lingo.php
index fcfc725..4e29ab4 100644
--- a/Lingo.php
+++ b/Lingo.php
@@ -81,6 +81,7 @@
$wgHooks['ArticlePurge'][] = 'LingoBasicBackend::purgeCache';
$wgHooks['ArticleSave'][] = 'LingoBasicBackend::purgeCache';
+$wgHooks['ParserFirstCallInit'][] = 'LingoHooks::registerTags';
// register resource modules with the Resource Loader
$wgResourceModules['ext.Lingo.Styles'] = array(
diff --git a/LingoHooks.php b/LingoHooks.php
index 464c5a5..413d005 100644
--- a/LingoHooks.php
+++ b/LingoHooks.php
@@ -66,5 +66,26 @@
return true;
}
+ /**
+ * Creates tag hook(s)
+ */
+ public static function registerTags(Parser $parser) {
+ $parser->setHook( 'noglossary',
'LingoHooks::noglossaryTagRenderer');
+ return true;
+ }
+
+ /**
+ * Sets hook on 'noglossary' tag
+ * @static
+ * @param $input
+ * @param array $args
+ * @param Parser $parser
+ * @param PPFrame $frame
+ * @return string
+ */
+ public static function noglossaryTagRenderer( $input, array $args,
Parser $parser, PPFrame $frame ) {
+ $output = $parser->recursiveTagParse( $input, $frame );
+ return '<span class="noglossary">'.$output.'</span>';
+ }
}
diff --git a/LingoTree.php b/LingoTree.php
index 60f2881..11f659a 100644
--- a/LingoTree.php
+++ b/LingoTree.php
@@ -106,7 +106,7 @@
$start = $lastindex = $index;
$definition = null;
- // skip until ther start of a term is found
+ // skip until the start of a term is found
while ( $index < $countLexemes && !$definition ) {
$currLex = &$lexemes[$index][0];
--
To view, visit https://gerrit.wikimedia.org/r/70742
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Id941519dffe71a35554a24ee851fb1518c7e9e46
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Lingo
Gerrit-Branch: master
Gerrit-Owner: Euvl <[email protected]>
Gerrit-Reviewer: Foxtrott <[email protected]>
Gerrit-Reviewer: Yury Katkov <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits