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 depends on the following other modules:
Called by {{Vcite2 journal}} and used as a wrapper function for Module:Citation/CS1 to parse |vauthors= and to provide error checking. See the {{Vcite2 journal}} documentation for more information.
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+1endendifnext(authorTable)==nilthenciteArgs['authorformat']="vanc"-- change default settings of authorformat, etc. parameters so that Vancouver style author format is usedendifciteArgs['author-separator']==nilthenciteArgs['author-separator']=","endifciteArgs['author-name-separator']==nilthenciteArgs['author-name-separator']=" "endifciteArgs['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