Home
Random
Log in
Settings
About the Petit Planet Wiki
Search
Editing
Module
:
Section Index
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!
local p = {} local lib = require('Module:Feature') local search = require('Module:TableTools').includes function p.main(frame) local args = require('Module:Arguments').getArgs(frame, { parentFirst = true, wrappers = {'Template:Section Index'} }) return p._main(args) end function p._main(args) args[2] = args[2]:gsub('_',' ') local title = mw.title.makeTitle('',args[1],args[2]) local pageContent = title:getContent():gsub('<!%-%-.-%-%->',''):gsub('^.-(==+)%s*','',1):gsub('\n.-(==+)%s*','%1'):gsub('%s*(==+)\n.-$',''):gsub('%s*==+%s*','//') --mw.logObject(pageContent) assert(pageContent,'Page does not exist') args.sections = lib.split(pageContent, '//' ) -- mw.logObject(args.sections,'Before') if #args.sections > 1 then for i,s in ipairs(args.sections) do local repeated = 2 for I = i+1,#args.sections do if args.sections[I] == s then args.sections[I] = args.sections[I] .. ' ' .. tostring(repeated) repeated = repeated + 1 end end end end -- mw.logObject(args.sections,'After') for k,v in ipairs(args.sections) do if v == args[2] then return tostring(k) end end return '' 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
—
,
­
Page included on this page:
Module:Section Index/doc
(
view source
)