Hi everyone, I am a new user of Sphinx so my question may not be accurate as I have not read the entire doc yet (but I read quite a lot).
I am documenting Python code. >From this page http://sphinx-doc.org/domains.html#domains, I can do this : *Info field lists* *New in version 0.4.* *Inside Python object description directives, reST field lists with these fields are recognized and formatted nicely:* - *param, parameter, arg, argument, key, keyword: Description of a parameter.* - *type: Type of a parameter. Creates a link if possible.* - *raises, raise, except, exception: That (and when) a specific exception is raised.* - *var, ivar, cvar: Description of a variable.* - *vartype: Type of a variable. Creates a link if possible.* - *returns, return: Description of the return value.* - *rtype: Return type. Creates a link if possible.* If I use the *type* tag to indicate that a param is of type *str*, for instance, the generated documentation automatically links to the official Python documentation, here https://docs.python.org/2/library/functions.html#str. Which is very nice ! I can do the same for a custom type of mine, it works very well too ! I would like to link exceptions too when using the *raises *tag but it seems impossible. And this is not suprising as the sphinx documentation mentions autolinking only for tags *type*, *vartype*, and *rtype*. (see the pasted documenation above) I really wanted autolinking for exceptions so I tried a lot of things, none worked. So I ended hacking the sphinx code. I am using Sphinx 1.3.1. I changed file sphinx/domains/python.py at line 133 (inside the definition of class PyObject which starts at line 113). I just modified the type of the object representing the *raises *tag, from *GroupedField *to *PyTypedField *and I got my autolinking feature on for exceptions. Great ! I don't know if my hack is clean or if there is a better way of achieving the same feature and I don't have so much time for investigating on it. So could you point a better solution if one exists ? If this needs a hack, could you merge it in the next version of Sphinx ? It would be much appreciated. Thanks for reading me, and, by the way, thanks for Sphinx, it is a great tool. Damien Montigny -- You received this message because you are subscribed to the Google Groups "sphinx-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sphinx-users. For more options, visit https://groups.google.com/d/optout.
