From: Richard Heck Date: Wed, 15 Sep 2010 13:50:17 +0000 (+0000) Subject: Fix output of HTML tags in bibliography info. X-Git-Tag: 2.0.0~2602 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=b5d2e9d285f994dc9d1339209f07913d344302f0;p=features.git Fix output of HTML tags in bibliography info. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35388 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/BiblioInfo.cpp b/src/BiblioInfo.cpp index 9d10b3359a..420eaa2177 100644 --- a/src/BiblioInfo.cpp +++ b/src/BiblioInfo.cpp @@ -491,7 +491,19 @@ docstring BibTeXInfo::expandFormat(string const & format, } else if (scanning_key) key += char(thischar); - else if (richtext || !scanning_rich) + else if (richtext) { + if (scanning_rich) + ret += thischar; + else { + // we need to escape '<' and '>' + if (thischar == '<') + ret += "<"; + else if (thischar == '>') + ret += ">"; + else + ret += thischar; + } + } else if (!scanning_rich /* && !richtext */) ret += thischar; // else the character is discarded, which will happen only if // richtext == false and we are scanning rich text diff --git a/src/BiblioInfo.h b/src/BiblioInfo.h index 3e7266fac8..efe4bff233 100644 --- a/src/BiblioInfo.h +++ b/src/BiblioInfo.h @@ -173,6 +173,8 @@ public: /// \return formatted BibTeX data associated with a given key. /// Empty if no info exists. /// Note that this will retrieve data from the crossref as needed. + /// If \param richtext is true, then it will output any richtext tags + /// marked in the citation format and escape < and > elsewhere. docstring const getInfo(docstring const & key, Buffer const & buf, bool richtext = false) const; /// Is this a reference from a bibtex database diff --git a/src/insets/InsetBibtex.cpp b/src/insets/InsetBibtex.cpp index 4f1e53c2a0..43d19d3f73 100644 --- a/src/insets/InsetBibtex.cpp +++ b/src/insets/InsetBibtex.cpp @@ -969,6 +969,7 @@ docstring InsetBibtex::xhtml(XHTMLStream & xs, OutputParams const &) const // which will give us all the cross-referenced info. But for every // entry, so there's a lot of repitition. This should be fixed. xs << html::StartTag("span", "class='bibtexinfo'") + << XHTMLStream::NextRaw() << bibinfo.getInfo(entry.key(), buffer(), true) << html::EndTag("span") << html::EndTag("div");