TexRow for InsetArgument

This commit is contained in:
Guillaume Munch 2016-09-24 01:12:38 +02:00
parent 676a0639c5
commit 6edbc1da66
2 changed files with 16 additions and 13 deletions

View 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;
}

View 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_; }