মডিউল:Author link
এই মডিউলের জন্য মডিউল:Author link/নথি-এ নথিপত্র তৈরি করা হয়ে থাকতে পারে
--[=[
Helper functons to construct author links
]=]
local p = {} --p stands for package
-- construct an author link from a given string
function p.constructAuthorLink(str)
-- strip "Portal:" prefixes if not piped
str = string.gsub(str, "%[%[%s*Portal:([^|]-)|?%]%]", function (target)
return "[[Portal:" .. target .. "|" .. target .. "]]"
end)
-- And for authors
str = string.gsub(str, "%[%[%s*Author:([^|]-)|?%]%]", function (target)
return "[[লেখক:" .. target .. "|" .. target .. "]]"
end)
-- auto-strip bracketed dates
str = string.gsub(str, "^((.*) +%([0-9]+[-–][0-9]+%))$", function (full_target, no_date)
return "[[লেখক:" .. full_target .. "|" .. no_date .. "]]"
end, 1)
-- if the string has its own links, return it now
if string.match(str, "%[%[") then
return str
end
if string.match(str, "[uU]nknown") then
return "[[Portal:Anonymous texts|Anonymous]]"
end
if string.match(str, "[vV]arious") then
return "Various"
end
-- if a pipe is provided
if string.match(str, "|") then
return "[[লেখক:" .. str .. "]]"
end
-- make our own piped link
return "[[লেখক:" .. str .. "|" .. str .. "]]"
end
return p