X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FBiblioInfo.cpp;h=7005519ac3f8978a535e8f4c258a2b7402b71e06;hb=bf25e8568db22625feb3affbf3e31df804dae916;hp=5ec3986af6b51731d5bbaeb6ebc9fcaaaebb0ef8;hpb=8365eabd6f978d8bdc7fbcfabba83548ae409d94;p=lyx.git diff --git a/src/BiblioInfo.cpp b/src/BiblioInfo.cpp index 5ec3986af6..7005519ac3 100644 --- a/src/BiblioInfo.cpp +++ b/src/BiblioInfo.cpp @@ -488,8 +488,8 @@ docstring processRichtext(docstring const & str, bool richtext) ////////////////////////////////////////////////////////////////////// BibTeXInfo::BibTeXInfo(docstring const & key, docstring const & type) - : is_bibtex_(true), bib_key_(key), num_bib_key_(0), entry_type_(type), info_(), - modifier_(0) + : is_bibtex_(true), bib_key_(key), num_bib_key_(0), entry_type_(type), + info_(), format_(), modifier_(0) {} @@ -1000,8 +1000,23 @@ docstring const & BibTeXInfo::getInfo(BibTeXInfoList const & xrefs, { bool const richtext = ci.richtext; - if (!richtext && !info_.empty()) + CiteEngineType const engine_type = buf.params().citeEngineType(); + DocumentClass const & dc = buf.params().documentClass(); + docstring const & format = format_in.empty()? + from_utf8(dc.getCiteFormat(engine_type, to_utf8(entry_type_))) + : format_in; + + if (format != format_) { + // clear caches since format changed + info_.clear(); + info_richtext_.clear(); + format_ = format; + } + + if (!richtext && !info_.empty()) { + info_ = convertLaTeXCommands(processRichtext(info_, false)); return info_; + } if (richtext && !info_richtext_.empty()) return info_richtext_; @@ -1011,11 +1026,6 @@ docstring const & BibTeXInfo::getInfo(BibTeXInfoList const & xrefs, return info_; } - CiteEngineType const engine_type = buf.params().citeEngineType(); - DocumentClass const & dc = buf.params().documentClass(); - docstring const & format = format_in.empty()? - from_utf8(dc.getCiteFormat(engine_type, to_utf8(entry_type_))) - : format_in; int counter = 0; info_ = expandFormat(format, xrefs, counter, buf, ci, false, false);