int InsetERT::plaintext(odocstringstream & os, OutputParams const & rp, size_t max_length) const { if (!rp.inIndexEntry) // do not output TeX code return 0; ParagraphList::const_iterator par = paragraphs().begin(); ParagraphList::const_iterator end = paragraphs().end(); while (par != end && os.str().size() <= max_length) { pos_type siz = par->size(); for (pos_type i = 0; i < siz; ++i) { char_type const c = par->getChar(i); // output the active characters switch (c) { case '|': case '!': case '@': os.put(c); break; default: break; } } ++par; } return 0; }
int InsetText::plaintext(odocstringstream & os, OutputParams const & runparams, size_t max_length) const { ParagraphList::const_iterator beg = paragraphs().begin(); ParagraphList::const_iterator end = paragraphs().end(); ParagraphList::const_iterator it = beg; bool ref_printed = false; int len = 0; for (; it != end; ++it) { if (it != beg) { os << '\n'; if (runparams.linelen > 0) os << '\n'; } odocstringstream oss; writePlaintextParagraph(buffer(), *it, oss, runparams, ref_printed, max_length); docstring const str = oss.str(); os << str; // FIXME: len is not computed fully correctly; in principle, // we have to count the characters after the last '\n' len = str.size(); if (os.str().size() >= max_length) break; } return len; }