首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >可以从troff格式制作手册页吗?

可以从troff格式制作手册页吗?
EN

Stack Overflow用户
提问于 2020-04-29 07:21:10
回答 2查看 73关注 0票数 0

我有一个troff格式的文件,并希望重新转换为手册页

file.txt:

代码语言:javascript
复制
.. c:function:: bool is_module_percpu_address (unsigned long addr)

   test whether address is from module static percpu

**Parameters**

``unsigned long addr``
  address to test

**Description**

Test whether **addr** belongs to module static percpu area.

**Return**

``true`` if **addr** is from module static percpu area


.. c:function:: int module_refcount (struct module * mod)

   return the refcount or -1 if unloading

**Parameters**

``struct module * mod``
  the module we're checking

**Return**

     -1 if the module is in the process of unloading
     otherwise the number of references in the kernel to the module

当我使用groff file.txt | man -l -时,我并不真正理解groff的输出。

正如您所看到的,我从来没有做过手册页,我只是想使用troff格式,使它成为一个可读的手册页。

该怎么做呢?

PS:输出来自所提供的源码树中的perl script kernel-doc。我确实知道它是否是troff格式,但脚本是这样说的(Output troff manual page format)

EN

回答 2

Stack Overflow用户

发布于 2020-05-01 22:18:43

如果需要使用troff格式并创建一个可读的手册页,不一定要使用groff-我推荐使用pandoc。下面的命令产生了比使用groff更具可读性的输出。

代码语言:javascript
复制
pandoc file.txt -s -t man | man -l -

如果你的文件像@meuh建议的那样有任何markdown或reStructuredText内容,这对pandoc来说应该不是问题。

票数 0
EN

Stack Overflow用户

发布于 2020-05-02 01:48:42

我偶然发现了一个用python编写的名为rst2man的脚本,它负责转换作业。它并不完美,但比pandoc更好的选择。例如,如果有人想要阅读内核文档。您可以使用

代码语言:javascript
复制
 kernel-doc path/to/kernel/source.{c,h} | rst2man -q - | man -l -

kernel-doc是源代码树中的perl脚本

rst2man是python脚本

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/61491594

复制
相关文章

相似问题

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