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
This commit is contained in:
Richard Heck 2010-09-15 13:50:17 +00:00
parent 269969db0d
commit b5d2e9d285
3 changed files with 16 additions and 1 deletions

View File

@ -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 += "&lt;";
else if (thischar == '>')
ret += "&gt;";
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

View File

@ -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

View File

@ -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");