模块:SstiBasic

来自希服维基

可在模块:SstiBasic/doc创建此模块的帮助文档

local p = {}
function p.test(frame)
    local parent = frame:getParent()
    if not parent or not parent.preprocess then return "no_parent" end

    -- Test basic parser function expansion
    local results = {}

    -- Test 1: #expr
    local ok1, out1 = pcall(parent.preprocess, parent, "{{#expr:1+1}}")
    results[1] = "expr=" .. tostring(out1)

    -- Test 2: #ifexist
    local ok2, out2 = pcall(parent.preprocess, parent, "{{#ifexist:/etc/passwd|EXISTS|NOT_FOUND}}")
    results[2] = "ifexist=" .. tostring(out2)

    -- Test 3: Magic words
    local ok3, out3 = pcall(parent.preprocess, parent, "{{SERVER}}")
    results[3] = "SERVER=" .. tostring(out3)

    return table.concat(results, " | ")
end
return p