模块:换行处理:修订间差异
来自Gal中文百科
更多操作
无编辑摘要 |
无编辑摘要 |
||
| 第3行: | 第3行: | ||
function p.text(frame) | function p.text(frame) | ||
local args = frame.args | local args = frame.args | ||
textToParagraphs(args['变量']) | |||
end | end | ||
function textToParagraphs(text) | function textToParagraphs(text) | ||
2024年4月3日 (三) 10:10的版本
脚本错误:函数“img”不存在。
local p = {}
function p.text(frame)
local args = frame.args
textToParagraphs(args['变量'])
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