support \% in bib files; support annote field

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9732 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2005-03-21 14:31:22 +00:00
parent 7a032c6b06
commit f5bde88677
2 changed files with 13 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2005-03-15 Eitan Frachtenberg <sky8an@gmail.com>
* biblio.C (getInfo): Show BibTeX annotation in citation preview
(parseBibTex): Treat \% as percent, not comment
2005-02-08 Lars Gullik Bjonnes <larsbj@gullik.net>
* ControlSpellchecker.C (nextWord): size() -> depth()

View File

@ -324,6 +324,7 @@ string const getInfo(InfoMap const & map, string const & key)
string number = parseBibTeX(data, "number");
string volume = parseBibTeX(data, "volume");
string pages = parseBibTeX(data, "pages");
string annote = parseBibTeX(data, "annote");
string media = parseBibTeX(data, "journal");
if (media.empty())
@ -352,6 +353,8 @@ string const getInfo(InfoMap const & map, string const & key)
result << ", pp. " << pages;
if (!year.empty())
result << ", " << year;
if (!annote.empty())
result << "\n\n" << annote;
string const result_str = rtrim(result.str());
if (!result_str.empty())
@ -480,7 +483,11 @@ string const parseBibTeX(string data, string const & findkey)
string::size_type const idx =
dummy.empty() ? string::npos : dummy.find('%');
if (idx != string::npos)
dummy.erase(idx, string::npos);
// Check if this is really a comment or just "\%"
if (idx == 0 || dummy[idx - 1] != '\\')
dummy.erase(idx, string::npos);
else // This is "\%", so just erase the '\'
dummy.erase(idx - 1, 1);
// do we have a new token or a new line of
// the same one? In the first case we ignore
// the \n and in the second we replace it