Revert "Rename eolString() to eol() ans pass a MathTeXStream parameter"

This reverts commit 2db682b97e.
This commit is contained in:
Jean-Marc Lasgouttes 2022-07-26 00:46:13 +02:00
parent 7261fa9448
commit 1fc08f57e1
5 changed files with 21 additions and 18 deletions

View File

@ -44,7 +44,8 @@ public:
///
void delCol(col_type) override {}
///
void eol(TeXMathStream &, row_type, bool, bool, bool) const override {}
docstring eolString(row_type, bool, bool, bool) const override
{ return docstring(); }
///
docstring eocString(col_type, col_type) const override
{ return docstring(); }

View File

@ -750,7 +750,7 @@ void InsetMathGrid::updateBuffer(ParIterator const & it, UpdateType utype, bool
}
void InsetMathGrid::eol(TeXMathStream & os, row_type row, bool fragile,
docstring InsetMathGrid::eolString(row_type row, bool fragile,
bool /*latex*/, bool last_eoln) const
{
docstring eol;
@ -770,9 +770,9 @@ void InsetMathGrid::eol(TeXMathStream & os, row_type row, bool fragile,
// only add \\ if necessary
if (eol.empty() && row + 1 == nrows() && (nrows() == 1 || !last_eoln))
return;
return docstring();
os << (fragile ? "\\protect\\\\" : "\\\\") << eol;
return (fragile ? "\\protect\\\\" : "\\\\") + eol;
}
@ -1247,7 +1247,7 @@ void InsetMathGrid::write(TeXMathStream & os,
row_type end_row, col_type end_col) const
{
MathEnsurer ensurer(os, false);
docstring eolstr;
docstring eol;
// As of 2018 (with amendment in LaTeX 2021/06),
// \\ is a robust command and its protection
// is no longer necessary
@ -1299,17 +1299,18 @@ void InsetMathGrid::write(TeXMathStream & os,
os << eocString(col + nccols - 1, lastcol);
col += nccols;
}
eol(os, row, fragile, os.latex(), last_eoln);
eol = eolString(row, fragile, os.latex(), last_eoln);
os << eol;
// append newline only if line wasn't completely empty
// and the formula is not written on a single line
bool const empty = emptyline && eolstr.empty();
bool const empty = emptyline && eol.empty();
if (!empty && nrows() > 1)
os << "\n";
}
// @TODO use end_row instead of nrows() ?
docstring const s = verboseHLine(rowinfo_[nrows()].lines);
if (!s.empty()) {
if (eolstr.empty()) {
if (eol.empty()) {
if (fragile)
os << "\\protect";
os << "\\\\";

View File

@ -246,7 +246,7 @@ protected:
virtual int rightMargin() const { return 0; }
/// returns proper 'end of line' code for LaTeX
virtual void eol(TeXMathStream & os, row_type row, bool fragile, bool latex,
virtual docstring eolString(row_type row, bool fragile, bool latex,
bool last_eoln) const;
/// returns proper 'end of column' code for LaTeX
virtual docstring eocString(col_type col, col_type lastcol) const;

View File

@ -1680,26 +1680,27 @@ void InsetMathHull::mutate(HullType newtype)
}
void InsetMathHull::eol(TeXMathStream & os, row_type row, bool fragile, bool latex,
docstring InsetMathHull::eolString(row_type row, bool fragile, bool latex,
bool last_eoln) const
{
docstring res;
if (numberedType()) {
if (label_[row]) {
docstring const name =
latex ? escape(label_[row]->getParam("name"))
: label_[row]->getParam("name");
os << "\\label{" + name + '}';
res += "\\label{" + name + '}';
}
if (type_ != hullMultline) {
if (numbered_[row] == NONUMBER)
os << "\\nonumber ";
res += "\\nonumber ";
else if (numbered_[row] == NOTAG)
os<< "\\notag ";
res += "\\notag ";
}
}
// Never add \\ on the last empty line of eqnarray and friends
last_eoln = false;
InsetMathGrid::eol(os, row, fragile, latex, last_eoln);
return res + InsetMathGrid::eolString(row, fragile, latex, last_eoln);
}
void InsetMathHull::write(TeXMathStream & os) const

View File

@ -202,7 +202,7 @@ protected:
/// override to set to 0 for inline equation
int border() const override;
///
void eol(TeXMathStream & os, row_type row, bool fragile, bool latex,
docstring eolString(row_type row, bool fragile, bool latex,
bool last_eoln) const override;
private: