<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://willamette.earth/wiki/index.php?action=history&amp;feed=atom&amp;title=Module%3AAppropedia</id>
	<title>Module:Appropedia - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://willamette.earth/wiki/index.php?action=history&amp;feed=atom&amp;title=Module%3AAppropedia"/>
	<link rel="alternate" type="text/html" href="https://willamette.earth/wiki/index.php?title=Module:Appropedia&amp;action=history"/>
	<updated>2026-04-23T01:45:59Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.42.3</generator>
	<entry>
		<id>https://willamette.earth/wiki/index.php?title=Module:Appropedia&amp;diff=65&amp;oldid=prev</id>
		<title>Appropedia&gt;Sophivorus: Remove deprecated methods and rename pageExists to exists</title>
		<link rel="alternate" type="text/html" href="https://willamette.earth/wiki/index.php?title=Module:Appropedia&amp;diff=65&amp;oldid=prev"/>
		<updated>2024-03-01T14:30:21Z</updated>

		<summary type="html">&lt;p&gt;Remove deprecated methods and rename pageExists to exists&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;-- Module:Appropedia implements all Appropedia-specific Lua features&lt;br /&gt;
-- This module uses Appropedia&amp;#039;s custom Lua library, see https://github.com/Appropedia/extension&lt;br /&gt;
-- This module is used throughout the entire site, so any changes will trigger thousands of updates&lt;br /&gt;
-- Author: Felipe Schenone (User:Sophivorus)&lt;br /&gt;
-- License: GNU General Public License 3 or later (http://www.gnu.org/licenses/gpl-3.0.html)&lt;br /&gt;
local Appropedia = {}&lt;br /&gt;
&lt;br /&gt;
-- Check whether the given page exists&lt;br /&gt;
-- including Commons and without recording a link&lt;br /&gt;
-- Used by [[Template:EXISTS]]&lt;br /&gt;
function Appropedia.exists( frame )&lt;br /&gt;
	local page = frame.args[1]&lt;br /&gt;
	if not page or mw.text.trim( page ) == &amp;#039;&amp;#039; then&lt;br /&gt;
		page = mw.title.getCurrentTitle().prefixedText&lt;br /&gt;
	end&lt;br /&gt;
	if mw.ext.appropedia.pageExists( page ) then&lt;br /&gt;
		return 1&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Return the video service out of a video URL, id or file name&lt;br /&gt;
-- Note! This method assumes that the video exists and will return &amp;#039;commons&amp;#039; if it doesn&amp;#039;t&lt;br /&gt;
-- Used by [[Template:Video]]&lt;br /&gt;
function Appropedia.videoService( frame )&lt;br /&gt;
	local video = frame.args[1]&lt;br /&gt;
	if string.match( video, &amp;#039;vimeo&amp;#039; ) then&lt;br /&gt;
		return &amp;#039;vimeo&amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
	if string.match( video, &amp;#039;youtu&amp;#039; ) then&lt;br /&gt;
		return &amp;#039;youtube&amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
	if string.match( video, &amp;#039;^%d+$&amp;#039; ) then&lt;br /&gt;
		return &amp;#039;vimeo&amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
	if string.match( video, &amp;#039;^[%d%a_-]+$&amp;#039; ) then&lt;br /&gt;
		return &amp;#039;youtube&amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
	local title = mw.title.new( video, 6 )&lt;br /&gt;
	-- Use PROTECTIONEXPIRY to prevent https://phabricator.wikimedia.org/T14019&lt;br /&gt;
	if frame:callParserFunction( &amp;#039;PROTECTIONEXPIRY&amp;#039;, &amp;#039;edit&amp;#039;, title.fullText ) == &amp;#039;&amp;#039; then&lt;br /&gt;
		return &amp;#039;commons&amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
	return &amp;#039;appropedia&amp;#039;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Return the video ID out of a video URL&lt;br /&gt;
-- Used by [[Template:Video]]&lt;br /&gt;
function Appropedia.videoID( frame )&lt;br /&gt;
	local url = frame.args[1]&lt;br /&gt;
	local parts = mw.text.split( url, &amp;#039;&amp;amp;&amp;#039;, true )&lt;br /&gt;
	local id = parts[1]&lt;br /&gt;
	id = string.gsub( id, &amp;#039;https://www%.youtube%.com/watch%?v=&amp;#039;, &amp;#039;&amp;#039; )&lt;br /&gt;
	id = string.gsub( id, &amp;#039;https://youtu%.be/&amp;#039;, &amp;#039;&amp;#039; )&lt;br /&gt;
	id = string.gsub( id, &amp;#039;https://vimeo%.com/&amp;#039;, &amp;#039;&amp;#039; )&lt;br /&gt;
	return id&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Return the affiliation of the given user name out of the email domain&lt;br /&gt;
-- Used by [[Template:User data]]&lt;br /&gt;
function Appropedia.affiliation( frame )&lt;br /&gt;
	local map = {&lt;br /&gt;
		[ &amp;#039;alum.mit.edu&amp;#039; ] = &amp;#039;Massachusetts Institute of Technology&amp;#039;,&lt;br /&gt;
		[ &amp;#039;auburn.edu&amp;#039; ] = &amp;#039;Auburn University&amp;#039;,&lt;br /&gt;
		[ &amp;#039;berkeley.edu&amp;#039; ] = &amp;#039;Berkeley University of California&amp;#039;,&lt;br /&gt;
		[ &amp;#039;bsu.edu&amp;#039; ] = &amp;#039;Ball State University&amp;#039;,&lt;br /&gt;
		[ &amp;#039;carinya.nsw.edu.au&amp;#039; ] = &amp;#039;Carinya Christian School&amp;#039;,&lt;br /&gt;
		[ &amp;#039;clarion.edu&amp;#039; ] = &amp;#039;Pennsylvania Western University Clarion&amp;#039;,&lt;br /&gt;
		[ &amp;#039;clarkson.edu&amp;#039; ] = &amp;#039;Clarkson University&amp;#039;,&lt;br /&gt;
		[ &amp;#039;cornell.edu&amp;#039; ] = &amp;#039;Cornell University&amp;#039;,&lt;br /&gt;
		[ &amp;#039;csuci.edu&amp;#039; ] = &amp;#039;California State University Channel Islands&amp;#039;,&lt;br /&gt;
		[ &amp;#039;deakin.edu.au&amp;#039; ] = &amp;#039;Deakin University&amp;#039;,&lt;br /&gt;
		[ &amp;#039;diu.edu.bd&amp;#039; ] = &amp;#039;Daffodil International University&amp;#039;,&lt;br /&gt;
		[ &amp;#039;edinboro.edu&amp;#039; ] = &amp;#039;Edinboro University&amp;#039;,&lt;br /&gt;
		[ &amp;#039;eiu.edu&amp;#039; ] = &amp;#039;Eastern Illinois University&amp;#039;,&lt;br /&gt;
		[ &amp;#039;fordham.edu&amp;#039; ] = &amp;#039;Fordham University&amp;#039;,&lt;br /&gt;
		[ &amp;#039;gmu.edu&amp;#039; ] = &amp;#039;George Mason University&amp;#039;,&lt;br /&gt;
		[ &amp;#039;griffith.edu.au&amp;#039; ] = &amp;#039;Griffith University&amp;#039;,&lt;br /&gt;
		[ &amp;#039;humboldt.edu&amp;#039; ] = &amp;#039;Cal Poly Humboldt&amp;#039;,&lt;br /&gt;
		[ &amp;#039;hust.edu.cn&amp;#039; ] = &amp;#039;Huazhong University&amp;#039;,&lt;br /&gt;
		[ &amp;#039;indiana.edu&amp;#039; ] = &amp;#039;Indiana University&amp;#039;,&lt;br /&gt;
		[ &amp;#039;iut-dhaka.edu&amp;#039; ] = &amp;#039;Islamic University of Technology&amp;#039;,&lt;br /&gt;
		[ &amp;#039;jcu.edu.au&amp;#039; ] = &amp;#039;James Cook University&amp;#039;,&lt;br /&gt;
		[ &amp;#039;mail.usf.edu&amp;#039; ] = &amp;#039;University of South Florida&amp;#039;,&lt;br /&gt;
		[ &amp;#039;maxwell.syr.edu&amp;#039; ] = &amp;#039;Maxwell School of Citizenship and Public Affairs&amp;#039;,&lt;br /&gt;
		[ &amp;#039;mit.edu&amp;#039; ] = &amp;#039;Massachusetts Institute of Technology&amp;#039;,&lt;br /&gt;
		[ &amp;#039;msu.edu&amp;#039; ] = &amp;#039;Michigan State University&amp;#039;,&lt;br /&gt;
		[ &amp;#039;mtu.edu&amp;#039; ] = &amp;#039;Michigan Technological University&amp;#039;,&lt;br /&gt;
		[ &amp;#039;murdoch.edu.au&amp;#039; ] = &amp;#039;Murdoch University&amp;#039;,&lt;br /&gt;
		[ &amp;#039;ncsu.edu&amp;#039; ] = &amp;#039;North Carolina State University&amp;#039;,&lt;br /&gt;
		[ &amp;#039;ou.edu&amp;#039; ] = &amp;#039;University of Oklahoma&amp;#039;,&lt;br /&gt;
		[ &amp;#039;pgrad.unimelb.edu.au&amp;#039; ] = &amp;#039;University of Melbourne&amp;#039;,&lt;br /&gt;
		[ &amp;#039;principia.edu&amp;#039; ] = &amp;#039;The Principia&amp;#039;,&lt;br /&gt;
		[ &amp;#039;psu.edu&amp;#039; ] = &amp;#039;Pennsylvania State University&amp;#039;,&lt;br /&gt;
		[ &amp;#039;rams.colostate.edu&amp;#039; ] = &amp;#039;Colorado State University&amp;#039;,&lt;br /&gt;
		[ &amp;#039;rci.rutgers.edu&amp;#039; ] = &amp;#039;Rutgers University&amp;#039;,&lt;br /&gt;
		[ &amp;#039;scots.edinboro.edu&amp;#039; ] = &amp;#039;Edinboro University&amp;#039;,&lt;br /&gt;
		[ &amp;#039;sfsu.edu&amp;#039; ] = &amp;#039;San Francisco State University&amp;#039;,&lt;br /&gt;
		[ &amp;#039;snceagles.sierranevada.edu&amp;#039; ] = &amp;#039;Sierra Nevada University&amp;#039;,&lt;br /&gt;
		[ &amp;#039;southalabama.edu&amp;#039; ] = &amp;#039;University of South Alabama&amp;#039;,&lt;br /&gt;
		[ &amp;#039;sru.edu&amp;#039; ] = &amp;#039;Slippery Rock University&amp;#039;,&lt;br /&gt;
		[ &amp;#039;students.olin.edu&amp;#039; ] = &amp;#039;Olin College of Engineering&amp;#039;,&lt;br /&gt;
		[ &amp;#039;tuskegee.edu&amp;#039; ] = &amp;#039;Tuskegee University&amp;#039;,&lt;br /&gt;
		[ &amp;#039;u.boisestate.edu&amp;#039; ] = &amp;#039;Boise State University&amp;#039;,&lt;br /&gt;
		[ &amp;#039;udayton.edu&amp;#039; ] = &amp;#039;University of Dayton&amp;#039;,&lt;br /&gt;
		[ &amp;#039;umich.edu&amp;#039; ] = &amp;#039;University of Michigan&amp;#039;,&lt;br /&gt;
		[ &amp;#039;unab.edu.co&amp;#039; ] = &amp;#039;Universidad Autónoma de Bucaramanga&amp;#039;,&lt;br /&gt;
		[ &amp;#039;unlv.nevada.edu&amp;#039; ] = &amp;#039;University of Nevada&amp;#039;,&lt;br /&gt;
		[ &amp;#039;uoregon.edu&amp;#039; ] = &amp;#039;University of Oregon&amp;#039;,&lt;br /&gt;
		[ &amp;#039;virginia.edu&amp;#039; ] = &amp;#039;University of Virginia&amp;#039;,&lt;br /&gt;
		[ &amp;#039;vols.utk.edu&amp;#039; ] = &amp;#039;University of Tennessee&amp;#039;,&lt;br /&gt;
		[ &amp;#039;usf.edu&amp;#039; ] = &amp;#039;University of South Florida&amp;#039;,&lt;br /&gt;
	}&lt;br /&gt;
	local user = frame.args[1] or mw.title.getCurrentTitle().text&lt;br /&gt;
	if not user or mw.text.trim( user ) == &amp;#039;&amp;#039; then error( &amp;#039;missing user name&amp;#039; ) end&lt;br /&gt;
	local domain = mw.ext.appropedia.emailDomain( user )&lt;br /&gt;
	domain = string.lower( mw.text.trim( domain ) )&lt;br /&gt;
	return map[ domain ]&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Return the categories of the given or current page as a comma-separated list&lt;br /&gt;
-- Used by [[Template:Automatic translation notice]]&lt;br /&gt;
function Appropedia.categories( frame )&lt;br /&gt;
	local page = frame.args[1] or mw.title.getCurrentTitle().prefixedText&lt;br /&gt;
	if not page or mw.text.trim( page ) == &amp;#039;&amp;#039; then error( &amp;#039;missing page name&amp;#039; ) end&lt;br /&gt;
	local categories = mw.ext.appropedia.pageCategories( page )&lt;br /&gt;
	return table.concat( categories, &amp;#039;, &amp;#039; )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return Appropedia&lt;/div&gt;</summary>
		<author><name>Appropedia&gt;Sophivorus</name></author>
	</entry>
</feed>