Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

A literal "*" in RestructuredText

I am looking at this snippet of code:

def ook(*args):
    """Some silly function.

    :param *args: Optional arguments.
    """
    ...

And as soon as I run Sphinx, I get the oh-so helpful error:

WARNING: Inline literal start-string without end-string.

So, I tried param ``*``args, param :literal:'*' args and still get the warning.

How do I have a literal '*' in restructuredText?

like image 256
Sardathrion - against SE abuse Avatar asked May 26 '15 09:05

Sardathrion - against SE abuse


People also ask

What is a literal block?

Literal blocks display the text you write exactly as you see it in the source. Literal text is treated as preformatted text. The text is presented in a fixed-width font and endlines are preserved. Only special characters and callouts are replaced when the document is converted.

How do I comment a line in an RST file?

For comments, add 2 periods .. followed by a newline and then your comment indented.


1 Answers

You could use the (somewhat ugly) backslash quotation: \*

EDIT: As an (somewhat ugly) addendum, if you are concerned about pylint warning about the backslash, you could add a r to the string literal: r""" ... docstring ... """. This was descibed in this pylint issue.

Having different text processing systems play nicely together destroys sometimes the aesthetics.

like image 102
knitti Avatar answered Sep 24 '22 19:09

knitti