Home
Random
Recent changes
Special pages
Community portal
Preferences
About Stockhub
Disclaimers
Search
User menu
Talk
Contributions
Create account
Log in
Editing
Module:Sandbox/Swpb/Transpose
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 = {} function p.transpose(frame) input = frame.args[1] -- ============================================== opening = mw.ustring.match(input, '{%|.-(?=%|%-)' ) opening = mw.ustring.match(input, '{%|.-%|%-' ) first_row_index = mw.ustring.find(input, '%|%-' ) rows = 1 cols = 1 output = input .. opening .. ' ' .. first_row_index out_table = '{| class="wikitable" \ |- \ | test \ |}' -- ============================================== return out_table end --return p --Approach: --1) Replace col-spanning cells with separate cells and indicate which cells to merge --2) Replace row-spanning cells with separate cells and indicate which cells to merge --3) Capture the cells of the unspanned table in two 2D arrays (format, content) -- ) Transpose the cells -- ) Create the new table -- ) Recreate col (now row) spans -- ) Recreate row (now col) spans
Summary:
Please note that all contributions to Stockhub 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
Stockhub:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Template used on this page:
Module:Sandbox/Swpb/Transpose/doc
(
edit
)