Euvl has uploaded a new change for review. https://gerrit.wikimedia.org/r/70742
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 LingoBasicBackend.php M LingoTree.php 3 files changed, 23 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Lingo refs/changes/42/70742/1 diff --git a/Lingo.php b/Lingo.php index fcfc725..605a8aa 100644 --- a/Lingo.php +++ b/Lingo.php @@ -81,6 +81,7 @@ $wgHooks['ArticlePurge'][] = 'LingoBasicBackend::purgeCache'; $wgHooks['ArticleSave'][] = 'LingoBasicBackend::purgeCache'; +$wgHooks['ParserFirstCallInit'][] = 'LingoBasicBackend::registerTags'; // register resource modules with the Resource Loader $wgResourceModules['ext.Lingo.Styles'] = array( diff --git a/LingoBasicBackend.php b/LingoBasicBackend.php index 0149918..09072dc 100644 --- a/LingoBasicBackend.php +++ b/LingoBasicBackend.php @@ -139,5 +139,26 @@ public function useCache() { return true; } + + /** + * Creates tag hook(s) + */ + public static function registerTags(Parser $parser) { + $parser->setHook( 'noglossary', 'LingoBasicBackend::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 ) { + return '<span class="noglossary">'.$input.'</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: newchange Gerrit-Change-Id: Id941519dffe71a35554a24ee851fb1518c7e9e46 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Lingo Gerrit-Branch: master Gerrit-Owner: Euvl <eu.vlase...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits