]> git.lyx.org Git - lyx.git/blobdiff - src/Buffer.cpp
The logic of the endParagraph() routine is wrong. We should first
[lyx.git] / src / Buffer.cpp
index 766cbfe29193f512ed659c8169b360fa028753a1..aebe0c96cbe72760fbe127c206d236ddbeb1ce29 100644 (file)
@@ -789,6 +789,7 @@ int Buffer::readHeader(Lexer & lex)
        params().html_latex_end.clear();
        params().html_math_img_scale = 1.0;
        params().output_sync_macro.erase();
+       params().local_layout.clear();
 
        for (int i = 0; i < 4; ++i) {
                params().user_defined_bullet(i) = ITEMIZE_DEFAULTS[i];
@@ -1002,7 +1003,7 @@ Buffer::ReadStatus Buffer::readFile(FileName const & fn)
 
        d->file_fully_loaded = true;
        d->read_only = !d->filename.isWritable();
-       params().compressed = d->filename.isZippedFile();
+       params().compressed = formats.isZippedFile(d->filename);
        saveCheckSum();
        return ReadSuccess;
 }
@@ -1508,9 +1509,8 @@ void Buffer::writeLaTeXSource(otexstream & os,
                        Encoding const * const enc = runparams.encoding;
                        if (enc) {
                                for (size_t n = 0; n < inputpath.size(); ++n) {
-                                       docstring const glyph =
-                                               docstring(1, inputpath[n]);
-                                       if (enc->latexChar(inputpath[n], true) != glyph) {
+                                       if (!enc->encodable(inputpath[n])) {
+                                               docstring const glyph(1, inputpath[n]);
                                                LYXERR0("Uncodable character '"
                                                        << glyph
                                                        << "' in input path!");
@@ -3309,6 +3309,12 @@ void Buffer::getSourceCode(odocstream & os, string const format,
                        XHTMLStream xs(os);
                        setMathFlavor(runparams);
                        xhtmlParagraphs(text(), *this, xs, runparams);
+               } else if (runparams.flavor == OutputParams::TEXT) {
+                       bool dummy;
+                       // FIXME Handles only one paragraph, unlike the others.
+                       // Probably should have some routine with a signature like them.
+                       writePlaintextParagraph(*this,
+                               text().paragraphs()[par_begin], os, runparams, dummy);
                } else {
                        // latex or literate
                        otexstream ots(os, texrow);
@@ -3731,13 +3737,11 @@ Buffer::ExportStatus Buffer::doExport(string const & target, bool put_in_tempdir
        // LaTeX backend
        else if (backend_format == format) {
                runparams.nice = true;
-               if (!makeLaTeXFile(FileName(filename), string(), runparams)) {
-                       if (d->cloned_buffer_) {
-                               d->cloned_buffer_->d->errorLists["Export"] =
-                                       d->errorLists["Export"];
-                       }
+               bool const success = makeLaTeXFile(FileName(filename), string(), runparams);
+               if (d->cloned_buffer_)
+                       d->cloned_buffer_->d->errorLists["Export"] = d->errorLists["Export"];
+               if (!success)
                        return ExportError;
-               }
        } else if (!lyxrc.tex_allows_spaces
                   && contains(filePath(), ' ')) {
                Alert::error(_("File name error"),
@@ -3745,13 +3749,11 @@ Buffer::ExportStatus Buffer::doExport(string const & target, bool put_in_tempdir
                return ExportTexPathHasSpaces;
        } else {
                runparams.nice = false;
-               if (!makeLaTeXFile(FileName(filename), filePath(), runparams)) {
-                       if (d->cloned_buffer_) {
-                               d->cloned_buffer_->d->errorLists["Export"] =
-                                       d->errorLists["Export"];
-                       }
+               bool const success = makeLaTeXFile(FileName(filename), string(), runparams);
+               if (d->cloned_buffer_)
+                       d->cloned_buffer_->d->errorLists["Export"] = d->errorLists["Export"];
+               if (!success)
                        return ExportError;
-               }
        }
 
        string const error_type = (format == "program")