Skip to content

Commit da73654

Browse files
author
Rob Wilmshurst
committed
Recognize <math display="block" and <math display="inline" as valid <math> tags too
git-svn-id: https://svn.code.sf.net/p/autowikibrowser/code/AWB@13009 5227b50d-9349-4574-b055-4b0a7525e11c
1 parent ac85eeb commit da73654

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

UnitTests/RegexTests.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,8 @@ public void MathPreSourceCodeTests()
335335
ClassicAssert.IsTrue(WikiRegexes.MathPreSourceCodeComments.IsMatch(@"<syntaxhighlight>{{abc}}</syntaxhighlight>"));
336336
ClassicAssert.IsTrue(WikiRegexes.MathPreSourceCodeComments.IsMatch(@"now hello {{bye}} <pre>{now}}</pre>"));
337337
ClassicAssert.IsTrue(WikiRegexes.MathPreSourceCodeComments.IsMatch(@"<math>{{abc}}</math>"));
338+
ClassicAssert.IsTrue(WikiRegexes.MathPreSourceCodeComments.IsMatch(@"<math display=""block"">{{abc}}</math>"));
339+
ClassicAssert.IsTrue(WikiRegexes.MathPreSourceCodeComments.IsMatch(@"<math display = ""inline"" >{{abc}}</math>"));
338340
ClassicAssert.IsTrue(WikiRegexes.MathPreSourceCodeComments.IsMatch(@"<chem>{{abc}}</chem>"));
339341
ClassicAssert.IsTrue(WikiRegexes.MathPreSourceCodeComments.IsMatch(@"<math chem>{{abc}}</math>"));
340342
ClassicAssert.IsTrue(WikiRegexes.SourceCode.IsMatch(@"<tt>{{abc}}</tt>"));

WikiFunctions/WikiRegexes.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -740,7 +740,7 @@ public struct TemplateParameters
740740
/// <summary>
741741
/// Matches math, pre, source, code, syntaxhighlight tags or comments
742742
/// </summary>
743-
public static readonly Regex MathPreSourceCodeComments = new Regex(@"<pre>.*?</pre>|<!--.*?-->|<math(?: chem)?>.*?</math>|<chem>.*?</chem>|" + SourceCode, RegexOptions.IgnoreCase | RegexOptions.Singleline);
743+
public static readonly Regex MathPreSourceCodeComments = new Regex(@"<pre>.*?</pre>|<!--.*?-->|<math(?: chem| *display *= *"" *(?:inline|block) *"" *)?>.*?</math>|<chem>.*?</chem>|" + SourceCode, RegexOptions.IgnoreCase | RegexOptions.Singleline);
744744

745745
/// <summary>
746746
/// Matches anything starting with Meanings of minor planet names

0 commit comments

Comments
 (0)