From 1e4e0efe0eb1a856c39b69d0a254e1b8e0ece1b1 Mon Sep 17 00:00:00 2001 From: Angus Leeming Date: Tue, 20 Mar 2001 12:59:37 +0000 Subject: [PATCH] small fix to ControlCitation git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1797 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/controllers/ChangeLog | 4 ++++ src/frontends/controllers/ControlCitation.C | 25 ++++++++++++--------- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/src/frontends/controllers/ChangeLog b/src/frontends/controllers/ChangeLog index dfb923b5ba..4aca29f7ca 100644 --- a/src/frontends/controllers/ChangeLog +++ b/src/frontends/controllers/ChangeLog @@ -1,3 +1,7 @@ +2001-03-20 Angus Leeming + + * ControlCitation.C (getBibkeyInfo): parse non-BibTeX entries correctly. + 2001-03-20 Angus Leeming * ControlLog.[Ch]: diff --git a/src/frontends/controllers/ControlCitation.C b/src/frontends/controllers/ControlCitation.C index 954042f5f5..9e25086f29 100644 --- a/src/frontends/controllers/ControlCitation.C +++ b/src/frontends/controllers/ControlCitation.C @@ -89,23 +89,23 @@ string const ControlCitation::getBibkeyInfo(string const & key) InfoMap::const_iterator it = bibkeysInfo_.find(key); if (it != bibkeysInfo_.end()) { // Search for all possible "required" keys - string author = parseBibTeX((*it).second, "author"); + string author = parseBibTeX(it->second, "author"); if (author.empty()) - author = parseBibTeX((*it).second, "editor"); + author = parseBibTeX(it->second, "editor"); - string year = parseBibTeX((*it).second, "year"); - string title = parseBibTeX((*it).second, "title"); - string booktitle = parseBibTeX((*it).second, "booktitle"); - string chapter = parseBibTeX((*it).second, "chapter"); - string pages = parseBibTeX((*it).second, "pages"); + string year = parseBibTeX(it->second, "year"); + string title = parseBibTeX(it->second, "title"); + string booktitle = parseBibTeX(it->second, "booktitle"); + string chapter = parseBibTeX(it->second, "chapter"); + string pages = parseBibTeX(it->second, "pages"); - string media = parseBibTeX((*it).second, "journal"); + string media = parseBibTeX(it->second, "journal"); if (media.empty()) - media = parseBibTeX((*it).second, "publisher"); + media = parseBibTeX(it->second, "publisher"); if (media.empty()) - media = parseBibTeX((*it).second, "school"); + media = parseBibTeX(it->second, "school"); if (media.empty()) - media = parseBibTeX((*it).second, "institution"); + media = parseBibTeX(it->second, "institution"); result = author; if (!year.empty()) @@ -120,6 +120,9 @@ string const ControlCitation::getBibkeyInfo(string const & key) result += ", " + media; if (!pages.empty()) result += ", pp. " + pages; + + if (result.empty()) // not a BibTeX record + result = it->second; } return result;