localp={}functionp.parse(frame)localargs=frame:getParent().args-- This gets the arguments passed to the template that called #invoke, so we don't need to pass them all through to the module. See also [[Module:Arguments]].localvauthors=args[1]orargs.vauthorslocalauthorTablelocallastfirstTablelocalnauthorsifvauthorsthenifstring.find(vauthors,';')orstring.find(vauthors,'%.')thenverror=true-- Vancouver author format should not contain semicolons or periodselseverror=falseendauthorTable=mw.text.split(vauthors,"%s*,%s*")elseauthorTable={}endlocalciteArgs={}fork,vinpairs(args)dociteArgs[k]=vendciteArgs[1]=nil-- Erase vauthors from the citation arguments.citeArgs.vauthors=nil-- Erase vauthors from the citation arguments.nauthors=0fori,authorinipairs(authorTable)doifstring.find(author,"%s")thenlastfirstTable={}lastfirstTable=mw.text.split(author,"%s")first=table.remove(lastfirstTable)last=table.concat(lastfirstTable," ")citeArgs['first'..i]=firstciteArgs['last'..i]=lastnauthors=nauthors+1elseciteArgs['first'..i]=""citeArgs['last'..i]=authornauthors=nauthors+1endendifciteArgs['name-list-format']==nilthenciteArgs['name-list-format']="vanc"-- change default settings of authorformat, etc. parameters so that Vancouver style author format is usedendifciteArgs['display-authors']==nilandciteArgs['displayauthors']==nilandnauthors>6thenciteArgs['display-authors']='6'endifverrorthenerrorArgs={}errorArgs['1']='vauthors format'returnframe:expandTemplate{title='cite journal',args=citeArgs},frame:expandTemplate{title='citation error',args=errorArgs}elsereturnframe:expandTemplate{title='cite journal',args=citeArgs}endendreturnp