How do you get Python documentation in Texinfo Info format?

后端 未结 10 1242
眼角桃花
眼角桃花 2021-01-30 07:33

Since Python 2.6, it seems the documentation is in the new reStructuredText format, and it doesn\'t seem very easy to build a Texinfo Info file out of the box anymore.

I

相关标签:
10条回答
  • 2021-01-30 07:57

    For those following this question in the hope of an answer, I found another rst2texinfo implementation which you might like to try:

    http://bitbucket.org/jonwaltman/rst2texinfo/src

    0 讨论(0)
  • 2021-01-30 07:58

    Another "workaround" is to execute pydoc as suggested by Nikokrock directly in Emacs:

    (defun pydoc (&optional arg)
      (interactive)
      (when (not (stringp arg))
        (setq arg (thing-at-point 'word)))
    
      (setq cmd (concat "pydoc " arg))
      (ad-activate-regexp "auto-compile-yes-or-no-p-always-yes")
      (shell-command cmd)
      (setq pydoc-buf (get-buffer "*Shell Command Output*"))
      (switch-to-buffer-other-window pydoc-buf)
      (python-mode)
      (ad-deactivate-regexp "auto-compile-yes-or-no-p-always-yes")
    )
    
    0 讨论(0)
  • 2021-01-30 07:58

    Michael Ernst used to maintain Info formats of Python docs:

    http://www.cs.washington.edu/homes/mernst/software/#python-info

    You can try using his makefile and html2texi script to generate an updated version. Both are linked at the above URL. I'm not sure how well it works now (the last version was around 2001), but his script is well commented (grep for "python").

    0 讨论(0)
  • 2021-01-30 08:01

    Jon Waltman http://bitbucket.org/jonwaltman/sphinx-info has forked sphinx and written a texinfo builder, it can build the python documentation (I've yet done it). It seems that it will be merged soon into sphinx.

    Here's the quick links for the downloads (temporary):

    • http://dl.dropbox.com/u/1276730/python.info
    • http://dl.dropbox.com/u/1276730/python.texi

    Steps to generate python doc in texinfo format:

    Download the python source code

    Download and install the sphinx-info package (in a virtualenv)

    Enter in the Python/Doc directory from the python sources

    Edit the Makefile, to the build target replace $(PYTHON) tools/sphinx-build.py with sphinx-build, then add this target to the makefile, pay attention, the space before echo is a TAB:

    texinfo: BUILDER = texinfo
    texinfo: build
        @echo
        @echo "Build finished. The Texinfo files are in _build/texinfo."
        @echo "Run \`make' in that directory to run these through makeinfo" \
              "(use \`make info' here to do that automatically)."
    

    Edit the Python/Doc/conf.py adding:

    texinfo_documents = [
        ('contents', 'python', 'Python Documentation', 'Georg Brandl',
         'Python', 'The Python Programming Language', 'Documentation tools',
         1),
    ]
    

    Then run make texinfo and it should produce the texifile in the build/texinfo directory. To generate the info file run makeinfo python.texi

    0 讨论(0)
提交回复
热议问题