mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 13:18:28 +00:00
Rename eolString() to eol() ans pass a MathTeXStream parameter
This is completely equivalent, but will allow in eol() to determine whether one is preparing a preview. Related to bug #11535.
This commit is contained in:
parent
c6f35b6ad6
commit
2db682b97e
@ -44,8 +44,7 @@ public:
|
|||||||
///
|
///
|
||||||
void delCol(col_type) override {}
|
void delCol(col_type) override {}
|
||||||
///
|
///
|
||||||
docstring eolString(row_type, bool, bool, bool) const override
|
void eol(TeXMathStream &, row_type, bool, bool, bool) const override {}
|
||||||
{ return docstring(); }
|
|
||||||
///
|
///
|
||||||
docstring eocString(col_type, col_type) const override
|
docstring eocString(col_type, col_type) const override
|
||||||
{ return docstring(); }
|
{ return docstring(); }
|
||||||
|
@ -750,7 +750,7 @@ void InsetMathGrid::updateBuffer(ParIterator const & it, UpdateType utype, bool
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
docstring InsetMathGrid::eolString(row_type row, bool fragile,
|
void InsetMathGrid::eol(TeXMathStream & os, row_type row, bool fragile,
|
||||||
bool /*latex*/, bool last_eoln) const
|
bool /*latex*/, bool last_eoln) const
|
||||||
{
|
{
|
||||||
docstring eol;
|
docstring eol;
|
||||||
@ -770,9 +770,9 @@ docstring InsetMathGrid::eolString(row_type row, bool fragile,
|
|||||||
|
|
||||||
// only add \\ if necessary
|
// only add \\ if necessary
|
||||||
if (eol.empty() && row + 1 == nrows() && (nrows() == 1 || !last_eoln))
|
if (eol.empty() && row + 1 == nrows() && (nrows() == 1 || !last_eoln))
|
||||||
return docstring();
|
return;
|
||||||
|
|
||||||
return (fragile ? "\\protect\\\\" : "\\\\") + eol;
|
os << (fragile ? "\\protect\\\\" : "\\\\") << eol;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1247,7 +1247,7 @@ void InsetMathGrid::write(TeXMathStream & os,
|
|||||||
row_type end_row, col_type end_col) const
|
row_type end_row, col_type end_col) const
|
||||||
{
|
{
|
||||||
MathEnsurer ensurer(os, false);
|
MathEnsurer ensurer(os, false);
|
||||||
docstring eol;
|
docstring eolstr;
|
||||||
// As of 2018 (with amendment in LaTeX 2021/06),
|
// As of 2018 (with amendment in LaTeX 2021/06),
|
||||||
// \\ is a robust command and its protection
|
// \\ is a robust command and its protection
|
||||||
// is no longer necessary
|
// is no longer necessary
|
||||||
@ -1299,18 +1299,17 @@ void InsetMathGrid::write(TeXMathStream & os,
|
|||||||
os << eocString(col + nccols - 1, lastcol);
|
os << eocString(col + nccols - 1, lastcol);
|
||||||
col += nccols;
|
col += nccols;
|
||||||
}
|
}
|
||||||
eol = eolString(row, fragile, os.latex(), last_eoln);
|
eol(os, row, fragile, os.latex(), last_eoln);
|
||||||
os << eol;
|
|
||||||
// append newline only if line wasn't completely empty
|
// append newline only if line wasn't completely empty
|
||||||
// and the formula is not written on a single line
|
// and the formula is not written on a single line
|
||||||
bool const empty = emptyline && eol.empty();
|
bool const empty = emptyline && eolstr.empty();
|
||||||
if (!empty && nrows() > 1)
|
if (!empty && nrows() > 1)
|
||||||
os << "\n";
|
os << "\n";
|
||||||
}
|
}
|
||||||
// @TODO use end_row instead of nrows() ?
|
// @TODO use end_row instead of nrows() ?
|
||||||
docstring const s = verboseHLine(rowinfo_[nrows()].lines);
|
docstring const s = verboseHLine(rowinfo_[nrows()].lines);
|
||||||
if (!s.empty()) {
|
if (!s.empty()) {
|
||||||
if (eol.empty()) {
|
if (eolstr.empty()) {
|
||||||
if (fragile)
|
if (fragile)
|
||||||
os << "\\protect";
|
os << "\\protect";
|
||||||
os << "\\\\";
|
os << "\\\\";
|
||||||
|
@ -246,8 +246,8 @@ protected:
|
|||||||
virtual int rightMargin() const { return 0; }
|
virtual int rightMargin() const { return 0; }
|
||||||
|
|
||||||
/// returns proper 'end of line' code for LaTeX
|
/// returns proper 'end of line' code for LaTeX
|
||||||
virtual docstring eolString(row_type row, bool fragile, bool latex,
|
virtual void eol(TeXMathStream & os, row_type row, bool fragile, bool latex,
|
||||||
bool last_eoln) const;
|
bool last_eoln) const;
|
||||||
/// returns proper 'end of column' code for LaTeX
|
/// returns proper 'end of column' code for LaTeX
|
||||||
virtual docstring eocString(col_type col, col_type lastcol) const;
|
virtual docstring eocString(col_type col, col_type lastcol) const;
|
||||||
/// splits cells and shifts right part to the next cell
|
/// splits cells and shifts right part to the next cell
|
||||||
|
@ -1680,27 +1680,26 @@ void InsetMathHull::mutate(HullType newtype)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
docstring InsetMathHull::eolString(row_type row, bool fragile, bool latex,
|
void InsetMathHull::eol(TeXMathStream & os, row_type row, bool fragile, bool latex,
|
||||||
bool last_eoln) const
|
bool last_eoln) const
|
||||||
{
|
{
|
||||||
docstring res;
|
|
||||||
if (numberedType()) {
|
if (numberedType()) {
|
||||||
if (label_[row]) {
|
if (label_[row]) {
|
||||||
docstring const name =
|
docstring const name =
|
||||||
latex ? escape(label_[row]->getParam("name"))
|
latex ? escape(label_[row]->getParam("name"))
|
||||||
: label_[row]->getParam("name");
|
: label_[row]->getParam("name");
|
||||||
res += "\\label{" + name + '}';
|
os << "\\label{" + name + '}';
|
||||||
}
|
}
|
||||||
if (type_ != hullMultline) {
|
if (type_ != hullMultline) {
|
||||||
if (numbered_[row] == NONUMBER)
|
if (numbered_[row] == NONUMBER)
|
||||||
res += "\\nonumber ";
|
os << "\\nonumber ";
|
||||||
else if (numbered_[row] == NOTAG)
|
else if (numbered_[row] == NOTAG)
|
||||||
res += "\\notag ";
|
os<< "\\notag ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Never add \\ on the last empty line of eqnarray and friends
|
// Never add \\ on the last empty line of eqnarray and friends
|
||||||
last_eoln = false;
|
last_eoln = false;
|
||||||
return res + InsetMathGrid::eolString(row, fragile, latex, last_eoln);
|
InsetMathGrid::eol(os, row, fragile, latex, last_eoln);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InsetMathHull::write(TeXMathStream & os) const
|
void InsetMathHull::write(TeXMathStream & os) const
|
||||||
|
@ -202,8 +202,8 @@ protected:
|
|||||||
/// override to set to 0 for inline equation
|
/// override to set to 0 for inline equation
|
||||||
int border() const override;
|
int border() const override;
|
||||||
///
|
///
|
||||||
docstring eolString(row_type row, bool fragile, bool latex,
|
void eol(TeXMathStream & os, row_type row, bool fragile, bool latex,
|
||||||
bool last_eoln) const override;
|
bool last_eoln) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Inset * clone() const override;
|
Inset * clone() const override;
|
||||||
|
Loading…
Reference in New Issue
Block a user