打开/关闭菜单
打开/关闭外观设置菜单
打开/关闭个人菜单
未登录
未登录用户的IP地址会在进行任意编辑后公开展示。

模块:换行处理:修订间差异

来自Gal中文百科
Yexiaoyu留言 | 贡献
无编辑摘要
Yexiaoyu留言 | 贡献
无编辑摘要
第1行: 第1行:
local p = {}
local p = {}


function p.text(frame)
function p.addPTags(frame)
     local args = frame.args
     local args = frame.args
     local jsxx= args['角色信息']
     local newText = string.gsub(args[1], "\n\n", "</p>")
     -- 检查参数是否为空
    newText = "<p>" .. newText
     if jsxx then
     -- 如果文本以换行符结尾,则添加一个闭合的</p>标签
         return 'Hello, world!\n' ..addBrTags(jsxx)
     if string.sub(newText, -1) == "\n" then
    else
         newText = newText .. "</p>"
        return 'Hello, world!'
     end
     end
end
function addBrTags(text)
    -- 将换行符替换为 <br> 标签
    local newText = string.gsub(text, "\n", "<br>")
     return newText
     return newText
end
end
return p
return p

2024年4月3日 (三) 09:52的版本

脚本错误:函数“text”不存在。 脚本错误:函数“img”不存在。


local p = {}

function p.addPTags(frame)
    local args = frame.args
    local newText = string.gsub(args[1], "\n\n", "</p>")
    newText = "<p>" .. newText
    -- 如果文本以换行符结尾,则添加一个闭合的</p>标签
    if string.sub(newText, -1) == "\n" then
        newText = newText .. "</p>"
    end
    return newText
end
return p