更多操作
无编辑摘要 |
无编辑摘要 |
||
第33行: | 第33行: | ||
function p.date2(frame) | function p.date2(frame) | ||
local args = frame.args | local args = frame.args | ||
local input = args[ | local input = args[1] | ||
local html2 = '' | local html2 = '' | ||
local s = 1 | local s = 1 | ||
local txt1 = '' | local txt1 = '' | ||
for line in | for line in input:gmatch("[^\r\n]+") do | ||
local key, value = line:match("(.*)#(.*)") | local key, value = line:match("(.*)#(.*)") | ||
if key and value then | if key and value then |
2024年5月19日 (日) 13:19的版本
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 input = args[1]
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