Bibtex file with localfile field are destroyed by current kbibtex.
If you create an article with your favorite editor:
@article{test,
author = "test",
title = "test",
journal = "test",
year = 2012,
localfile = "/tmp/test.pdf",
}
during loading the file kbibtex convert local file to http://test.pdf
The following patch avoid this problem.
bug-debian: http://bugs.debian.org/644024
Forwarded: http://gna.org/bugs/?20275
applied-upstream: 4.1
Gbp-Pq: Name 0005-Fix-data-loss-with-localfile-field.patch
if (isStringKey)
value.append(new MacroKey(text));
else {
- QList<KUrl> urls;
- FileInfo::urlsInText(text, false, QString::null, urls);
- for (QList<KUrl>::ConstIterator it = urls.constBegin(); it != urls.constEnd(); ++it)
- value.append(new VerbatimText((*it).pathOrUrl()));
+ /// Assumption: in fields like Url or LocalFile, file names are separated by ; or ,
+ static const QRegExp semicolonSpace = QRegExp("[;]\\s*");
+ QStringList fileList = text.split(semicolonSpace, QString::SkipEmptyParts);
+ foreach(const QString &filename, fileList) {
+ value.append(new VerbatimText(filename));
+ }
}
} else if (iKey == Entry::ftMonth) {
if (isStringKey) {