From 9dad688f44389070eb74d0083552295de4f3d058 Mon Sep 17 00:00:00 2001 From: "Moritz Schubotz (physikerwelt)" Date: Mon, 30 Mar 2020 21:50:50 +0200 Subject: [PATCH] Add tracking category for pages that use a deprecated LaTeX syntax Discussions in the Wikimedia Math Community show that there is consensus to deprecate the use of MediaWiki specific LaTeX macros that conflict with LaTeX macros from commonly used packages. In this change, we show the deprecation warnings generated by mathoid. Bug: T197842 Change-Id: I24dbb446665fdc227d0e7342fdbf8829b4c1bda4 --- i18n/en.json | 2 ++ i18n/qqq.json | 2 ++ src/MathMathML.php | 10 ++++++++-- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/i18n/en.json b/i18n/en.json index 6505fad97..f6cbcd22e 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -85,6 +85,8 @@ "math-tracking-category-error-desc": "Pages in this category have errors in the usage of math tags.", "math-tracking-category-mhchem-deprecation": "Pages that use a deprecated format of the chem tags", "math-tracking-category-mhchem-deprecation-desc": "Pages in this category use a deprecated format of the chem tags", + "math-tracking-category-texvc-deprecation": "Pages that use a deprecated format of the math tags", + "math-tracking-category-texvc-deprecation-desc": "Pages in this category use a deprecated format of the math tags", "math-tracking-category-render-error": "Pages with math render errors", "math-tracking-category-render-error-desc": "Pages in this category have rendering errors in the math tags.", "math_unknown_error": "unknown error", diff --git a/i18n/qqq.json b/i18n/qqq.json index 9b71939ed..bba4c58f4 100644 --- a/i18n/qqq.json +++ b/i18n/qqq.json @@ -85,6 +85,8 @@ "math-tracking-category-error-desc": "Tracking category description.", "math-tracking-category-mhchem-deprecation": "Tracking category name.", "math-tracking-category-mhchem-deprecation-desc": "Tracking category description.", + "math-tracking-category-texvc-deprecation": "Tracking category name.", + "math-tracking-category-texvc-deprecation-desc": "Tracking category description.", "math-tracking-category-render-error": "Tracking category name.", "math-tracking-category-render-error-desc": "Tracking category description.", "math_unknown_error": "Used as error message for unknown texvc error.\n\nThis message follows the message {{msg-mw|Math failure}}.\n{{Identical|Unknown error}}", diff --git a/src/MathMathML.php b/src/MathMathML.php index 2b5fd9bfb..c6cfcba3f 100644 --- a/src/MathMathML.php +++ b/src/MathMathML.php @@ -66,8 +66,14 @@ class MathMathML extends MathRenderer { parent::addTrackingCategories( $parser ); if ( $this->hasWarnings() ) { foreach ( $this->warnings as $warning ) { - if ( isset( $warning->type ) && $warning->type === 'mhchem-deprecation' ) { - $parser->addTrackingCategory( 'math-tracking-category-mhchem-deprecation' ); + if ( isset( $warning->type ) ) { + switch ( $warning->type ) { + case 'mhchem-deprecation': + $parser->addTrackingCategory( 'math-tracking-category-mhchem-deprecation' ); + break; + case 'texvc-deprecation': + $parser->addTrackingCategory( 'math-tracking-category-texvc-deprecation' ); + } } } }