Skip to content

"WARNING: duplicate label" because of include #1668

Closed

Description

@tino

When I .. include:: <a file with a label defined.rst> I get these warnings:

/path/to/main/file.rst:lineno: WARNING: duplicate label ch-results, other instance in /path/to/included/file.rst

Activity

  1. birkenfeld commented on Jan 15, 2015

    @birkenfeld
    Member

    If the label name is actually the same, this is expected. include works as if the target file is put into the current file literally.

  2. tino commented on Jan 25, 2015

    @tino
    Author

    Sorry, should have been clearer. There is only one label. See this gist: https://gist.github.com/tino/ae778c1795c1f199e0b0 (with a standard conf.py, with source_suffix = '.rst' and master_doc = 'index').

    I also notice that the link that is inserted for the reference, links me to included.html, so somehow it appears it is not completely included but also rendered as a separate document. Hence the duplicate definiton.

    Appears on 1.2.3 as well as on 1.3b2.

  3. birkenfeld commented on Jan 25, 2015

    @birkenfeld
    Member

    Thanks for the feedback. I'll have a look.

  4. birkenfeld commented on Jan 25, 2015

    @birkenfeld
    Member

    Ok, got it. The issue is that your included file is also found and read as a regular document since it matches the source_suffix. That's also why included.html exists.

    You can either rename it (e.g. included.inc is popular) or add a pattern matching it to exclude_patterns.

  5. tino commented on Jan 25, 2015

    @tino
    Author

    Ah, that sounds logical. I thought only the documents included in a toctree were included.

  6. locked as resolved and limited conversation to collaborators on Sep 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions