namespace {
-int const LYX_FORMAT = 283;
+int const LYX_FORMAT = 285;
} // namespace anon
"\\lyxadded and \\lyxdeleted in the LaTeX preamble."));
}
}
+ // read manifest after header
+ embeddedFiles().readManifest(lex, errorList);
+ // read main text
bool const res = text().read(*this, lex, errorList);
for_each(text().paragraphs().begin(),
text().paragraphs().end(),
LYXERR(Debug::FILES) << filename << " is in zip format. Unzip to " << temppath() << endl;
::unzipToDir(filename.toFilesystemEncoding(), temppath());
//
- FileName manifest(addName(temppath(), "manifest.txt"));
- FileName lyxfile(addName(temppath(),
- onlyFilename(filename.toFilesystemEncoding())));
+ FileName lyxfile(addName(temppath(), "content.lyx"));
// if both manifest.txt and file.lyx exist, this is am embedded file
- if (fs::exists(manifest.toFilesystemEncoding()) &&
- fs::exists(lyxfile.toFilesystemEncoding())) {
+ if (fs::exists(lyxfile.toFilesystemEncoding())) {
params().embedded = true;
fname = lyxfile;
- // read manifest file
- ifstream is(manifest.toFilesystemEncoding().c_str());
- is >> pimpl_->embedded_files;
- is.close();
- LYXERR(Debug::FILES) << filename << " is a embedded file. Its manifest is:\n"
- << pimpl_->embedded_files;
}
}
// The embedded lyx file can also be compressed, for backward compatibility
FileName content;
if (params().embedded)
// first write the .lyx file to the temporary directory
- content = FileName(addName(temppath(),
- onlyFilename(fname.toFilesystemEncoding())));
+ content = FileName(addName(temppath(), "content.lyx"));
else
content = fname;
if (retval && params().embedded) {
// write file.lyx and all the embedded files to the zip file fname
- // if embedding is enabled, and there is any embedded file
- pimpl_->embedded_files.update();
- return pimpl_->embedded_files.write(fname);
+ // if embedding is enabled
+ return pimpl_->embedded_files.writeFile(fname);
}
return retval;
}
params().writeFile(ofs);
ofs << "\\end_header\n";
+ // write the manifest after header
+ ofs << "\n\\begin_manifest\n";
+ pimpl_->embedded_files.update();
+ embeddedFiles().writeManifest(ofs);
+ ofs << "\\end_manifest\n";
+
// write the text
ofs << "\n\\begin_body\n";
text().write(*this, ofs);
if (!params().parentname.empty()
&& theBufferList().exists(params().parentname)) {
Buffer * buf = theBufferList().getBuffer(params().parentname);
- if (buf)
+ //We need to check if the parent is us...
+ //FIXME RECURSIVE INCLUDE
+ //This is not sufficient, since recursive includes could be downstream.
+ if (buf && buf != this)
return buf->getMasterBuffer();
}