From 9a327ccc51cb0045f62aeb655673422ff9e6e1bc Mon Sep 17 00:00:00 2001 From: Richard Heck Date: Thu, 21 Jan 2010 19:48:53 +0000 Subject: [PATCH] Fix non-BibTeX detection of "author (year)" labels. Jurgen, this one is actually for branch, too. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33142 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/BiblioInfo.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/BiblioInfo.cpp b/src/BiblioInfo.cpp index 81234b89d8..bc30499b35 100644 --- a/src/BiblioInfo.cpp +++ b/src/BiblioInfo.cpp @@ -217,7 +217,11 @@ docstring const BibTeXInfo::getAbbreviatedAuthor() const return docstring(); docstring authors; - split(opt, authors, '('); + docstring const remainder = trim(split(opt, authors, '(')); + if (remainder.empty()) + // in this case, we didn't find a "(", + // so we don't have author (year) + return docstring(); return authors; } @@ -254,9 +258,12 @@ docstring const BibTeXInfo::getYear() const return docstring(); docstring authors; - docstring const tmp = split(opt, authors, '('); + docstring tmp = split(opt, authors, '('); + if (tmp.empty()) + // we don't have author (year) + return docstring(); docstring year; - split(tmp, year, ')'); + tmp = split(tmp, year, ')'); return year; } -- 2.39.2