Module:Excerpt: Difference between revisions

Content deleted Content added
More escape characters to deal with text like [comment wikilink]. Exclude }} within <math> to disregard cases like <math>\sqrt{\hat{x}}</math> (test case: Milankovitch cycles).
Handle <math foo="bar"> like <math>; test case Commensurability (mathematics)
Line 539:
local t = text
text = mw.ustring.gsub(text, "{(%b{})}", "\27{\27%1\27}\27"); -- {{sometemplate}} → E{Esometemplate}E}E where E represents escape
text = mw.ustring.gsub(text, "(< *math [^>]*>[^<]-)}}(.-< */math *>)", "%1}\27}\27%2"); -- <math>\{sqrt\{hat{x}}</math> → <math>\{sqrt\{hat{x}E}E</math>
until text == t
repeat -- do similar for [[wikilink]]s