Editing
Module:Changelog
Jump to navigation
Jump to search
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 date_module = require('Module:Date') local changelog_dates = mw.loadJsonData("Data:Changelog Dates.json") local tag_tree = mw.loadJsonData("Data:Changelog Tag Tree.json") local dictionary_module = require('Module:Dictionary') --Only Data:Changelog_05-03-2024.json is loaded right now, as it still needs work and for now it was uploaded manually, need an uploader script to handle it --Returns all lines of a given date that has that tag local function date_tag_to_lines(date, tag_to_filter) -- Get the data for the respective line local changelog_data = mw.loadJsonData(date_to_changelog_data_page(date)) local lines = "" for index, line in ipairs(changelog_data) do description = line["Description"] if tag_to_filter == 'All' then lines = lines .. description .. "<br>" else for index2, tag in ipairs(line["Tags"]) do if tag == tag_to_filter then lines = lines .. description .. "<br>" end end end end return lines end --Expand the Update history table/row template for 1 specific changelog local function write_changelog(date, tag_to_filter) local template_title = "Update history table/row" local template_args = {} --05-03-2024 to May 3, 2024 template_args["update"] = date_module.format_date(date) template_args["changes"] = date_tag_to_lines(date, tag_to_filter) if (template_args["changes"] ~= "") then return mw.getCurrentFrame():expandTemplate{ title = template_title, args = template_args } else return "" end end -- Write changelogs table p.write_changelogs = function(frame) tag = frame.args[1] num_dates_str = frame.args[2] local num_dates if (tag == nil) then return "tag parameter must be provided" end if (num_dates_str ~= nil) then num_dates = tonumber(num_dates_str) if (num_dates == nil) then return "num_dates parameter must be numerical" end end local template_title = "Update history table" local template_args = {} local content = "\n" -- Write changelog for each date for index, date in ipairs(changelog_dates) do if (num_dates_str ~= nil and index > num_dates) then break else content = content .. write_changelog(date, tag) .. "\n" end end template_args["contents"] = content return mw.getCurrentFrame():expandTemplate{ title = template_title, args = template_args } end function date_to_changelog_data_page(date) return "Data:Changelog " .. date .. ".json" end --Shows all changelog date data pages as a list of pages p.write_data_pages_list = function(frame) local str = "" for index, date in ipairs(changelog_dates) do str = str .. "[[" .. date_to_changelog_data_page(date) .. "]]<br>" end return str end p.write_changelog_by_date = function(frame) local date_to_write = frame.args[1] -- Determine the previous and next update -- Find the index in dates list local previous_date = '' local the_date = '' local next_date = '' local date_found = false for index, date in ipairs(changelog_dates) do if date == date_to_write then --Date found the_date = date date_found = true elseif date_found and next_date == '' then --on next iteration, save the next date next_date = date break end if not date_found then previous_date = date -- only update previous date if the_date isnt found end end local template_title = 'Update layout' local template_args = { ['prev_update'] = prev_date, ['current_update'] = the_date, ['next_update'] = next_date, ['source'] = 'https://forums.playdeadlock.com/threads/09-26-2024-update.33015/', ['source_title'] = the_date .. ' Update', ['notes'] = date_tag_to_lines(the_date, 'All') } return mw.getCurrentFrame():expandTemplate{title = template_title, args = template_args} end p.get_last_updated = function(frame) local tag_to_search = frame.args[1] -- Iterate changelog dates for index, date in ipairs(changelog_dates) do local changelog_data = mw.loadJsonData(date_to_changelog_data_page(date)) -- Iterate lines for _, line in ipairs(changelog_data) do local tags = line['Tags'] -- Iterate tags for _, tag in ipairs(tags) do if tag_to_search == tag then return '[[Update:' .. date .. '|' .. date .. ']]' end end end end return dictionary_module.translate('N/A') end function p.write_tag_tree(frame) return p.write_branch(tag_tree, 1) end function p.write_branch(branch, depth) local list_str = "" if branch == nil then return "" end for parent, children in pairs(branch) do list_str = list_str .. string.rep("*", depth) .. string.format("[[%s#Update history|%s]]\n", parent, parent) if children ~= nil then list_str = list_str .. p.write_branch(children, depth+1) end end return list_str end return p
Summary:
Please note that all contributions to Deadlock Wiki are considered to be released under the Creative Commons Attribution-NonCommercial-ShareAlike (see
Deadlock: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
Templates used on this page:
Data:Changelog 05-03-2024.json
(
edit
)
Data:Changelog 05-10-2024.json
(
edit
)
Data:Changelog Dates.json
(
edit
)
Data:Changelog Tag Tree.json
(
edit
)
Data:Dictionary
(
edit
)
Data:LangCodes.json
(
edit
)
Template:Update history table
(
edit
)
Template:Update history table/row
(
edit
)
Template:Update layout
(
edit
)
Module:Changelog
(
edit
)
Module:Changelog/doc
(
edit
)
Module:Date
(
edit
)
Module:Dictionary
(
edit
)
Navigation menu
Personal tools
English
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Module
Discussion
English
Views
Read
Edit source
View history
More
Search
Navigation
Main page
Discord community
Recent changes
Random page
Tools
What links here
Related changes
Special pages
Page information
Languages