我想嵌入这样的代码块:
foreach my $n (1..10) {
print "$n\n";
}
在 groff 'man' 文档中,不要将其重新格式化为一行。我想禁止所有格式,并且不让 groff 识别和处理任何特殊字符。这就像 HTML 中的<pre>
and</pre>
标签。这可以在 groff 中完成吗?谢谢。
我想嵌入这样的代码块:
foreach my $n (1..10) {
print "$n\n";
}
在 groff 'man' 文档中,不要将其重新格式化为一行。我想禁止所有格式,并且不让 groff 识别和处理任何特殊字符。这就像 HTML 中的<pre>
and</pre>
标签。这可以在 groff 中完成吗?谢谢。
您可以使用请求关闭填充模式.nf
,并使用 ; 关闭转义处理.eo
。它们相应地用.fi
和恢复.ec
。groff 将正确处理这些,但某些替代的手册页格式化程序可能不会。
例子:
.TH "Manpage Test" SO
.SH NAME
Manpage test \- test manpage formatting
.SH DETAILS
Here is the example.
.RS
.nf
.eo
foreach my $n (1..10) {
print "$n\n";
}
.ec
.fi
.RE
.P
And there you have the example.
The code snippet should be rendered as "pre-formatted", and
following text should be back to filled/adjusted.
.SH AUTHOR
Evil Otto
呈现为:
Manpage Test(SO) Manpage Test(SO)
NAME
Manpage test - test manpage formatting
DETAILS
Here is the example.
foreach my $n (1..10) {
print "$n\n";
}
And there you have the example. The code snippet should be rendered as
"pre-formatted", and following text should be back to filled/adjusted.
AUTHOR
Evil Otto
Manpage Test(SO)