- Welcome to the Kancolle Wiki!
- If you have any questions regarding site content, account registration, etc., please visit the KanColle Wiki Discord
Difference between revisions of "Module:View"
Jump to navigation
Jump to search
m (7 revisions imported) |
|||
(5 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
+ | --- | ||
+ | -- Wrap (args, frame?) -> wikitext function into a frame -> wikitext function. | ||
+ | -- | ||
+ | -- [[Category:Todo]]: actually should provide a react-like view library. | ||
+ | -- | ||
+ | |||
local _ = require('Module:Core') | local _ = require('Module:Core') | ||
− | return function (render) | + | local DummyFrame = {} |
+ | |||
+ | function DummyFrame:preprocess(x) | ||
+ | return x | ||
+ | end | ||
+ | |||
+ | return function(render, test) | ||
return { | return { | ||
− | render = function (frame) | + | render = function(frame) |
− | return render(_.getTemplateArgs(frame), frame) | + | return render(frame and _.getTemplateArgs(frame) or {}, frame) |
− | end | + | end, |
+ | test = function() | ||
+ | return render(test, DummyFrame) | ||
+ | end, | ||
} | } | ||
end | end |
Latest revision as of 17:18, 4 June 2020
Documentation for this module may be created at Module:View/doc
---
-- Wrap (args, frame?) -> wikitext function into a frame -> wikitext function.
--
-- [[Category:Todo]]: actually should provide a react-like view library.
--
local _ = require('Module:Core')
local DummyFrame = {}
function DummyFrame:preprocess(x)
return x
end
return function(render, test)
return {
render = function(frame)
return render(frame and _.getTemplateArgs(frame) or {}, frame)
end,
test = function()
return render(test, DummyFrame)
end,
}
end