Package: xapers
Version: 0.6-1
Severity: wishlist
Tags: patch upstream
When there is a parsing error in the BibTeX file scanned by Xapers, no
indication is given about is location in the file. Would it be possible
to implement something along the lines of the patch attached to this bug
report?
Thanks.
Rafael
-- System Information:
Debian Release: stretch/sid
APT prefers testing
APT policy: (650, 'testing'), (600, 'unstable'), (550, 'stable'), (500, 'experimental')
Architecture: i386 (i686)
Kernel: Linux 4.3.0-trunk-686-pae (SMP w/2 CPU cores)
Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
Versions of packages xapers depends on:
ii poppler-utils 0.38.0-2+b1
ii pybtex 0.19-2
ii python 2.7.11-1
ii python-pkg-resources 18.8-1
ii python-xapian 1.2.23-1
Versions of packages xapers recommends:
ii python-pycurl 7.43.0-1
ii python-urwid 1.3.1-2+b1
ii xclip 0.12+svn84-4
ii xdg-utils 1.1.1-1
xapers suggests no packages.
-- no debconf information
>From 4ce8e43b7022091ffb3a65cb371df18cda7c42f9 Mon Sep 17 00:00:00 2001
From: Rafael Laboissiere <[email protected]>
Date: Tue, 10 May 2016 17:01:12 +0200
Subject: [PATCH] Print context of syntax error found in the BibTeX file
---
lib/xapers/bibtex.py | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/lib/xapers/bibtex.py b/lib/xapers/bibtex.py
index 45d908b..f9e2cbb 100644
--- a/lib/xapers/bibtex.py
+++ b/lib/xapers/bibtex.py
@@ -35,7 +35,11 @@ class Bibtex():
parser = inparser.Parser(encoding='utf-8')
if os.path.exists(bibtex):
- bibdata = parser.parse_file(bibtex)
+ try:
+ bibdata = parser.parse_file(bibtex)
+ except TokenRequired as e:
+ print e.get_context()
+ raise e
else:
# StringIO requires unicode input
# http://nedbatchelder.com/text/unipain.html
--
2.8.0.rc3