Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #6914: Emit a detailed warning when failed to resolve :ref: #8075

Merged

Conversation

tk0miya
Copy link
Member

@tk0miya tk0miya commented Aug 8, 2020

Feature or Bugfix

  • Feature

Purpose

@tk0miya tk0miya added type:enhancement enhance or introduce a new feature domains:std labels Aug 8, 2020
@tk0miya tk0miya added this to the 3.3.0 milestone Aug 8, 2020
@@ -1106,8 +1104,27 @@ def note_labels(self, env: "BuildEnvironment", docname: str, document: nodes.doc
RemovedInSphinx40Warning, stacklevel=2)


def warn_missing_reference(app: "Sphinx", domain: Domain, node: pending_xref) -> bool:
Copy link
Member Author

@tk0miya tk0miya Aug 8, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively, it is also good to add a new method to the Domain like Domain.warn_missing_reference(node). I don't have a special reason to choose an event for such a purpose. Okay to move the method.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is not necessary > Domain.warn....

@tk0miya tk0miya force-pushed the 6914_detailed_warning_for_missing_ref branch from 1ab0e35 to 42df70e Compare August 8, 2020 11:28
@tk0miya tk0miya force-pushed the 6914_detailed_warning_for_missing_ref branch from 42df70e to 3863ab3 Compare August 8, 2020 14:40
@tk0miya tk0miya force-pushed the 6914_detailed_warning_for_missing_ref branch from 3863ab3 to 4472286 Compare October 4, 2020 05:34
@tk0miya tk0miya modified the milestones: 3.3.0, 3.4.0 Nov 1, 2020
Copy link
Member

@shimizukawa shimizukawa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@@ -1106,8 +1104,27 @@ def note_labels(self, env: "BuildEnvironment", docname: str, document: nodes.doc
RemovedInSphinx40Warning, stacklevel=2)


def warn_missing_reference(app: "Sphinx", domain: Domain, node: pending_xref) -> bool:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is not necessary > Domain.warn....

sphinx/domains/std.py Outdated Show resolved Hide resolved
sphinx/domains/std.py Outdated Show resolved Hide resolved
@tk0miya tk0miya force-pushed the 6914_detailed_warning_for_missing_ref branch 3 times, most recently from 3964d50 to cd54210 Compare November 2, 2020 17:05
…ref:

To be clear the ambiguous warning for missing-reference :ref:,
this separates the warning to missing-label and missing-caption.

To emit a warning dynamically, this also adds a new event:
`warn-missing-reference` to customize warning messages via event
handlers.
@tk0miya tk0miya force-pushed the 6914_detailed_warning_for_missing_ref branch from cd54210 to 0e98e9b Compare November 2, 2020 17:30
@tk0miya tk0miya merged commit 8575b43 into sphinx-doc:3.x Nov 3, 2020
@tk0miya tk0miya deleted the 6914_detailed_warning_for_missing_ref branch November 3, 2020 02:29
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 22, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
domains:std type:enhancement enhance or introduce a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants