Menu

#167 document.note_explicit_target does not support a node having multiple IDs

None
closed-accepted
nobody
None
5
2021-04-07
2020-05-04
No

We've usually used document.note_explicit_target() and document.note_implicit_target() to register node IDs to document . But they don't support a node having multiple IDs.

from docutils import nodes

document = nodes.document(None, None)
target = nodes.target(ids=['foo', 'bar'])
document.note_explicit_target(target)
assert list(document.ids) == ['foo', 'bar'], document.ids  # => foo was not registered

I think all of IDs for the node should be registered into the document.

1 Attachments

Discussion

  • Takeshi KOMIYA

    Takeshi KOMIYA - 2020-06-13

    Any updates? Please let me know if my thought is incorrect.

     
  • engelbert gruber

    sorry. for the delay.
    I will have a look ... and try to get someone more knowledgable to decide

     
  • Günter Milde

    Günter Milde - 2020-07-09

    I applied a version in r8522.

    Unfortunately, I supoose that only David may tell whether direct specification of more than one ID could lead to problems later.
    Docutils only adds an "alias ID" when merging nodes.
    Also mind that IDs must conform to the "identifier normalisation"
    https://docutils.sourceforge.io/docs/ref/rst/directives.html#identifier-normalization, so it might be preferable to add "names" instead of "ids" and let Docutils do the rest.

     
  • Günter Milde

    Günter Milde - 2021-04-07
    • status: open --> closed-accepted
     
  • Günter Milde

    Günter Milde - 2021-04-07

    Docutils 0.17 is out.

     

Log in to post a comment.

MongoDB Logo MongoDB