For my fellow emacs users:

If you aren't aware of it, there is a reST mode for emacs:

http://docutils.sourceforge.net/tools/editors/emacs/rst.el

In the course of experimenting today, I wrote a few elisp macros (attached) to aid in adding inline cross-references to the code that might be generally useful. By putting the cursor over a particular token, you can easily mark it as a class, function, method, module etc. For example, pressing "C-c c" over the word "Axes" will replace it with ":class:`Axes`".

C-c c : class
C-c m : method
C-c f : function
C-c a : attribute
C-c o : module

Cheers,
Mike

John Hunter wrote:
On Fri, May 23, 2008 at 8:12 AM, Michael Droettboom <[EMAIL PROTECTED]> wrote:

Personally, I would prefer to see all the names in monospaced type (I find
it much more readable), but the additional markup may be somewhat at odds
with keeping the original ReST source clean.  There are also two roads to
take: a) simply putting `` around them, or b) using the Sphinx
cross-referencing constructs, e.g. ":class:`Line2D`".

b) is obviously a lot noisier in the original ReST, but could produce more
useful online documentation.  Note, however, that if we put the narrative
and reference documentation in separate documents, the cross-references
won't actually work between them.

It certainly would make the docs more useful to be able to link to the
class and function references.  Argg.  I guess I'll just have to give
up my desire to have clean ASCII here, since most people are going to
read this on the web or as PDF so we should target that.  One
question: suppose we use class:`Line2D` and include the reference docs
in a single build, eg for the web site and a master PDF, but we want
to provide on some occasions a lighter PDF, eg just a few of the docs
w/o the reference.  Will sphinx be somewhat smart and just format the
class:`Line2D` as monospace when it cannot find the references?

JDH

--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA

(defun rst-crossref (type)
  (backward-word)
  (insert ":")
  (insert type)
  (insert ":`")
  (forward-word)
  (insert "`")
)
(defun rst-mark-module ()
  (interactive)
  (rst-crossref "mod")
)
(define-key rst-mode-map [(control c) (o)] 'rst-mark-module)
(defun rst-mark-class ()
  (interactive)
  (rst-crossref "class")
)
(define-key rst-mode-map [(control c) (c)] 'rst-mark-class)
(defun rst-mark-func ()
  (interactive)
  (rst-crossref "func")
)
(define-key rst-mode-map [(control c) (f)] 'rst-mark-func)
(defun rst-mark-meth ()
  (interactive)
  (rst-crossref "meth")
)
(define-key rst-mode-map [(control c) (m)] 'rst-mark-meth)
(defun rst-mark-attr ()
  (interactive)
  (rst-crossref "attr")
)
(define-key rst-mode-map [(control c) (a)] 'rst-mark-attr)
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Reply via email to