Changes

Jump to: navigation, search

Module:Citation/CS1/COinS

581 bytes added, 09:02, 26 December 2015
no edit summary
end
return title .. script; -- return the concatenation
end
 
 
--[[--------------------------< E S C A P E _ L U A _ M A G I C _ C H A R S >----------------------------------
 
Returns a string where all of lua's magic characters have been escaped. This is important because functions like
string.gsub() treat their pattern and replace strings as patterns, not literal strings.
]]
 
local function escape_lua_magic_chars (argument)
argument = argument:gsub("%%", "%%%%"); -- replace % with %%
argument = argument:gsub("([%^%$%(%)%.%[%]%*%+%-%?])", "%%%1"); -- replace all other lua magic pattern characters
return argument;
end
Anonymous user

Navigation menu