Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Special pages
Random page
Wiki Discord
Contents
Neighbors
Galaxy
> Hexia
> Norvan
> Pashah
> Taffeh
Creatures
> Insects
> Fishes
> Shore-Dwellers
Items
> Dishes
> Furniture
Game Systems
> Dress Up
> Luca Arbor
> Loomix Footprints
> Loomix Vehicle Services
> Loomix Homes
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Editing
Module
:
Nested Lists
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
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Once you make an edit, a temporary account will be created for you.
Learn more
.
Log in
or
create an account
to continue receiving notifications after this account expires, and to access other features.
Anti-spam check. Do
not
fill this in!
local p = {} local exists = require('Module:Exists') local levels = { [''] = 0, ['//'] = 1, ['$$'] = 2, ['%%'] = 3, ['&&'] = 4, } function p.main(frame) local args = require('Module:Arguments').getArgs(frame, { parentFirst = true, wrapper = {'Template:Nested Lists'} }) return p._main(args) end function p._main(args) local input = args[1] or '' local link = args.link == '1' local iconFormat = args.icon local iconMain = args.icon_main == '1' local iconSize = args.icon_size or '25' -- Allow icon_size to be written as either 25 or 25px. iconSize = mw.text.trim(tostring(iconSize)) iconSize = mw.ustring.gsub(iconSize, '[pP][xX]$', '') if iconSize == '' then iconSize = '25' end local output = {} -- Each semicolon separates an item. for item in mw.text.gsplit(input, ';', true) do item = mw.text.trim(item) if item ~= '' then local marker = '' local text = item -- Determine indentation marker. local prefix = mw.ustring.sub(item, 1, 2) if levels[prefix] ~= nil then marker = prefix text = mw.text.trim(mw.ustring.sub(item, 3)) end local level = levels[marker] or 0 -- [no] disables the icon for this item. local noIcon = false local customIcon = nil if mw.ustring.sub(text, 1, 4) == '[no]' then noIcon = true text = mw.text.trim(mw.ustring.sub(text, 5)) else -- [Icon Name.png] specifies a custom icon. local customIconName, remainingText = mw.ustring.match(text, '^%[([^%]]+)%]%s*(.*)$') if customIconName then customIcon = mw.text.trim(customIconName) text = mw.text.trim(remainingText) end end -- Separate page target and display label. local target = text local label = text local separator = mw.ustring.find(text, '|', 1, true) if separator then target = mw.text.trim(mw.ustring.sub(text, 1, separator - 1)) label = mw.text.trim(mw.ustring.sub(text, separator + 1)) end -- Check whether the target page exists. local pageExists = false if link and target ~= '' then pageExists = exists.checkExists(target) end -- Generate the icon. local icon = '' if not noIcon then local iconName = customIcon -- Use the global icon format unless icon_main is enabled -- and this is not a level 0 item. if not iconName and iconFormat and iconFormat ~= '' and (not iconMain or level == 0) then iconName = mw.ustring.gsub( iconFormat, '{item}', function() return target end ) end if iconName and iconName ~= '' then -- Check whether the requested icon exists. if not exists.checkExists('File:' .. iconName) then iconName = 'Unknown.png' end -- Link the icon to the item page if it exists. if pageExists then icon = string.format( '[[File:%s|%spx|link=%s]]', iconName, iconSize, target ) else icon = string.format( '[[File:%s|%spx]]', iconName, iconSize ) end end end -- Generate the text. local displayText = label if pageExists then displayText = '[[' .. target .. '|' .. label .. ']]' end -- Combine icon and text. local content = displayText if icon ~= '' then content = icon .. ' ' .. displayText end table.insert( output, string.rep('*', level + 1) .. ' ' .. content ) end end return table.concat(output, '\n') end return p
Summary:
Please note that all contributions to The Petit Planet Wiki are considered to be released under the Creative Commons Attribution-ShareAlike (see
Petit Planet Wiki: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
—
,
­
Pages included on this page:
Template:Documentation/Header
(
edit
)
Template:Documentation/styles.css
(
edit
)
Template:T
(
edit
)
Template:TOC Right
(
edit
)
Module:Arguments
(
edit
)
Module:Arguments/i18n
(
edit
)
Module:Common/i18n
(
edit
)
Module:Config
(
edit
)
Module:Documentation
(
edit
)
Module:Documentation/config
(
edit
)
Module:Documentation/i18n
(
edit
)
Module:Entrypoint
(
edit
)
Module:Exists
(
edit
)
Module:Fallbacklist
(
edit
)
Module:Feature
(
edit
)
Module:Formatting
(
edit
)
Module:I18n
(
edit
)
Module:Languages
(
edit
)
Module:Nested Lists/doc
(
edit
)
Module:TableTools
(
edit
)
Module:Yesno
(
edit
)
This page is a member of 2 hidden categories:
Category:Pages using DynamicPageList4 parser function
Category:Pages using DynamicPageList4
Search
Search
Editing
Module
:
Nested Lists
Add topic