Package: xapers Version: 0.5.2-1 Severity: normal Tags: patch The Jabref file field can contain escaped colons, when they are part of the file description or file name. For example the following bibtex entry
@Article{ES2014, Title = {An $L^p$ Theory for Stationary Radiative Transfer}, Author = {Herbert Egger and Matthias Schlottbom}, Journal = {Applicable Analysis}, Year = {2014}, Month = apr, Number = {6}, Pages = {1283--1296}, Volume = {93}, Doi = {10.1080/00036811.2013.826798}, File = {arXiv\:1304.6504v2:ES2014preprint.pdf:PDF} } is parsed by Jabref as being linked to a file ES2014preprint.pdf with description arXiv:1304.6504v2. Currently the bibtex parser of xapers chokes on this field as it uses split(':') which does not care about the escaped \:. The attached patch replaces the split with an re.split with negative lookbehind assertion to correctly handle escaped colons. Cheers, Felix
From ccea03f483abbd1dd2811e30d2b03abc8f226971 Mon Sep 17 00:00:00 2001 From: Felix Gruber <fel...@gmx.de> Date: Mon, 2 Mar 2015 22:39:24 +0100 Subject: [PATCH] fix JabRef file field with escaped : --- lib/xapers/bibtex.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/xapers/bibtex.py b/lib/xapers/bibtex.py index 45d908b..e095255 100644 --- a/lib/xapers/bibtex.py +++ b/lib/xapers/bibtex.py @@ -1,6 +1,7 @@ import os import sys import io +import re import json import pybtex from pybtex.core import Entry, Person @@ -101,7 +102,7 @@ class Bibentry(): """Returns file path if file field exists. Expects either single path string or Mendeley/Jabref format.""" try: - parsed = self.entry.fields['file'].split(':') + parsed = re.split(r'(?<!\\):', self.entry.fields['file']) if len(parsed) > 1: return parsed[1] else: -- 2.1.4