]> git.lyx.org Git - lyx.git/blobdiff - src/Buffer.cpp
Typo.
[lyx.git] / src / Buffer.cpp
index d4dde78ac0821072c6fb1e733329e529941e83f8..618b7d18a121a420f3ccd27e2091e935b831b1f4 100644 (file)
@@ -2879,7 +2879,7 @@ MacroData const * Buffer::Impl::getBufferMacro(docstring const & name,
                                // try previous macro if there is one
                                if (it == nameIt->second.begin())
                                        break;
-                               it--;
+                               --it;
                        }
                }
        }
@@ -3316,12 +3316,14 @@ void Buffer::getSourceCode(odocstream & os, string const format,
                                        convert<docstring>(par_end - 1))
                           << "\n\n";
                }
-               TexRow texrow;
-               texrow.reset();
-               texrow.newline();
-               texrow.newline();
                // output paragraphs
-               if (runparams.flavor == OutputParams::HTML) {
+               if (runparams.flavor == OutputParams::LYX) {
+                       Paragraph const & par = text().paragraphs()[par_begin];
+                       ostringstream ods;
+                       depth_type dt = par.getDepth();
+                       par.write(ods, params(), dt);
+                       os << from_utf8(ods.str());
+               } else if (runparams.flavor == OutputParams::HTML) {
                        XHTMLStream xs(os);
                        setMathFlavor(runparams);
                        xhtmlParagraphs(text(), *this, xs, runparams);
@@ -3334,6 +3336,10 @@ void Buffer::getSourceCode(odocstream & os, string const format,
                } else if (params().isDocBook()) {
                        docbookParagraphs(text(), *this, os, runparams);
                } else {
+                       TexRow texrow;
+                       texrow.reset();
+                       texrow.newline();
+                       texrow.newline();
                        // latex or literate
                        otexstream ots(os, texrow);
                        latexParagraphs(*this, text(), ots, runparams);
@@ -3347,10 +3353,16 @@ void Buffer::getSourceCode(odocstream & os, string const format,
                else if (output == OnlyBody)
                        os << _("Preview body");
                os << "\n\n";
-               d->texrow.reset();
-               d->texrow.newline();
-               d->texrow.newline();
-               if (runparams.flavor == OutputParams::HTML) {
+               if (runparams.flavor == OutputParams::LYX) {
+                       ostringstream ods;
+                       if (output == FullSource)
+                               write(ods);
+                       else if (output == OnlyPreamble)
+                               params().writeFile(ods);
+                       else if (output == OnlyBody)
+                               text().write(ods);
+                       os << from_utf8(ods.str());
+               }       else if (runparams.flavor == OutputParams::HTML) {
                        writeLyXHTMLSource(os, runparams, output);
                } else if (runparams.flavor == OutputParams::TEXT) {
                        if (output == OnlyPreamble) {
@@ -3361,6 +3373,9 @@ void Buffer::getSourceCode(odocstream & os, string const format,
                                writeDocBookSource(os, absFileName(), runparams, output);
                } else {
                        // latex or literate
+                       d->texrow.reset();
+                       d->texrow.newline();
+                       d->texrow.newline();
                        otexstream ots(os, d->texrow);
                        writeLaTeXSource(ots, string(), runparams, output);
                }