#include "support/std_ostream.h"
-using lyx::docstring;
-using lyx::odocstream;
-using lyx::support::subst;
+
+namespace lyx {
+
+using support::subst;
using std::string;
using std::ostream;
docstring const temp =
(getCmdName() == "url") ? _("Url: ") : _("HtmlUrl: ");
- string url;
+ docstring url;
- if (!getOptions().empty())
- url += getOptions();
+ if (!getParam("name").empty())
+ url += getParam("name");
else
- url += getContents();
+ url += getParam("target");
// elide if long
if (url.length() > 30) {
url = url.substr(0, 10) + "..."
+ url.substr(url.length() - 17, url.length());
}
- // FIXME UNICODE
- return temp + lyx::from_utf8(url);
+ return temp + url;
}
int InsetUrl::plaintext(Buffer const &, odocstream & os,
OutputParams const &) const
{
- // FIXME UNICODE
- os << '[' << lyx::from_utf8(getContents());
- if (getOptions().empty())
+ os << '[' << getParam("target");
+ if (getParam("name").empty())
os << ']';
else
- // FIXME UNICODE
- os << "||" << lyx::from_utf8(getOptions()) << ']';
+ os << "||" << getParam("name") << ']';
return 0;
}
-int InsetUrl::docbook(Buffer const &, ostream & os,
+int InsetUrl::docbook(Buffer const &, odocstream & os,
OutputParams const &) const
{
- os << "<ulink url=\"" << subst(getContents(),"&","&")
- << "\">" << getOptions() << "</ulink>";
+ os << "<ulink url=\""
+ << subst(getParam("target"), from_ascii("&"), from_ascii("&"))
+ << "\">"
+ << getParam("name")
+ << "</ulink>";
return 0;
}
{
features.require("url");
}
+
+
+} // namespace lyx