模块:换行处理:修订间差异
来自Gal中文百科
更多操作
无编辑摘要 |
无编辑摘要 |
||
| (未显示2个用户的55个中间版本) | |||
| 第1行: | 第1行: | ||
local p = {} | local p = {} | ||
function p. | function p.text(frame) | ||
local args = frame.args | local args = frame.args | ||
local | local aaa = "sdsd"..frame:callParserFunction('filepath:GINKA_银花_立绘.png')..";" | ||
return textToParagraphs(args['变量']) | |||
--return aaa | |||
--return frame:callParserFunction('filepath:GINKA_银花_立绘.png') | |||
end | |||
function p.img(frame) | |||
local args = frame.args | |||
local data = args['img'] | |||
local text = "" | |||
for item in data:gmatch("[^;]+") do | |||
-- 将拆分出的数据添加到text | |||
text = text .. item .. ";" | |||
end | |||
-- 删除最后一个;号 | |||
text = string.sub(text, 1, -2) | |||
return text | |||
end | |||
function p.jskp(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>'..key..":"..value..'</p>' | |||
end | |||
end | |||
return parsed_data | |||
end | |||
function textToParagraphs(text) | |||
local paragraphs = {} | |||
for line in text:gmatch("[^\r\n]+") do | |||
table.insert(paragraphs, "<p>" .. line .. "</p>") | |||
end | end | ||
return | return table.concat(paragraphs, "\n") | ||
end | end | ||
return p | return p | ||
2024年4月17日 (三) 21:34的最新版本
242
55
24
242
local p = {}
function p.text(frame)
local args = frame.args
local aaa = "sdsd"..frame:callParserFunction('filepath:GINKA_银花_立绘.png')..";"
return textToParagraphs(args['变量'])
--return aaa
--return frame:callParserFunction('filepath:GINKA_银花_立绘.png')
end
function p.img(frame)
local args = frame.args
local data = args['img']
local text = ""
for item in data:gmatch("[^;]+") do
-- 将拆分出的数据添加到text
text = text .. item .. ";"
end
-- 删除最后一个;号
text = string.sub(text, 1, -2)
return text
end
function p.jskp(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>'..key..":"..value..'</p>'
end
end
return parsed_data
end
function textToParagraphs(text)
local paragraphs = {}
for line in text:gmatch("[^\r\n]+") do
table.insert(paragraphs, "<p>" .. line .. "</p>")
end
return table.concat(paragraphs, "\n")
end
return p