Module:Citation/CS1: Difference between revisions
add escaping of url arguments
m>Dragons flight (avoid excess spaces, also coding seems unnecessary here) |
m>Dragons flight (add escaping of url arguments) |
||
Line 75: | Line 75: | ||
local t1 = hideinprint("[" .. id .. " " .. nowiki(frame, id) .. "]") | local t1 = hideinprint("[" .. id .. " " .. nowiki(frame, id) .. "]") | ||
return t0 .. t1 | return t0 .. t1 | ||
end | |||
function safeforurl( str ) | |||
return str:replace('[','['):replace(']',']') | |||
end | end | ||
Line 566: | Line 570: | ||
if ( ChapterLink == nil ) then | if ( ChapterLink == nil ) then | ||
if ( ChapterURL and "" < ChapterURL ) then | if ( ChapterURL and "" < ChapterURL ) then | ||
Chapter = "[" .. ChapterURL .. " " .. Chapter .. "]" | Chapter = "[" .. ChapterURL .. " " .. safeforurl( Chapter ) .. "]" | ||
elseif ( URL and "" < URL ) then | elseif ( URL and "" < URL ) then | ||
Chapter = "[" .. URL .. " " .. Chapter .. "]" | Chapter = "[" .. URL .. " " .. safeforurl( Chapter ) .. "]" | ||
URL = nil | URL = nil | ||
end | end | ||
Line 589: | Line 593: | ||
Title = Title .. TransTitle | Title = Title .. TransTitle | ||
if ( TitleLink == nil and URL and "" < URL ) then | if ( TitleLink == nil and URL and "" < URL ) then | ||
Title = "[" .. URL .. " " .. Title .. "]" | Title = "[" .. URL .. " " .. safeforurl( Title ) .. "]" | ||
URL = nil | URL = nil | ||
end | end | ||
Line 597: | Line 601: | ||
if ( Conference ~= nil and Conference ~="" ) then | if ( Conference ~= nil and Conference ~="" ) then | ||
if ( ConferenceURL ~= nil ) then | if ( ConferenceURL ~= nil ) then | ||
Conference = "[" .. ConferenceURL .. " " .. Conference .. "]" | Conference = "[" .. ConferenceURL .. " " .. safeforurl( Conference ) .. "]" | ||
end | end | ||
Conference = " " .. Conference | Conference = " " .. Conference |