}
-int InsetMathHull::plaintext(odocstream & os, OutputParams const &) const
+int InsetMathHull::plaintext(odocstream & os, OutputParams const & op) const
{
// disables ASCII-art for export of equations. See #2275.
if (0 && display()) {
// reset metrics cache to "real" values
//metrics();
return tpain.textheight();
- } else {
- odocstringstream oss;
- Encoding const * const enc = encodings.fromLyXName("utf8");
- WriteStream wi(oss, false, true, WriteStream::wsDefault, enc);
- // Fix Bug #6139
- if (type_ == hullRegexp)
- write(wi);
- else {
- for (row_type r = 0; r < nrows(); ++r) {
- for (col_type c = 0; c < ncols(); ++c)
- wi << (c == 0 ? "" : "\t") << cell(index(r, c));
- wi << "\n";
- }
+ }
+
+ odocstringstream oss;
+ Encoding const * const enc = encodings.fromLyXName("utf8");
+ WriteStream wi(oss, false, true, WriteStream::wsDefault, enc);
+
+ // Fix Bug #6139
+ if (type_ == hullRegexp)
+ write(wi);
+ else {
+ for (row_type r = 0; r < nrows(); ++r) {
+ for (col_type c = 0; c < ncols(); ++c)
+ wi << (c == 0 ? "" : "\t") << cell(index(r, c));
+ // if it's for the TOC, we write just the first line
+ // and do not include the newline.
+ if (op.for_toc)
+ break;
+ wi << "\n";
}
- docstring const str = oss.str();
- os << str;
- return str.size();
}
+ docstring const str = oss.str();
+ os << str;
+ return str.size();
}
void InsetMathHull::forToc(docstring & os, size_t) const
{
odocstringstream ods;
- plaintext(ods, OutputParams(0));
+ OutputParams op(0);
+ op.for_toc = true;
+ plaintext(ods, op);
os += ods.str();
}