localp={}functionp.book(frame)localpframe=frame:getParent()localargs=pframe.argslocaltname="Librivox book"-- name of calling template. Change if template rename.localtitle=nil-- display and search title (default: article name w/out dab)localdtitle=nil-- display title (default: title)localstitle=nil-- search title (default: title)locallname=nil-- last namelocalid=nil-- unsupported argumentlocalauthor=nil-- authorlocaltagline1="کتاب صوتی در مالکیت عمومی "localtagline2=" واقع در [[لیبریواکس|LibriVox]]"localurlhead="https://librivox.org/search?"localitalic="''"id=trimArg(args.id)ifidthenerror("Error in Template:"..tname.." - id argument not supported - please see documentation at [[Template:Librivox author]]")endtitle=trimArg(args.title)ifnottitlethentitle=mw.title.getCurrentTitle().textenddtitle=mw.ustring.gsub(title,'%s+%([^%(]-%)$','')-- Remove the final disambig parenstitle=dtitleiftrimArg(args.stitle)thenstitle=trimArg(args.stitle)ifnottrimArg(args.title)then-- For when used outside main article spacedtitle=stitleendendiftrimArg(args.dtitle)thendtitle=trimArg(args.dtitle)italic=""endlocalstitle=mw.ustring.gsub(stitle," ","+")-- replace "<space>" with "+"author=trimArg(args.author)ifnotauthorthenlname=""else--- Split name into words, count words, set name to last wordlocalN=mw.text.split(author," ")locall,count=mw.ustring.gsub(author,"%S+","")lname=N[count]endlocalurl=tagline1.."[[File:Speaker Icon.svg|15px|link=|alt=]] ".."["..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".." "..italic..dtitle..italic.."]".." "..tagline2returnurlendfunctiontrimArg(arg)ifarg==""orarg==nilthenreturnnilelsereturnmw.text.trim(arg)endendreturnp