commit 6edbc1da66ed5116f6062c854c8c5a18a40f2bf4
Author: Guillaume Munch <[email protected]>
Date: Sat Sep 24 01:12:38 2016 +0200
TexRow for InsetArgument
---
src/insets/InsetArgument.cpp | 23 +++++++++++++----------
src/insets/InsetArgument.h | 6 +++---
2 files changed, 16 insertions(+), 13 deletions(-)
diff --git a/src/insets/InsetArgument.cpp b/src/insets/InsetArgument.cpp
index 991b021..821fbbc 100644
--- a/src/insets/InsetArgument.cpp
+++ b/src/insets/InsetArgument.cpp
@@ -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;
}
diff --git a/src/insets/InsetArgument.h b/src/insets/InsetArgument.h
index 935d68c..5c4701d 100644
--- a/src/insets/InsetArgument.h
+++ b/src/insets/InsetArgument.h
@@ -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_; }