]> git.lyx.org Git - lyx.git/blobdiff - src/Buffer.cpp
Fix bug 5411
[lyx.git] / src / Buffer.cpp
index f46f7b0029b45ac33d6c10efe0f5371bcd5a0f3f..418ea5447fdfbfdecb052b7bcdf03a2e6a7394eb 100644 (file)
@@ -115,7 +115,9 @@ namespace os = support::os;
 
 namespace {
 
-int const LYX_FORMAT = 342; //uwestoehr: support for Mongolian
+// Do not remove the comment below, so we get merge conflict in
+// independent branches. Instead add your own.
+int const LYX_FORMAT = 345;  // jamatos: xml elements
 
 typedef map<string, bool> DepClean;
 typedef map<docstring, pair<InsetLabel const *, Buffer::References> > RefCache;
@@ -275,6 +277,11 @@ Buffer::~Buffer()
        // GuiView already destroyed
        gui_ = 0;
 
+       if (d->unnamed && d->filename.extension() == "internal") {
+               // No need to do additional cleanups for internal buffer.
+               delete d;
+               return;
+       }
 
        // loop over children
        Impl::BufferPositionMap::iterator it = d->children_positions.begin();
@@ -2114,10 +2121,11 @@ void Buffer::getSourceCode(odocstream & os, pit_type par_begin,
                os << "% " << _("Preview source code") << "\n\n";
                d->texrow.newline();
                d->texrow.newline();
-               if (isLatex())
-                       writeLaTeXSource(os, filePath(), runparams, true, true);
-               else
+               if (isDocBook())
                        writeDocBookSource(os, absFileName(), runparams, false);
+               else
+                       // latex or literate
+                       writeLaTeXSource(os, string(), runparams, true, true);
        } else {
                runparams.par_begin = par_begin;
                runparams.par_end = par_end;
@@ -2135,11 +2143,11 @@ void Buffer::getSourceCode(odocstream & os, pit_type par_begin,
                d->texrow.newline();
                d->texrow.newline();
                // output paragraphs
-               if (isLatex())
-                       latexParagraphs(*this, text(), os, d->texrow, runparams);
-               else
-                       // DocBook
+               if (isDocBook())
                        docbookParagraphs(paragraphs(), *this, os, runparams);
+               else 
+                       // latex or literate
+                       latexParagraphs(*this, text(), os, d->texrow, runparams);
        }
 }