Skip to content

请教:lua实现多行文本输出问题 #1613

Closed Answered by goodaniu
goodaniu asked this question in Q&A | 问答
Discussion options

You must be logged in to vote

问题已解决,只要把yeild语句中的seg改成cand即可。

local function duohang(input, env)
for cand in input:iter() do
    if string.find(cand.text, "\\n") then
        local str1 = string.gsub(cand.text, "\\n", "\n")
        yield(Candidate("lines", cand.start, cand._end, str1, "*"))
    else
        yield(cand)
    end
end
end

return duohang

字典中写入A.\nB.\nC.\nD|||\n|:-:|:-:|\n|||等类似词条,其中的\n会转义为换行符。

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by goodaniu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant