Content deleted Content added
No edit summary |
update image display for dark mode per TPER |
||
(48 intermediate revisions by 5 users not shown) | |||
Line 1:
local p = {}
function p.book(frame)
Line 8:
local tname = "Librivox book" -- name of calling template. Change if template rename.
local title = nil --
local dtitle = nil -- display title (default: title
local stitle = nil -- search title (default: title
local
local id = nil -- unsupported argument
local author = nil -- author
local tagline = "public ___domain audiobook at [[LibriVox]]"
local urlhead = "https://librivox.org/search?"
local italic = "''"
if id then
error("Error in Template:" .. tname .. " - id argument not supported - please see documentation at [[Template:Librivox author]]")
end
if not title then
title = mw.title.getCurrentTitle().text
dtitle = title▼
stitle = dtitle▼
else▼
▲ title = mw.text.trim(args.title)
end
dtitle = mw.ustring.gsub(
if trimArg(args.stitle
stitle =
if not trimArg(args.title) then -- For when used outside main article space
end
end
if trimArg(args.dtitle
dtitle =
italic = ""
end
▲ dtitle = mw.ustring.gsub(dtitle,"%s%(.*%)", "") -- remove disambiguation ()
stitle = mw.ustring.gsub(stitle,"%s%(.*%)", "")▼
stitle = mw.ustring.gsub(stitle," ", "+") -- replace "<space>" with "+"▼
▲ local stitle = mw.ustring.gsub(stitle," ", "+") -- replace "<space>" with "+"
--- Split name into words, count words, set name to last word▼
local N = mw.text.split(name, " ")▼
name = N[count]▼
author = trimArg(args.author)
local url = "[" .. urlhead .. "title=" .. stitle .. "&author=" .. name .. "&reader=&keywords=&genre_id=0&status=all&project_type=either&recorded_language=&sort_order=catalog_date&search_page=1&search_form=advanced" .. " " .. tagline▼
if not author then
lname = ""
▲ else
▲ --- Split name into words, count words, set name to last word
end
▲ local url = "[[File:Speaker Icon.svg|15px|class=skin-invert-image|link=|alt=]] " .. "[" .. urlhead .. "title=" .. stitle .. "&author=" ..
return "Hello"▼
end
function trimArg(arg)
if arg == "" or arg == nil then
return nil
else
return mw.text.trim(arg)
end
end
|