Module:Wikitext Parsing: Difference between revisions
Appearance
Template>Pppery m Changed protection settings for "Module:Wikitext Parsing": High-risk template or module: This is, among other things, an indirect dependency of Module:Pagetype and hence Template:Short description, and hence used on 26% of all pages ([Edit=Require administrator access] (indefinite) [Move=Require administrator access] (indefinite)) |
m 1 revision imported |
||
| (2 intermediate revisions by 2 users not shown) | |||
| Line 22: | Line 22: | ||
-- local out = string.gsub(str, "^%s*(.-)%s*$", "%1") | -- local out = string.gsub(str, "^%s*(.-)%s*$", "%1") | ||
local lowEnd | local lowEnd | ||
for i = 1, | local strlen = #str | ||
for i = 1,strlen do | |||
if not whitespace[string.sub(str, i, i)] then | if not whitespace[string.sub(str, i, i)] then | ||
lowEnd = i | lowEnd = i | ||
| Line 32: | Line 33: | ||
return "" | return "" | ||
end | end | ||
for i = | for i = strlen,1,-1 do | ||
if not whitespace[string.sub(str, i, i)] then | if not whitespace[string.sub(str, i, i)] then | ||
local out = string.sub(str, lowEnd, i) | local out = string.sub(str, lowEnd, i) | ||