Module:Citation/CS1: Difference between revisions
formatting and comments
m>Dragons flight (Faster that gsub chains) |
m>Dragons flight (formatting and comments) |
||
Line 79: | Line 79: | ||
function safeforurl( str ) | function safeforurl( str ) | ||
return str:gsub( '[%[%]\n]', { | return str:gsub( '[%[%]\n]', { | ||
['['] = '[', | |||
[']'] = ']', | |||
['\n'] = ' ' } ); | |||
end | end | ||
Line 89: | Line 89: | ||
function safeforitalics( str ) | function safeforitalics( str ) | ||
--[[ Note: We can not use <i> for italics, as the expected behavior for | |||
italics specified by ''...'' in the title is that they will be inverted | |||
(i.e. unitalicized) in the resulting references. In addition, <i> and '' | |||
tend to interact poorly under Mediawiki's HTML tidy. ]] | |||
if str == nil or str == '' then | if str == nil or str == '' then | ||
return str; | return str; |