Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions latexrun
Original file line number Diff line number Diff line change
Expand Up @@ -965,18 +965,23 @@ class LaTeX(Task):

def __clean_messages(self, msgs):
"""Make some standard log messages more user-friendly."""
have_undefined_reference = False
has_errors = any(msg.typ == 'error' for msg in msgs)
for msg in msgs:
if msg.msg == '==> Fatal error occurred, no output PDF file produced!':
msg = msg._replace(typ='info',
msg='Fatal error (no output file produced)')
if msg.msg.startswith('[LaTeX] '):
# Strip unnecessary package name
msg = msg._replace(msg=msg.msg.split(' ', 1)[1])
if re.match(r'Reference .* undefined', msg.msg):
have_undefined_reference = True
if have_undefined_reference and \
re.match(r'There were undefined references', msg.msg):
if has_errors and re.match(
r'.*[Rr]erun to get .* right|.* on page .* undefined', msg.msg
):
# Warnings on undefined references may occur in high
# numbers when documents fail to build.
continue
if re.match(
r"There were (multiply-defined labels|undefined references)", msg.msg
):
# LaTeX prints this at the end so the user knows it's
# worthwhile looking back at the log. Since latexrun
# makes the earlier messages obvious, this is
Expand Down