]> git.lyx.org Git - features.git/commitdiff
TexRow for InsetArgument
authorGuillaume Munch <gm@lyx.org>
Fri, 23 Sep 2016 23:12:38 +0000 (01:12 +0200)
committerGuillaume Munch <gm@lyx.org>
Sun, 16 Oct 2016 22:16:59 +0000 (00:16 +0200)
src/insets/InsetArgument.cpp
src/insets/InsetArgument.h

index 991b021b26454bc3399804b81eb48a3246d5676f..821fbbc9a52c73f6e42144cd151e2efc249fccab 100644 (file)
@@ -277,20 +277,23 @@ void InsetArgument::latexArgument(otexstream & os,
                OutputParams const & runparams_in, docstring const & ldelim,
                docstring const & rdelim, docstring const & presetarg) const
 {
-       odocstringstream ss;
-       otexstream ots(ss);
+       otexstringstream ots;
        OutputParams runparams = runparams_in;
        if (!pass_thru_chars_.empty())
                runparams.pass_thru_chars += pass_thru_chars_;
        InsetText::latex(ots, runparams);
-       docstring str = ss.str();
-       docstring const sep = str.empty() ? docstring() : from_ascii(", ");
-       if (!presetarg.empty())
-               str = presetarg + sep + str;
-       if (ldelim != "{" && support::contains(str, rdelim))
-               str = '{' + str + '}';
-       // TODO: append texrow information
-       os << ldelim << str << rdelim;
+       TexString ts = ots.release();
+       bool const add_braces = ldelim != "{" && support::contains(ts.str, rdelim);
+       os << ldelim;
+       if (add_braces)
+               os << '{';
+       os << presetarg;
+       if (!presetarg.empty() && !ts.str.empty())
+               os << ", ";
+       os << move(ts);
+       if (add_braces)
+               os << '}';
+       os << rdelim;
 }
 
 
index 935d68cbbc29f877459755b39e488c9ff380bcf8..5c4701d8fcc471a1c75be6929bada882970f0bd0 100644 (file)
@@ -30,9 +30,9 @@ public:
        InsetArgument(Buffer *, std::string const &);
 
        /// Outputting the parameter of a LaTeX command
-       void latexArgument(otexstream &, OutputParams const &,
-                          docstring const&, docstring const &,
-                          docstring const &) const;
+       void latexArgument(otexstream & os, OutputParams const & runparams_in,
+                          docstring const & ldelim, docstring const & rdelim,
+                          docstring const & presetarg) const;
 
        std::string name() const { return name_; }