Skip to content

Commit

Permalink
🐛 FIX NoURI error in doc reference resolution (#734)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisjsewell committed Mar 2, 2023
1 parent 585ce9a commit 322cb42
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 13 deletions.
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

0 comments on commit 322cb42

Please sign in to comment.