Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Neighbors
Esassani
Mobai
Glenn
Mors
Creatures
Fish
Insects
Shore-Dwellers
Search
Search
English
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Module:Icon list
Module
Discussion
English
Read
Edit source
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit source
View history
General
What links here
Related changes
Special pages
Page information
Appearance
move to sidebar
hide
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!
-- Source: https://coralisland.fandom.com/wiki/Module:Icon_list local p = {} local lib = require('Module:Feature') local Icon = require('Module:Icon')._main function p.main(frame) local args = require('Module:Arguments').getArgs(frame, { parentFirst = true, removeBlanks = false, wrapper = { 'Template:Icon list' } }) return p._main(args) end function p._main(args) local input = args[1] or '' local itemDelim = args.delim or ';' local items = lib.split(input, itemDelim) if next(items) == nil then return mw.html.create() else return p.buildList(items, args) end end function p.splitNote(entry, notePattern) if notePattern then item, note = entry:match(notePattern) if item == nil then -- will be nil if note is not present return entry end return item, note end return entry end function p.splitParams(entry, paramDelim) if entry:find('{.-}') then local params = string.match(entry, '{(.-)}') entry = entry:gsub('{.-}', '') params = lib.split(params, paramDelim) local returns = {} for i, param in ipairs(params) do local name, val = string.match(param, '^%s*(.-)%s*=%s*(.-)%s*$') if name ~= nil and name ~= '' and val ~= nil then --named params returns[name] = val elseif param ~= nil and param ~= '' then --unnamed params table.insert(returns, param) end end return entry, returns end return entry, {} end function p.buildList(items, args) local countDelim = args.amount_delim or '*' local qualityDelim = args.quality_delim or '/' local paramDelim = args.param_delim or '$' local noteDelim = args.note_delim or '»' -- put all text after the first noteDelim into the second capture local notePattern if lib.isNotEmpty(noteDelim) then notePattern = '^(.-)' .. noteDelim .. '(.*)$' end -- list container local container = mw.html.create():tag('span') if lib.isNotEmpty(args.cols) and tonumber(args.cols) ~= nil then container = mw.html.create():tag('div'):addClass('columntemplate'):css{ ['-moz-column-count'] = args.cols, ['-webkit-column-count'] = args.cols, ['column-count'] = args.cols } end container:addClass('icon-list-container') -- icon list local list = container:tag('span') if lib.isNotEmpty(args.bullet_list) then list = container:tag('ul') elseif lib.isNotEmpty(args.inline) then list:addClass('icon-list-inline') elseif lib.isNotEmpty(args.inline_list) then list:addClass('icon-list-inline-sentence') else list:addClass('icon-list') end for i, str in ipairs(items) do if not lib.isEmpty(str) then local ret = list if lib.isNotEmpty(args.bullet_list) then ret = list:tag('li') end for num, entry in ipairs(lib.split(str, '//')) do local entry, iconArgs = p.splitParams(entry, paramDelim) --check for entry-specific params local pre, note = p.splitNote(entry, notePattern) --check for entry-specific note local pre_parts = lib.split(pre, qualityDelim) --check for entry-specific note local item = pre_parts[1] local quality = pre_parts[2] local item_parts = lib.split(item, countDelim) --check for entry-specific amount local name = item_parts[1] local amount = item_parts[2] --set icon arguments without replacing those set by entry-specific params iconArgs.name = iconArgs[1] or iconArgs.name or name iconArgs.amount = iconArgs.amount or iconArgs[2] or amount or args.amount or args[2] iconArgs.note = iconArgs.note or note iconArgs.q = iconArgs.quality or quality or args.quality iconArgs.text = iconArgs.text or args.text iconArgs.size = iconArgs.size or args.size iconArgs.link = iconArgs.link or args.link iconArgs.ext = iconArgs.ext or args.ext iconArgs.notext = iconArgs.notext or args.notext iconArgs.nolink = iconArgs.nolink or args.nolink iconArgs.prefix = iconArgs.prefix or args.prefix iconArgs.suffix = iconArgs.suffix or args.suffix -- mw.logObject(iconArgs) if num > 1 then ret:tag('i'):wikitext(' or ') end ret:node(Icon(iconArgs)) end end end return container end return p
Summary:
Please note that all contributions to The Petit Planet Wiki are considered to be released under the Creative Commons Attribution-NonCommercial-ShareAlike (see
Petit Planet: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)
Preview page with this template
Below are commonly used wikitext from
MediaWiki:Edittools
. Click on any to insert them in the edit box.
File Pages
==Summary==
==Licensing==
{{Fairuse}}
{{File|}}
Dynamic Page List
¦
²
«
»
²{¦}²
«»
«/»
«!----»
Array in DPL
¹
^2{
}^2
^2{¹}^2
Parser Functions
{{#if:||}}
{{#if:<condition>|<result if true>|<result if false>}}
{{#ifeq:|||}}
{{#ifeq:<text1>|<text2>|<result if text1=text2>|<result if text1≠text2>}}
{{#expr:}}
{{#expr:<mathematical expression>}}
{{#switch:||#default=}}
{{#switch:<text1>|<text2>=<result if text1=text2>|<text3>=<result if text1=text3>|#default=<result if no valid match>}}
{{#replace:||}}
{{#replace:<text1>|<plain text to find in text1>|<plain text to insert in place of the text found>}}
{{#titleparts:}}
{{#replace:<page name>}}
{{#tag:|}}
{{#tag:<name of html tag>|<content inside html tag>}}
Markup
{{}}
|
[]
[[]]
[[Category:]]
#REDIRECT [[]] [[Category:Redirect Pages]]
<code></code>
<includeonly></includeonly>
<noinclude></noinclude>
<nowiki></nowiki>
<!---->
<br>
§
Notices
{{Stub|}}
{{Stub Dialogue}}
{{Upcoming}}
{{Under Construction}}
{{Placeholder|}}
Magic Words
{{!}}
{{formatnum:}}
{{lc:}}
{{uc:}}
{{PAGENAME}}
{{FULLPAGENAME}}
{{ROOTPAGENAME}}
{{BASEPAGENAME}}
{{SUBPAGENAME}}
{{DISPLAYTITLE:|noreplace}}
__TOC__
__NOTOC__
__EXPECTUNUSEDCATEGORY__
__HIDDENCAT__
HTML Entities
—
,
­
Template used on this page:
Module:Icon list/doc
(
edit
)