بتاريخ الأحد، 24 مايو، 2020 2:38:20 م UTC+3، كتب Stefano David:
>
> Hi,
>
>
> I am not sure if the behaviour of the numref role has changed in recent 
> times; I refer to this old issue by jfbu: 
> https://github.com/sphinx-doc/sphinx/issues/3012
> In Sphinx v3.0.3, the snippet in the issue does not not compile as 
> expected, because there is no :name: attached to the code-block. So far so 
> good, given the explanation in the issue. 
>
>
>
> However, to my wonder, that code does not compile even if I replace 
> :content: foo with :name: foo! It is necessary to add both :caption: AND 
> :name: to code-block, for numref to work (they can have different values, 
> by the way). 
>
>
> With examples:
>
>
> ***** code 1 *****
>
> .. code-block:: python 
>    :name: foo
>
>       def foo(): 
>           return None
>
> ***** code 2 *****
>
> .. code-block:: python 
>    :name: foo
>    :caption: foo bar 
>
>       def foo(): 
>           return None
> *****
>
> Code 1 shows a warning and does not create a reference, while code 2 
> works. Is this the correct behaviour and I am missing something, or is it a 
> bug? In the first case, then the documentation at [1] (which is the same 
> text as mentioned by Jean Francois [2]) is misleading or wrong, in the 
> second case I would open an issue.
>
> Cheers,
> Stefano
>
> [1] 
> https://www.sphinx-doc.org/en/stable/usage/restructuredtext/directives.html#showing-code-examples
>
> [2] https://www.sphinx-doc.org/en/1.4/markup/code.html
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sphinx-users/5859a13a-1b0a-49bd-9f5c-b937c7750a06o%40googlegroups.com.

Reply via email to