This is an old revision of this page, as edited by GreenC(talk | contribs) at 14:42, 18 March 2015(←Created page with 'local p = {} function p.book(frame) local pframe = frame:getParent() local args = pframe.args local tname = "Librivox book" -- name of calling template...'). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.Revision as of 14:42, 18 March 2015 by GreenC(talk | contribs)(←Created page with 'local p = {} function p.book(frame) local pframe = frame:getParent() local args = pframe.args local tname = "Librivox book" -- name of calling template...')
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.
Usage
There is currently 1 template that invokes this module, {{Librivox book}}.
localp={}functionp.book(frame)localpframe=frame:getParent()localargs=pframe.argslocaltname="Librivox book"-- name of calling template. Change if template rename.localdtitle=nil-- display title (default: title field)localstitle=nil-- search title (default: title field)localtagline="public domain audiobook at [[LibriVox]]"localurlhead="https://librivox.org/search?"ifargs.title==""orargs.title==nilthentitle=mw.title.getCurrentTitle().textdtitle=titlestitle=dtitleelsetitle=mw.text.trim(args.title)dtitle=titlestitle=dtitleendifargs.stitle~=nilandargs.stitle~=""thenstitle=mw.text.trim(args.stitle)endifargs.dtitle~=nilandargs.dtitle~=""thendtitle=mw.text.trim(args.dtitle)enddtitle=mw.ustring.gsub(dtitle,"%s%(.*%)","")-- remove disambiguation () stitle=mw.ustring.gsub(stitle,"%s%(.*%)","")stitle=mw.ustring.gsub(stitle," ","+")-- replace "<space>" with "+"ifargs.author==""orargs.author==nilthenname=""else--- Split name into words, count words, set name to last wordlocalN=mw.text.split(mw.text.trim(args.author)," ")locall,count=mw.ustring.gsub(mw.text.trim(args.author),"%S+","")lname=N[count]endlocalurl="[[Image:Speaker Icon.svg|20px]] ".."["..urlhead.."title="..stitle.."&author="..lname.."&reader=&keywords=&genre_id=0&status=all&project_type=either&recorded_language=&sort_order=catalog_date&search_page=1&search_form=advanced".." ".."''"..dtitle.."''".."]".." "..taglinereturnurlendreturnp