Module:Module introspection: Difference between revisions
bugfix offset line numbers |
No edit summary |
||
| Line 11: | Line 11: | ||
if not content then return "" end | if not content then return "" end | ||
-- | -- Step 1: blank multi-line comments including --[[ ... ]] and --[=[ ... ]=] | ||
content = content:gsub("%-%-%[(=*)%[(.-)%]%1%]", function(eq, body) | |||
-- Replace everything except newlines with spaces | |||
content = content:gsub("%-%-%[(=*)%[.-%]%1%]", function( | local blank = body:gsub("[^\n]", " ") | ||
-- Replace | return "--[[" .. blank .. "]]" | ||
end) | end) | ||
-- | -- Step 2: blank single-line comments | ||
content = content:gsub("%-%-[^\n]*", function(s) | content = content:gsub("%-%-[^\n]*", function(s) | ||
return | return s:gsub("[^\n]", " ") | ||
end) | end) | ||