Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Humanipedia
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Module:Airport destination 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!
local p = {} local function isnotempty(s) return s and s:match( '^%s*(.-)%s*$' ) ~= '' end function p.table(frame) local args = (frame.args[1] ~= nil) and frame.args or frame:getParent().args local cols if isnotempty(args['4thcoltitle']) and isnotempty(args['3rdcoltitle']) then cols = 4 elseif isnotempty(args['3rdcoltitle']) then cols = 3 else cols = 2 end -- compute the maximum cell index local cellcount = 0 for k, v in pairs( args ) do if type( k ) == 'number' and isnotempty(v) then cellcount = math.max(cellcount, k) end end -- compute the number of rows local rows = math.ceil(cellcount / cols) -- create the root table local root = mw.html.create('table') root :addClass('wikitable') :addClass('sortable') -- add the header row local row = root:tag('tr') local cell= row:tag('th') cell:wikitext('Airlines') cell= row:tag('th') cell:addClass('unsortable') cell:wikitext('Destinations') if (isnotempty(args['3rdcoltitle'])) then cell= row:tag('th') cell:css('width','10%') if (isnotempty(args['3rdcolunsortable'])) then cell:addClass('unsortable') end cell:wikitext(args['3rdcoltitle']) end if (isnotempty(args['4thcoltitle'])) then cell= row:tag('th') if (isnotempty(args['4thcolunsortable'])) then cell:addClass('unsortable') end cell:wikitext(args['4thcoltitle']) end -- loop over rows for j=1,rows do row = root:tag('tr') for i=1,cols do cell= row:tag('td') if (i > 2) then cell:css('text-align','center') end cell:wikitext(args[cols*(j - 1) + i] or '') end end -- return the root table return tostring(root) end return p
Summary:
Please note that all contributions to Humanipedia may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, 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 (see
Humanipedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Templates used on this page:
Template:Documentation subpage
(
edit
)
Template:Error
(
edit
)
Template:High-use
(
edit
)
Template:Mbox
(
edit
)
Template:Module other
(
edit
)
Template:Module rating
(
edit
)
Template:Ombox
(
edit
)
Template:Pp
(
edit
)
Template:Protection padlock
(
edit
)
Template:Template link
(
edit
)
Template:Tl
(
edit
)
Module:Airport destination list/doc
(
edit
)
Module:Error
(
edit
)
Module:File link
(
edit
)
Module:Message box
(
edit
)
Module:Protection banner
(
edit
)