Module:ProfessionList: Difference between revisions
no edit summary
(Created page with "local currency = require('Module:Currency') local p = {} -- this module provides functions that are commonly used among all of the modules to greate tables of profession activities -- such as AlchemistList, DetectivePassiveList, BlacksmithSmeltingList, and so on -- creates the html directly for a currency cell of a table -- will always be 10 cells wide, for currency alignment -- if not supplied with an amount, displays "unknown" -- use within :node() function p.curren...") |
No edit summary |
||
Line 24:
-- creates the html for an unknown value cell
-- use within :node()
function p.unknown_value_cell(N)
return mw.html.create('td')
:addClass('table-bg-gray')
:css{ ['text-align'] = 'center' }
:attr{ colspan = tostring(N) }
:wikitext("''unknown''")
:done()
Line 33 ⟶ 34:
-- creates the html for an unknown value cell, with a link to edit the page that has the unknown parameter
-- use within :node()
function p.
local url = tostring(mw.uri.fullUrl(page,'action=edit'))
return mw.html.create('td')
:addClass('table-bg-gray')
:css{ ['text-align'] = 'center' }
:attr{ colspan = tostring(N) }
:wikitext('['..url.." ''unknown'' (edit)]")
:done()
end
Line 51 ⟶ 53:
local query = {
queryString,
'? #- =
'?Image #- = pageImage',
'?Activity JSON = activityJSON',
Line 63 ⟶ 65:
return nil
end
-- output structure
local output = {}
Line 77 ⟶ 79:
else
for _, json in page.activityJSON do
json.type = 'activity'
table.insert(JSONs,json)
end
Line 85 ⟶ 88:
table.insert(JSONs,page.recipeJSON)
else
for _, json in page.
json.type = 'recipe'
table.insert(JSONs,json)
end
Line 97 ⟶ 101:
--decode the JSON to a Lua table, add data from the page that had it
local item = mw.text.jsonDecode(JSON)
item.page = page.
item.pageImage = page.pageImage
--insert into output table
table.insert(output,
end
end
end
return output
|