Module:Gutenberg/sandbox: Difference between revisions

Content deleted Content added
mNo edit summary
m final version
Line 102:
local tname = "FadedPage" -- name of calling template. Change if template is renamed.
local id = nil -- ID. for author, eg. http://gutenbergfadedpage.net.aucom/plusfifty-n-zcsearch.html#shanksphp?author=Shortt%2C%20Adam .. the IDid = plusfifty-n-z.html#shanksShortt, Adam
-- ID is the same for linking an individual book titletitles, oreg. allhttp://fadedpage.com/showbook.php?pid=20160704 books by.. the author.id = 20160704
local name = nil -- display name on Wikipedia (default: article title)
local author = nil -- flag if an author (default: no)
Line 130:
if author then
if mw.ustring.lower(author) == "yes" then
id = mw.uri.encode( id, "PATH" ) -- handle spaces within id argument string
prefix = "Works by "
italic = ""
Line 142:
return url
 
end
 
function urlencode(str)
if (str) then
str = string.gsub (str, "\n", "\r\n")
str = string.gsub (str, "([^%w ])",
function (c) return string.format ("%%%02X", string.byte(c)) end)
str = string.gsub (str, " ", " ")
end
return str
end