Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I add a plural-s after a Sphinx :class: directive

I have this problem all the time that I want to write a docstring like this:

def foo(arg):
   '''Add ``arg`` to the list of :class:`foo.bar.baz.Argument`s.'''
   pass

However, that doesn't work, Sphinx will warn that

py:class reference target not found: foo.bar.baz.Argument`s

so it's treating the s after the closing backtick as part of the class name. This does not happen with e.g. punctuation marks like the dot .. Is there anything to be done about this, except adding a space between the class name and the Plural-s (which looks crazy)?

like image 427
oarfish Avatar asked Aug 17 '18 08:08

oarfish


1 Answers

You should be able to use backslash-escaped whitespace.

def foo(arg):
   '''Add ``arg`` to the list of :class:`foo.bar.baz.Argument`\ s.'''
   pass
like image 69
mzjn Avatar answered Nov 16 '22 10:11

mzjn