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 NoURI error in doc reference resolution #734

Merged
merged 1 commit into from Mar 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 6 additions & 3 deletions myst_parser/sphinx_ext/myst_refs.py
Expand Up @@ -178,9 +178,12 @@ def resolve_myst_ref_doc(self, node: pending_xref):
)

assert self.app.builder
ref_node = make_refnode(
self.app.builder, from_docname, ref_docname, targetid, innernode
)
try:
ref_node = make_refnode(
self.app.builder, from_docname, ref_docname, targetid, innernode
)
except NoUri:
ref_node = innernode
node.replace_self(ref_node)

def resolve_myst_ref_any(
Expand Down
3 changes: 0 additions & 3 deletions tests/test_sphinx/sourcedirs/texi_table/index.md

This file was deleted.

3 changes: 3 additions & 0 deletions tests/test_sphinx/sourcedirs/texinfo/file.md
@@ -0,0 +1,3 @@
---
orphan: true
---
9 changes: 9 additions & 0 deletions tests/test_sphinx/sourcedirs/texinfo/index.md
@@ -0,0 +1,9 @@
Check that NoURIError is handled correctly:

[](file.md)

Check that tables can be built:

| foo | bar |
| --- | --- |
| baz | bim |
10 changes: 3 additions & 7 deletions tests/test_sphinx/test_sphinx_builds.py
Expand Up @@ -564,15 +564,11 @@ def test_fieldlist_extension(

@pytest.mark.sphinx(
buildername="texinfo",
srcdir=os.path.join(SOURCE_DIR, "texi_table"),
srcdir=os.path.join(SOURCE_DIR, "texinfo"),
freshenv=True,
)
def test_texinfo_table(
app,
status,
warning,
):
"""Test that tables can be built with the Texinfo builder."""
def test_texinfo(app, status, warning):
"""Test Texinfo builds."""
app.build()
assert "build succeeded" in status.getvalue() # Build succeeded
warnings = warning.getvalue().strip()
Expand Down