From f5bde886777269b952864211487258582a007d19 Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Mon, 21 Mar 2005 14:31:22 +0000 Subject: [PATCH] support \% in bib files; support annote field git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9732 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/controllers/ChangeLog | 5 +++++ src/frontends/controllers/biblio.C | 9 ++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/frontends/controllers/ChangeLog b/src/frontends/controllers/ChangeLog index 65c71d8285..9802c76a4a 100644 --- a/src/frontends/controllers/ChangeLog +++ b/src/frontends/controllers/ChangeLog @@ -1,3 +1,8 @@ +2005-03-15 Eitan Frachtenberg + + * biblio.C (getInfo): Show BibTeX annotation in citation preview + (parseBibTex): Treat \% as percent, not comment + 2005-02-08 Lars Gullik Bjonnes * ControlSpellchecker.C (nextWord): size() -> depth() diff --git a/src/frontends/controllers/biblio.C b/src/frontends/controllers/biblio.C index 734ade4a12..32d4f8af36 100644 --- a/src/frontends/controllers/biblio.C +++ b/src/frontends/controllers/biblio.C @@ -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