Menu

#449 Image has no line number with an `:alt:` attribute

closed-duplicate
nobody
None
5
2022-06-01
2022-05-31
Adam Turner
No

Reproducer:

>>> print(core.publish_doctree(".. image:: placeholder_image.jpg")[0].line)
1
>>> print(core.publish_doctree(".. image:: placeholder_image.jpg\n   :alt: blah")[0].line)
None

This is rather odd! Originally found whilst debugging a Sphinx issue.

A

Related

Feature Requests: #41

Discussion

  • Günter Milde

    Günter Milde - 2022-05-31

    Reproducer:

    ```pycon

    print(core.publish_doctree(".. image:: placeholder_image.jpg")[0].line)
    1
    print(core.publish_doctree(".. image:: placeholder_image.jpg\n :alt: blah")[0].line)
    None
    ```

    This is rather odd! Originally found whilst debugging a Sphinx issue.

    This actually happens for all "image" and "figure" directives with
    attributes::

    Test the best
    
    .. image:: placeholder_image.jpg
    
    .. image:: placeholder_image.jpg
       :name: testimage
    
    .. image:: placeholder_image.jpg
       :alt: blah
    
    .. image:: placeholder_image.jpg
       :class: spam
    
    .. image:: placeholder_image.jpg
       :width: 30%
    
    .. figure:: placeholder_image.jpg
    
    .. figure:: placeholder_image.jpg
       :align: right
    

    conversion with rst2pseudoxml --expose-internal-attribute=line also
    reveals that the line info in <image> and <figure> elements without
    attributes is off by one.

     

    Last edit: Günter Milde 2022-06-01
  • Adam  Turner

    Adam Turner - 2022-06-01

    I'm looking into line numbering anyway, so hopefully I might be able to fix both issues at once.

    A

     
  • Günter Milde

    Günter Milde - 2022-06-01

    One more instance of [#41].

     

    Related

    Feature Requests: #41


    Last edit: Günter Milde 2022-06-01
  • Günter Milde

    Günter Milde - 2022-06-01
    • status: open --> closed-duplicate
     

Log in to post a comment.

MongoDB Logo MongoDB