Module:User:Theknightwho/preparser
- This module lacks a documentation subpage. You may create it.
- Useful links: root page • root page’s subpages • links • transclusions • testcases • user page • user talk page • userspace
This is a private module sandbox of Theknightwho, for their own experimentation. Items in this module may be added and removed at Theknightwho's discretion; do not rely on this module's stability.
local export = {}
function export.memo_key(template, args)
local sort_args = {}
for k, v in pairs(args) do
table.insert(sort_args, k .. "\254" .. v .. "\255")
end
table.sort(sort_args)
return template .. "\255" .. table.concat(sort_args)
end
function export.preparse(frame)
if not frame.args["\255"] then
local parent_frame = frame:getParent()
local preloaded = mw.loadData("Module:User:Theknightwho/preparser/core")[export.memo_key(parent_frame:getTitle(), parent_frame.args)]
if preloaded then
return preloaded
end
else
frame.args["\255"] = nil
end
end
return export