X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Foutput_plaintext.cpp;h=d58c44a7964f42fdc5e75e5cb75451c1e0aa609c;hb=57a8ea32c0a2443c188a522b516100bb74ec4a8d;hp=f28a046ab5b42ff804630e2887d37a7fa9fcb3ef;hpb=db8c16d554ebb1dcb319e44d318572de6eff024b;p=lyx.git diff --git a/src/output_plaintext.cpp b/src/output_plaintext.cpp index f28a046ab5..d58c44a796 100644 --- a/src/output_plaintext.cpp +++ b/src/output_plaintext.cpp @@ -3,7 +3,7 @@ * This file is part of LyX, the document processor. * Licence details can be found in the file COPYING. * - * \author Lars Gullik Bjønnes + * \author Lars Gullik Bjønnes * * Full author contact details are available in file CREDITS. */ @@ -34,9 +34,14 @@ namespace lyx { void writePlaintextFile(Buffer const & buf, FileName const & fname, OutputParams const & runparams) { - odocfstream ofs; + ofdocstream ofs; if (!openFileWrite(ofs, fname)) return; + + // make sure we are ready to export + buf.updateBuffer(); + buf.updateMacroInstances(OutputUpdate); + writePlaintextFile(buf, ofs, runparams); } @@ -45,7 +50,7 @@ void writePlaintextFile(Buffer const & buf, odocstream & os, OutputParams const & runparams) { bool ref_printed = false; - ParagraphList const par = buf.paragraphs(); + ParagraphList const & par = buf.paragraphs(); ParagraphList::const_iterator beg = par.begin(); ParagraphList::const_iterator end = par.end(); ParagraphList::const_iterator it = beg; @@ -77,7 +82,7 @@ void writePlaintextParagraph(Buffer const & buf, depth_type depth = par.params().depth(); // First write the layout - string const tmp = to_utf8(par.layout()->name()); + string const tmp = to_utf8(par.layout().name()); if (compare_ascii_no_case(tmp, "itemize") == 0) { ltype = 1; ltype_depth = depth + 1; @@ -210,7 +215,7 @@ void writePlaintextParagraph(Buffer const & buf, break; case '\0': - LYXERR(Debug::INFO, "writePlaintextFile: NULL char in structure."); + LYXERR(Debug::INFO, "writePlaintextFile: NUL char in structure."); break; default: