]> git.lyx.org Git - lyx.git/blobdiff - src/BiblioInfo.cpp
Some cleanup for the Floating class.
[lyx.git] / src / BiblioInfo.cpp
index 81234b89d873aea7bc1e8630cd4468b043307d4d..9cb3b4458e5c04bf5878d80cf010028dc92b70b5 100644 (file)
@@ -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;
 }
 
@@ -475,6 +482,16 @@ docstring const BiblioInfo::getInfo(docstring const & key) const
 }
 
 
+bool BiblioInfo::isBibtex(docstring const & key) const
+{
+       BiblioInfo::const_iterator it = find(key);
+       if (it == end())
+               return false;
+       return it->second.isBibTeX();
+}
+
+
+
 vector<docstring> const BiblioInfo::getCiteStrings(
        docstring const & key, Buffer const & buf) const
 {