Edge Rewrite
// HTMLRewriter · presentation

This page was redesigned at the edge.

Cloudflare fetched the original article and streamed it through HTMLRewriter to apply an entirely new visual system without rebuilding the source page.

Jump to content

Module:Cite taxon/MSW

From Wikipedia, the free encyclopedia
local data = {}

data.MSW3 = {
    citeTemplate = "Cite book",
	citationArgs = {
		['editor1-last'] = "Wilson", ['editor1-first'] = "D.E.", ['editor1-link'] = "Don E. Wilson",
		['editor2-last'] = "Reeder", ['editor2-first'] = "D.M.",
        year = 2005,
		title = "Mammal Species of the World: A Taxonomic and Geographic Reference", 
		
		edition = "3rd",
        publisher =  "Johns Hopkins University Press",
        isbn= "978-0-8018-8221-0",
        oclc= "62265494"
	},
	customArgs = { exclude="order,family, taxon,id,1",
	               baseURL = "http://www.departments.bucknell.edu/biology/resources/msw3/browse.asp",
	               defaultTitle = "Mammal Species of the World: A Taxonomic and Geographic Reference",
	               bookTitle = "redundant title",
	               googleBooksURL = "http://www.google.com/books?id=JgAMbNSt8ikC&pg=PA",
	               searchStr = "?id=",
	},
    chapters = {
    	Monotremata = {
    		id = 1030000,
    		last = "Groves", first = "C.P.", ['author-link'] = "Colin Groves",
    		pages = "1–2", page = 1,
    	},
        Didelphimorphia = {
        	id = 10400001,
            last = "Gardner", first = "A.L.",
            pages = "3-18", page = 3,
        },
    	Paucituberculata = {
    		id = 10500001,
            last = "Gardner", first = "A.L.",
            pages = "19-20", page = 19,
    	},
    	Microbiotheria = {
    		id = 10600001,},
            last = "Gardner", first = "A.L.",
            pages = "21", page = 21,
	    Notoryctemorphia = {
	    	id = 10700001,
    		last = "Groves", first = "C.P.", ['author-link'] = "Colin Groves",
    		pages = "22", page = 22,
	    },
	    Dasyuromorphia = {
	    	id = 10800001,
    		last = "Groves", first = "C.P.", ['author-link'] = "Colin Groves",
    		pages = "23-37", page = 23,
	    },
	    Peramelemorphia = {
	    	id = 10900001,
    		last = "Groves", first = "C.P.", ['author-link'] = "Colin Groves",
    		pages = "38-42", page = 38,
	    },
	    Diprotodontia = {
	    	id = 11000001,
    		last = "Groves", first = "C.P.", ['author-link'] = "Colin Groves",
    		pages = "43-70", page = 43,
	    },
	    Afrosoricida = {
	    	id = 11100001,
	    	last = "Bronner", first = "G.N.",
	    	last2 = "Jenkins", first2 = "P.D.",
	    	pages = "71–81", page = 71,
	    },
	    Macroscelidea = {
	    	id = 11200001,
	    	last = "Schlitter", first = "D.A.",
	    	pages = "82–85", page = 82,
	    },
	    Tubulidentata = {
	    	id = 11300001,
	    	last = "Schlitter", first = "D.A.",
	    	pages = "86", page = 86,
	    },
	    Hyracoidea = {
	    	id = 11400001,
	    	last = "Shoshani", first = "J.", ['author-link'] = "Jeheskel Shoshani",
	    	pages = "87-89", page = 87,
	    },
	    Proboscidea = {
	    	id = 11500001,
	    	last = "Shoshani", first = "J.", ['author-link'] = "Jeheskel Shoshani",
	    	pages = "90-91", page = 90,
	    },
	    Sirenia = {
	    	id = 11600001,
	    	last = "Shoshani", first = "J.", ['author-link'] = "Jeheskel Shoshani",
	    	pages = "92-93", page = 92,
	    },
	    Cingulata = {
	    	id = 11700001,
            last = "Gardner", first = "A.L.",
            pages = "94-99", page = 94,
	    	
	    },
    	Pilosa = {
    		id = 11800001,
            last = "Gardner", first = "A.L.",
            pages = "100-103", page = 100,
    	},
	    Scandentia = {
	    	id = 11900001,
	    	last = "Helgen", first = "K.M.",
	    	pages = "104-109", page = 104,
	    },
	    Dermoptera = {
	    	id = 12000001,
	    	last = "Stafford", first = "B.J.",
	    	pages = "104", pages = 104,
	    },
	    Primates = {
	    	id = 12100001,
    		last = "Groves", first = "C.P.", ['author-link'] = "Colin Groves",
    		pages = "111-184", page = 111,
	    },
	    Rodentia = {
	    	id = 12200001,                        -- these increment by family   TODO
	    	--last = "Helgen", first = "K.M.",   -- various authors
	    	pages = "753-1600",
	    },    
	    Lagomorpha = {
	    	id = 13500001,
	    	last = "Hoffman", first = "R.S.",
	    	last2 = "Smith", first2 = "A.T.",
	    	pages = "185–211", page = 185,
	    },
	    Erinaceomorpha = {
	    	id = 13600001,
	        last = "Hutterer", first = "R.",
	        pages = "212–219", page = 212,
	    },
	    Soricomorpha = {
	    	id = 13700001,
	        last = "Hutterer", first = "R.",
	        pages = "220–311", page = 220,
	    },
	    Chiroptera = {
	    	id = 13800001,
	    	last = "Simmons", first = "N.B.",
	    	pages = "312–529",
	    },
	    Pholidota = {
	    	id = 13900001,
	    	last = "Schlitter", first = "D.A.",
	    	pages = "530-531", page = 530,
	    },
	    Carnivora = {
	    	id = 14000001,
	    	last = "Wozencraft", first = "W.C.",
	    	pages = "532–628", page = 532,
	    },
	    Perissodactyla = {
	        id = 14100001,
	        last = "Grubb", first = "P.", ['author-link'] = "Peter Grubb (zoologist)", 
	        pages="629–636", page=629,
	    },
	    Artiodactyla = {
	        id = 14200001,
	        last = "Grubb", first = "P.", ['author-link'] = "Peter Grubb (zoologist)", 
	        pages = "645–646", page =645,
	    },
	    Cetacea = {
	    	id = 14300001,
	    	last = "Mead", first = "J.G.",
	    	last2 = "Brownell", first2 = "R. L. Jr.",
	    	pages = "723–743", page=723,
	    },

    },   -- end orders
    rodents = {
    	Ctenodactylidae = {
    		id=13300001,
			last = "Dieterlen", first = "F.",
			pages = "1536–1537", page= 1536,
		},
        Hystricognathi = {
	        id=13400001,
	        last = "Woods", first = "C.A.",
	        last2 = "Kilpatrick", first2 = "C.W.", 
	        pages = "1538–1600", page = 1538,
        }
    }
}
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, chapterParams
end
data.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, chapterParams
end

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:expandTemplate{ title = 'cite book', args = templateArgs  }
end

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 == 'page' or 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:expandTemplate{ title = data.MSW3.citeTemplate, args = targs  }
end

return data