Editing Module:Location Table
Jump to navigation
Jump to search
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 1: | Line 1: | ||
require('strict') |
require('strict') |
||
local persistant = require('Module:Break Isolation').get_module_store('Module:Location Table') |
|||
local parse = require('Module:Param Parse') |
local parse = require('Module:Param Parse') |
||
local edit = 'Unknown <span class="small plainlinks">' .. require('Module:Edit button')() .. '</span>' |
local edit = 'Unknown <span class="small plainlinks">' .. require('Module:Edit button')() .. '</span>' |
||
persistant.counter = persistant.counter or 0 |
|||
local p = {} |
local p = {} |
||
function p. |
function p.main(frame) |
||
return p._main(frame:getParent().args) |
|||
assert(not persistant.in_table, 'Second Template:LocTableHead (Missing Template:LocTableBottom?)') |
|||
persistant.in_table = true |
|||
persistant.json = {} |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
end |
end |
||
function p. |
function p._main(args) |
||
local tbl = mw.html.create('table') |
|||
assert(persistant.in_table, 'Template:LocLine when not in a location table (Missing Template:LocTableHead?)') |
|||
:addClass('wikitable sortable filterable sticky-header loctable autosort=1,a') |
|||
local args = frame:getParent().args |
|||
:css{ ['text-align'] = 'center' } |
|||
⚫ | |||
:tag('tr') |
|||
⚫ | |||
:tag('th'):wikitext('Location'):done() |
|||
⚫ | |||
:tag('th'):wikitext('Episode'):done() |
|||
⚫ | |||
:tag('th'):wikitext('Qty.'):done() |
|||
⚫ | |||
:done() |
|||
⚫ | |||
⚫ | |||
⚫ | |||
persistant.counter = persistant.counter + 1 |
|||
⚫ | |||
local id = 'LOC_' .. persistant.counter |
|||
local id_prefix = 'LOC_' |
|||
⚫ | |||
⚫ | |||
id_prefix = id_prefix .. loc_version .. '_' |
|||
⚫ | |||
local loc_json = {} |
|||
for i = 1, 9007199254740992 do |
|||
⚫ | |||
⚫ | |||
⚫ | |||
if not loc then |
|||
break |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
local id = id_prefix .. loc |
|||
tbl:tag('tr') |
|||
:attr{ id = id } |
:attr{ id = id } |
||
:tag('td'):wikitext(loc_link |
:tag('td'):wikitext(loc_link) |
||
:tag('td'):wikitext(parse.episode_func(episode)):done() |
:tag('td'):wikitext(parse.episode_func(episode)):done() |
||
:tag('td'):wikitext(qty or edit):done() |
:tag('td'):wikitext(qty or edit):done() |
||
:done() |
|||
⚫ | |||
⚫ | |||
function p.bottom(frame) |
|||
⚫ | |||
assert(persistant.in_table, 'Template:LocTableBottom when not in a location table (Missing Template:LocTableHead?)') |
|||
['Located in'] = loc, |
|||
⚫ | |||
⚫ | |||
end |
|||
if |
if loc_version then |
||
mw.smw.subobject({ ['Location JSON'] = mw.text.jsonEncode( |
mw.smw.subobject({ ['Location JSON'] = mw.text.jsonEncode(loc_json) }, loc_version) |
||
else |
else |
||
mw.smw.set{ ['Location JSON'] = mw.text.jsonEncode( |
mw.smw.set{ ['Location JSON'] = mw.text.jsonEncode(loc_json) } |
||
end |
end |
||
return tbl |
|||
persistant.in_table = nil |
|||
persistant.json = nil |
|||
persistant.version = nil |
|||
persistant.location_object = nil |
|||
end |
end |
||