如何从 Emacs Lisp 文档生成 HTML?
Emacs 称自己为自文档化。这意味着您可以使用 Emacs 来阅读 Emacs-Lisp 文件中编码的文档。
有没有一种简单的方法可以将此文档导出为 HTML,以便可以将文档放在网站上?我知道 FSF 在 http://www.gnu.org/ 上发布了文档software/emacs/manual/emacs.html 但并未列出所有 Emacs 模块。
更新:我对 elisp 文件中的文档感兴趣,而不是 texinfo 文件中的文档。我还想要功能和“主要模式”的文档。在 Emacs 文档查看器中,这些内容都有很好的超链接,如果将其保留在 HTML 中那就太好了。
Emacs calls itself self-documenting. This means that you can use Emacs to read the documentation that is encoded in the Emacs-Lisp files.
Is there an easy way to export this documentation to HTML, so that the documentation can be placed on a website? I know that the FSF publishes the documentation at http://www.gnu.org/software/emacs/manual/emacs.html but not all of the Emacs modules are listed there.
Update: I'm interested in the documentation in the elisp files, not in texinfo files. I also want the documentation for the functions and for the "major mode". In the Emacs documentation viewer, this is all nicely hyperlinked and it would be great if that were preserved in HTML.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
部分答案可能是简单地使用/扩展现有的 Lisp 自动文档生成器。以下是一些可能会帮助您实现目标的链接:
Part of the answer may be to simply use/extend existing Lisp automatic documentation generators. Here are a few links that might get you there:
我不认为文档是“在 Emacs-Lisp 文件中编码的”。它们存储为 texinfo 文档,可以导出为 HTML(我认为 GNU 文档站点就是这样生成的)。 texi2html 可以将texinfo文件转换为HTML。
函数的文档字符串直接存储在 elisp 文件中。如果您想要这些,您必须遍历函数列表、获取文档字符串并创建一个 HTML 文件。我认为只需几行 elisp 就可以做到。
Xah Lee 此处评论了他们应该如何使用 HTML。
I don't think the documentation is "encoded in Emacs-Lisp files". They're stored as texinfo documents that can be exported to HTML (which is I think how the GNU documentation site is generated). texi2html can convert texinfo files into HTML.
The docstrings for the functions are stored in the elisp files directly. If you want those, you'll have to iterate through the list of functions, get the docstring and create an HTML file. I think it should be doable in a few lines of elisp.
Xah Lee comments here on how they should be using HTML anyway.