平台 - 中性线结束了io.stderr ::write

问题描述 投票:0回答:1
h1

函数,

print()
没有附加新线。我在
newline的答案
中发现( )在lua中的替代方案,可以使用
io.stderr.write
[[
可以用来创建多行字符串文字,但是令人惊讶的是,这与仅包含换行线的字符串无效。 ]] 可能只是一个lua错误。另一方面,尽管这个想法一开始似乎很聪明,但它看起来并不正确。 你建议什么?
    
使用

local pagetitle function Header(header) if not pagetitle and header.level == 1 then pagetitle = pandoc.utils.stringify(header) end end local EOL = [[ ]] function Meta(meta) if not meta.pagetitle then if pagetitle then meta.pagetitle = pagetitle else io.stderr:write('WARNING: h1 missing, defaulting HTML pagetitle from input filename.', EOL) meta.pagetitle = PANDOC_STATE.input_files[1] end return meta end end
函数将newline添加为
string.format()

,也使打印警告成为未来安全的函数:

\n

lua cross-platform line-breaks
1个回答
0
投票
.

	
最新问题
© www.soinside.com 2019 - 2025. All rights reserved.