Editing
Module
:
Sister project logo
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
require('strict') local p = {} -- determine whether we're being called from a sandbox local isSandbox = mw.getCurrentFrame():getTitle():find('sandbox', 1, true) local sandbox = isSandbox and '/sandbox' or '' -- Lazy-load logo file names and other metadata local data = mw.loadData('Module:Sister project logo/data'..sandbox) -- path to styles file local stylesFile = 'Module:Sister project logo'..sandbox..'/styles.css' -- Convert table of arguments into wiki image markup local function imageMarkup(args) local x = {} -- positional arguments first for _, arg in ipairs(args) do table.insert(x,arg) end -- named arguments converted to foo=bar for k, v in pairs(args) do if not tonumber(k) then table.insert(x,k..'='..v) end end return '[['..table.concat(x,'|')..']]' end function p._main(args) local localArgs = {} -- map possibly verbose project argument into canonical project string local project = args.project and args.project:lower() project = data.projectMap[project] or project -- image=none means bail (for [[Template:Sister project]]) if args.image == 'none' then return '' -- if image specified, return it instead of stored logo (for [[Template:Sister project]]) elseif args.image then return args.image else local logoImage = data.logo[project] -- if project is unknown, use Wikimedia logo (for [[Template:Sister project]]) if not logoImage then project = 'wm' logoImage = data.logo['wm'] end table.insert(localArgs,'File:'..logoImage) end -- size=large means use sizes from [[Template:Wikipedia's sister projects]] -- size defaults to 40x40px (for [[Template:Sister project]]) table.insert(localArgs,args.size == 'large' and (data.largeSize[project] or '35px') or args.size or '40x40px') -- if logo is PD, blank link and alt (to suppress from screen readers) if data.PDicon[project] then localArgs.link = '' localArgs.alt = '' else localArgs.alt = data.logoAlt[project] end -- Use editor-specified classes (for [[Template:Sister-inline]]) localArgs.class = "noviewer sister-project-logo"..(args.class and " "..args.class or "") local result = imageMarkup(localArgs) -- if custom CSS is available in styles.css, import it using templatestyles tag if data.customCSS[project] then local frame = mw.getCurrentFrame() local styleTag = frame:extensionTag{name = 'templatestyles', args = { src = stylesFile }} return styleTag..result end return result end function p.main(frame) local args = require('Module:Arguments').getArgs(frame) return p._main(args) or '' end return p
Summary:
Please note that all contributions to ISU Wikipedia are considered to be released under the Creative Commons Attribution (see
ISU Wikipedia:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Page included on this page:
Module:Sister project logo/doc
(
edit
)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Log in
associated-pages
Module
Discussion
English
Views
Read
Edit source
View history
More
Search
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Tools
What links here
Related changes
Page information