0
我想嵌入的代碼塊這樣的:如何暫停groff格式化?
foreach my $n (1..10) {
print "$n\n";
}
在groff的「人」文件
,並沒有它,它格式化成一行。我想壓制所有的格式,而不是groff識別和處理任何特殊字符。這就像HTML中的<pre>
和</pre>
標籤。這可能在groff中做到嗎?謝謝。
我想嵌入的代碼塊這樣的:如何暫停groff格式化?
foreach my $n (1..10) {
print "$n\n";
}
在groff的「人」文件
,並沒有它,它格式化成一行。我想壓制所有的格式,而不是groff識別和處理任何特殊字符。這就像HTML中的<pre>
和</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)