X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2Finseturl.C;h=4bd7f5765a8d581e512c828af431d7aafdd426ab;hb=e28331ed63062dea10d0a21b9ec12034b4b17b9a;hp=4802f14eedd1f979fe2031c3df6ad4663f6603f9;hpb=d9e6e32961860821ecc047039ae6c1a9dcc6e35d;p=lyx.git diff --git a/src/insets/inseturl.C b/src/insets/inseturl.C index 4802f14eed..4bd7f5765a 100644 --- a/src/insets/inseturl.C +++ b/src/insets/inseturl.C @@ -22,7 +22,10 @@ #include "support/std_ostream.h" -using lyx::support::subst; + +namespace lyx { + +using support::subst; using std::string; using std::ostream; @@ -33,20 +36,17 @@ InsetUrl::InsetUrl(InsetCommandParams const & p) {} -string const InsetUrl::getScreenLabel(Buffer const &) const +docstring const InsetUrl::getScreenLabel(Buffer const &) const { - string temp; - if (getCmdName() == "url") - temp = _("Url: "); - else - temp = _("HtmlUrl: "); + 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) { @@ -57,50 +57,44 @@ string const InsetUrl::getScreenLabel(Buffer const &) const } -int InsetUrl::latex(Buffer const &, ostream & os, +int InsetUrl::latex(Buffer const &, odocstream & os, OutputParams const & runparams) const { - if (!getOptions().empty()) - os << getOptions() + ' '; + docstring const & name = getParam("name"); + if (!name.empty()) + os << name + ' '; if (runparams.moving_arg) os << "\\protect"; - os << "\\url{" << getContents() << '}'; + os << "\\url{" << getParam("target") << '}'; return 0; } -int InsetUrl::plaintext(Buffer const &, ostream & os, +int InsetUrl::plaintext(Buffer const &, odocstream & os, OutputParams const &) const { - if (getOptions().empty()) - os << '[' << getContents() << ']'; + os << '[' << getParam("target"); + if (getParam("name").empty()) + os << ']'; else - os << '[' << getContents() << "||" << getOptions() << ']'; + os << "||" << getParam("name") << ']'; return 0; } -int InsetUrl::linuxdoc(Buffer const &, ostream & os, - OutputParams const &) const -{ - os << '<' << getCmdName() - << " url=\"" << getContents() << "\"" - << " name=\"" << getOptions() << "\">"; - - return 0; -} - - -int InsetUrl::docbook(Buffer const &, ostream & os, +int InsetUrl::docbook(Buffer const &, odocstream & os, OutputParams const &) const { - os << "" << getOptions() << ""; + os << "" + << getParam("name") + << ""; return 0; } -int InsetUrl::textString(Buffer const & buf, ostream & os, +int InsetUrl::textString(Buffer const & buf, odocstream & os, OutputParams const & op) const { return plaintext(buf, os, op); @@ -111,3 +105,6 @@ void InsetUrl::validate(LaTeXFeatures & features) const { features.require("url"); } + + +} // namespace lyx