support \% in bib files; support annote field

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_3_X@9731 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2005-03-21 14:29:13 +00:00
parent f06b5b6e91
commit 634a9b81c5
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-23 Angus Leeming <leeming@lyx.org>
* ControlForks.[Ch]: removed.

View File

@ -208,6 +208,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())
@ -236,6 +237,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(STRCONV(result.str()));
if (!result_str.empty())
@ -365,7 +368,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