]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetHyperlink.cpp
Routines for calculating numerical labels for BibTeX citations.
[lyx.git] / src / insets / InsetHyperlink.cpp
index aa4ff3af7d784655d07bacb73bb8e753945067b6..79908011fa1a28b4289591c7e72f5039a14adacf 100644 (file)
@@ -17,6 +17,7 @@
 #include "FuncRequest.h"
 #include "LaTeXFeatures.h"
 #include "OutputParams.h"
+#include "output_xhtml.h"
 
 #include "support/docstream.h"
 #include "support/gettext.h"
@@ -28,8 +29,8 @@ using namespace lyx::support;
 namespace lyx {
 
 
-InsetHyperlink::InsetHyperlink(InsetCommandParams const & p)
-       : InsetCommand(p, "href")
+InsetHyperlink::InsetHyperlink(Buffer * buf, InsetCommandParams const & p)
+       : InsetCommand(buf, p, "href")
 {}
 
 
@@ -181,14 +182,13 @@ int InsetHyperlink::docbook(odocstream & os, OutputParams const &) const
 }
 
 
-docstring InsetHyperlink::xhtml(odocstream & os, OutputParams const &) const
+docstring InsetHyperlink::xhtml(XHTMLStream & xs, OutputParams const &) const
 {
-       os << "<a href=\""
-                       // FIXME Do we need to do more escaping than this?
-          << subst(getParam("target"), from_ascii("&"), from_ascii("&amp;"))
-          << "\">"
-          << getParam("name")
-          << "</a>";
+       docstring const & target = getParam("target");
+       docstring const & name   = getParam("name");
+       xs << StartTag("a", to_utf8("href=\"" + target + "\""));
+       xs << (name.empty() ? target : name);
+       xs << EndTag("a");
        return docstring();
 }