#include "FuncRequest.h"
#include "LaTeXFeatures.h"
#include "OutputParams.h"
+#include "output_xhtml.h"
#include "support/docstream.h"
#include "support/gettext.h"
namespace lyx {
-InsetHyperlink::InsetHyperlink(InsetCommandParams const & p)
- : InsetCommand(p, "href")
+InsetHyperlink::InsetHyperlink(Buffer * buf, InsetCommandParams const & p)
+ : InsetCommand(buf, p, "href")
{}
}
-void 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("&"))
- << "\">"
- << 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();
}