更多操作
Lua错误 在第39行:attempt to index local 'input' (a nil value)
local p = {} -- 解析以=分割的信息 function p.jx(frame) local args = frame.args local input = args['内容'] local parsed_data = '' for line in input:gmatch("[^\r\n]+") do local key, value = line:match("(.*)=(.*)") if key and value then --print(key, "=", value) --parsed_data = parsed_data..'<p><strong>'..key.."</strong>:"..value..'</p>' parsed_data = parsed_data..'<tr class="infobox-col2"><th style="">'..key..'</th><td style=""><b>'..value..'</b></td></tr>' end end return parsed_data end function p.date(frame) local args = frame.args local input = args['内容'] local str = "apple,banana,orange,grape" local words = {} for word in string.gmatch(args[1], '([^,]+)') do table.insert(words, word) end local html2 = ''; for i, v in ipairs(words) do html2 = html2..v..'<br>' end local html = '<span class="smw-highlighter"><span class="smwtext">'..words[1]..'</span><span class="smwttcontent">'..html2..'</span></span>' return html end function p.date2(frame) local args = frame.args local input = args['内容'] local html2 = '' local s = 1 local txt1 = '' for line in input:gmatch("[^\r\n]+") do local key, value = line:match("(.*)=(.*)") if key and value then if s == 1 then txt1 = key..'<span style="color: var(--color-base--subtle);font-size: var(--font-size-x-small);"> ('..value..') </span>' end --print(key, "=", value) html2 = html2..key..'<span style="color: var(--color-base--subtle);font-size: var(--font-size-x-small);"> ('..value..') </span><br>' --parsed_data = parsed_data..'<tr class="infobox-col2"><th style="">'..key..'</th><td style=""><b>'..value..'</b></td></tr>' end s = s+1 end local html = '<span class="smw-highlighter"><span class="smwtext">'..txt1..'</span><span class="smwttcontent">'..html2..'</span></span>' return html end return p