Skip to content

Commit

Permalink
Merge pull request #11 from vub-hpc/fix
Browse files Browse the repository at this point in the history
properly log error with failed regex
  • Loading branch information
lexming authored Apr 23, 2024
2 parents 41b0ca5 + c385f4d commit f313b4e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/term_rst_post/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@
@author: Alex Domingo (Vrije Universiteit Brussel)
"""

__version__ = "1.2.2"
__version__ = "1.2.3"
10 changes: 6 additions & 4 deletions src/term_rst_post/newspost.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,10 +384,12 @@ def plain_ref_role(name, rawtext, text, lineno, inliner, options={}, content=[])
Targets of :ref: are internal labels without meaning that should be hidden
"""
text = utils.unescape(text)
regex = re.compile("(.*?)\s*\<(.*?)\>")
match = regex.match(text)
label = match.group(1)
target = match.group(2)
regex = re.compile(r"(.*?)\s*\<(.*?)\>")
try:
match = regex.match(text)
label = match.group(1)
except AttributeError as err:
error_exit(f"Failed to extract label from '{text}'", err)

node = nodes.inline()
node += nodes.Text(label)
Expand Down

0 comments on commit f313b4e

Please sign in to comment.