]> git.lyx.org Git - features.git/commitdiff
Fix output of HTML tags in bibliography info.
authorRichard Heck <rgheck@comcast.net>
Wed, 15 Sep 2010 13:50:17 +0000 (13:50 +0000)
committerRichard Heck <rgheck@comcast.net>
Wed, 15 Sep 2010 13:50:17 +0000 (13:50 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35388 a592a061-630c-0410-9148-cb99ea01b6c8

src/BiblioInfo.cpp
src/BiblioInfo.h
src/insets/InsetBibtex.cpp

index 9d10b3359aef4302d0ae3fff20fe4ea530457f74..420eaa2177c87f9d1d05f92d939565fd60313136 100644 (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
index 3e7266fac85214d66b30d7affc1a93f92ff9e184..efe4bff233948d61e5785959e87a0f2815bd320f 100644 (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
index 4f1e53c2a037adaf1fecb28458fe57eec617578d..43d19d3f73aabc237ee62c7ad92c9e5c0fad26ce 100644 (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");