Module:Gutenberg
Appearance
![]() | This module is rated as beta, and is ready for widespread use. It is still new and should be used with some caution to ensure the results are as expected. |
![]() | This module is subject to page protection. It is a highly visible module in use by a very large number of pages, or is substituted very frequently. Because vandalism or mistakes would affect many pages, and even trivial editing might cause substantial load on the servers, it is protected from editing. |
![]() | This Lua module is used on approximately 12,000 pages and changes may be widely noticed. Test changes in the module's /sandbox or /testcases subpages, or in your own module sandbox. Consider discussing changes on the talk page before implementing them. |
This module uses the Wikidata property:
Usage
There are currently 3 templates that invoke this module, {{Gutenberg author}}
, {{Gutenberg Australia}}
and {{FadedPage}}
(Canada)
local p = {}
function p.author(frame)
local pframe = frame:getParent()
local args = pframe.args
local tname = "Gutenberg author" -- name of calling template. Change if template is renamed.
local id = nil -- author name, or author number. The later will go direct to the author page, the former to a search results page.
local name = nil -- display name on Wikipedia (default: article title)
local url = nil
local tagline = "at [[Project Gutenberg]]"
local urlheadname = "//www.gutenberg.org/author/"
local urlheadnumb = "//www.gutenberg.org/ebooks/author/"
local urlhead = nil
if args.id == "" or args.id == nil then
return error("Parameter id is missing. See [[Template:" .. tname .. "]] documentation")
else
id = mw.text.trim(args.id)
if tonumber(id) ~= nil then -- it's a number
urlhead = urlheadnumb
else
urlhead = urlheadname
end
end
if args.name == "" or args.name == nil then
name = mw.title.getCurrentTitle().basePageTitle
else
name = mw.text.trim(args.name)
end
url = "[" .. urlhead .. id .. " Works by " .. name .. "] " .. tagline
return url
end
return p