首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何暂停groff格式化?

如何暂停groff格式化?
EN

Stack Overflow用户
提问于 2015-11-10 08:56:54
回答 1查看 189关注 0票数 0

我想像这样嵌入一段代码:

代码语言:javascript
复制
foreach my $n (1..10) {
    print "$n\n";
}

在groff 'man‘文档中,而不是将其重新格式化为一行。我想禁止所有的格式化,并且不让groff识别和处理任何特殊字符。这就像超文本标记语言中的<pre></pre>标签。在groff中可以做到这一点吗?谢谢。

EN

回答 1

Stack Overflow用户

发布于 2016-01-05 03:39:20

您可以使用.nf请求关闭填充模式,使用.eo关闭转义处理;.fi.ec会相应地恢复它们。groff可以正确地处理这些内容,但也可能有一些备用的手册页格式化程序无法处理这些内容。

示例:

代码语言:javascript
复制
.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

呈现为:

代码语言:javascript
复制
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)
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/33621091

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档