local data =
data.MSW3 = "Cite book", citationArgs =, customArgs =, chapters =, -- end orders rodents = . data.MSW3.id = function(id) local chapterParams = --local page = data.MSW3.chapters[order]['page'] -- page for google books
chapterParams['chapter'] = "Taxon ID: " .. id chapterParams['chapter-url'] = data.MSW3.customArgs['baseURL'] .. data.MSW3.customArgs['searchStr'] .. id local url = data.MSW3.customArgs['googleBooksURL'] --.. page local title = data.MSW3.customArgs['defaultTitle'] -- the book title chapterParams['title'] = title return title, url, chapterParamsenddata.MSW3.order = function(order) local chapterParams = data.MSW3.chapters[order] local id = data.MSW3.chapters[order]['id'] -- chapter parameters local page = data.MSW3.chapters[order]['page']-- local pages = data.MSW3.chapters[order]['pages'] chapterParams['chapter'] = "Order " .. order local title = data.MSW3.CustomArgs['defaultTitle'] chapterParams['title'] = title local url = data.MSW3.customArgs['googleBooksURL'] .. tostring(page) chapterParams['chapter-url'] = data.MSW3.customArgs['baseURL'] .. data.MSW3.customArgs['searchStr'] .. id chapterParams['url'] = url chapterParams.page=nil return title, url, chapterParamsend
data.MSW3_standalone = function(frame) local data = require('Module:FishRef/MSW') initialise(frame, data.MSW3) local url = target.customArgs['baseURL'] if templateArgs['title'] and templateArgs['id'] then templateArgs['chapter-url']= url .. target.customArgs['searchStr'] .. templateArgs['id'] templateArgs['chapter'] = templateArgs['title'] templateArgs['title'] = target.customArgs['bookTitle'] if templateArgs['page'] then templateArgs['url'] = target.customArgs['googleBooksURL'] .. templateArgs['page'] else --return "Page number for google books required" end elseif templateArgs['order'] then templateArgs['chapter'] = "Order " .. templateArgs['order'] local chapter = target.chapters[templateArgs['order']] for k,v in pairs(chapter) do -- add chapter specific parameters templateArgs[k] = v end templateArgs['chapter-url']= url .. target.customArgs['searchStr'] .. templateArgs['id'] templateArgs['url']= target.customArgs['googleBooksURL'] .. templateArgs['page'] if templateArgs['pages'] and templateArgs['page'] then templateArgs['page'] = nil end else -- default output templateArgs['url']= target.customArgs['googleBooksURL'] .. "1" -- default to book templateArgs['url']= url end -- using cite book clearCustomArgs--blank template parameters not for cite web return frame:expandTemplateend
data.MSW3.main = function(frame, targs)
local customArgs = data.MSW3.customArgs local chapter = targs['title'] or targs['chapter'] -- custom title from template parameters
targs['title'] = customArgs ['defaultTitle'] -- the cite book title/work is always the default title if chapter and targs['id'] then targs['chapter-url']= customArgs['baseURL'] .. customArgs['searchStr'] .. targs['id'] targs['chapter'] = chapter if targs['page'] then targs['url'] = customArgs['googleBooksURL'] .. targs['page'] else --return "Page number for google books required" end local order = targs['order'] -- get chapter author parameters if order then local chapterArgs = data.MSW3.chapters[order] for k,v in pairs(chapterArgs) do -- add chapter specific parameters if (k
'pages') and targs['page'] then targs['pages'] = nil else targs[k] = v end end end elseif targs['order'] then local chapterArgs = data.MSW3.chapters[targs['order']] for k,v in pairs(chapterArgs) do -- add chapter specific parameters targs[k] = v end targs['chapter'] = "Order " .. targs['order'] targs['chapter-url']= customArgs['baseURL'] .. customArgs['searchStr'] .. targs['id'] targs['url'] = customArgs['googleBooksURL'] .. targs['page'] if targs['pages'] and targs['page'] then targs['page'] = nil end else -- default output targs['url'] = customArgs['baseURL'] .. data.MSW3.customArgs['searchStr'] -- default to web version targs['url'] = customArgs['googleBooksURL'] .. "1" -- default to book end --clear stuff targs[1]=nil targs['order']=nil targs['id']=nil --return targs['title'] -- use template:cite book return frame:expandTemplateend
return data