Home
Random
Log in
Settings
About the Honkai: Nexus Anima Wiki
Disclaimers
Search
Editing
Module
:
Table Wrapper
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 lib = require('Module:Feature') local ne = lib.isNotEmpty local ie = lib.isEmpty function attrTable(attrString) local out = {} for val in string.gmatch(attrString, '([^;]+)') do local attr, tag = string.match(val, '(.+):(.+)') attr = lib.trim(attr) tag = lib.trim(tag) if ne(attr) and ne(tag) then out[attr] = tag end end return out end function p.main(frame) local args = require('Module:Arguments').getArgs(frame, { parentFirst = true, removeBlanks = false, wrapper = { 'Template:Table Wrapper' } }) return p._main(frame, args) end function p._main(frame, args) local class = args['class'] or 'article-table' local tableCss = args['style'] or '' local size = args['size'] if ie(size) then return mw.html.create('span') :addClass('error') :wikitext('Table size is invalid. Please enter a valid size in the form r;c.') end local row, col = string.match(size, '(%d+);(%d+)') if row == nil or col == nil then return mw.html.create('span') :addClass('error') :wikitext('Table size is invalid: ', size, '. Please enter a valid size in the form r;c.') end row = tonumber(row) col = tonumber(col) -- Check if table has any zero size rows or columns -- or if it is extremely large rows or columns -- (don't want to eat up all the lua time on -- massive tables that should be split or restructured) if row <= 0 or col <= 0 or row > 99 or col > 99 then return mw.html.create('span') :addClass('error') :wikitext('Table size is invalid: ', size, '. Minimum size is 1 row/column, maximum size is 99 rows/columns.') end local out = mw.html.create('table') :addClass(class) :css(attrTable(tableCss)) local tableID = args['tableID'] or nil if ne(tableID) then out:attr('id', tableID) end local caption = args['caption'] or nil if ne(caption) then out:tag('caption') :wikitext(caption) end --mw.log(out) -- debug for i = 1, row do local tr = out:tag('tr') local rowID = args['id-' .. i] or nil if ne(rowID) then tr:attr('id', rowID) end for j = 1, col do local header = args['header-' .. i .. '-' .. j] local cell = args['cell-' .. i .. '-' .. j] local css = args['style-' .. i .. '-' .. j] local attr = args['attr-' .. i .. '-' .. j] local cellOrHeader = nil if header ~= nil then cellOrHeader = tr:tag('th') :wikitext(header) elseif cell ~= nil then cellOrHeader = tr:tag('td') :wikitext(cell) end -- add any css attributes if ne(css) and cellOrHeader ~= nil then cellOrHeader:css(attrTable(css)) end -- add any html attributes if ne(attr) and cellOrHeader ~= nil then cellOrHeader:attr(attrTable(attr)) end end end --mw.log(out) --debug return out end return p
Summary:
Please note that all contributions to Honkai: Nexus Anima Wiki are considered to be released under the Creative Commons Attribution-NonCommercial-ShareAlike (see
Honkai Nexus Anima 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.
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 Image|}}
Magic Words
:
{{!}}
{{formatnum:}}
{{lc:}}
{{uc:}}
{{PAGENAME}}
{{FULLPAGENAME}}
{{ROOTPAGENAME}}
{{BASEPAGENAME}}
{{SUBPAGENAME}}
{{DISPLAYTITLE:|noreplace}}
__TOC__
__NOTOC__
__EXPECTUNUSEDCATEGORY__
__HIDDENCAT__
References:
<ref></ref>
{{Reflist}}
{{Ref/Arti|}}
{{Ref/ArtiSet|}}
{{Ref/BB|}}
{{Ref/Book|}}
{{Ref/CS|}}
{{Ref/Companion|}}
{{Ref/Domain|}}
{{Ref/Enemy|}}
{{Ref/Food|}}
{{Ref/Furnishing|}}
{{Ref/HEO|}}
{{Ref/Item|}}
{{Ref/Loading|}}
{{Ref/Location|}}
{{Ref/Manga|}}
{{Ref/NPC|}}
{{Ref/Outfit|}}
{{Ref/Quest|}}
{{Ref/Talent|}}
{{Ref/VO|}}
{{Ref/VP|}}
{{Ref/Weapon|}}
{{Ref/Wildlife|}}
HTML Entities:
—
,
­
Page included on this page:
Module:Table Wrapper/doc
(
view source
)