更多操作
123 (123) 123 (123)
4567 (93456)
789 (78)
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 s = 1 local html2 = '' local txt1 = '' -- 判断一下是否包含# if string.match(args[1], "#") then for line in args[1]: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 html2 = html2..key..'<span style="color: var(--color-base--subtle);font-size: var(--font-size-x-small);"> ('..value..') </span><br>' end s = s+1 end local html = '<span class="smw-highlighter"><span class="smwtext">'..txt1..'</span><span class="smwttcontent">'..html2..'</span></span>' return html else -- 没有就直接输出啦! return args[1] end end return p