]> git.lyx.org Git - features.git/commitdiff
Remove the manifest section of the .lyx file
authorBo Peng <bpeng@lyx.org>
Sun, 21 Oct 2007 18:06:00 +0000 (18:06 +0000)
committerBo Peng <bpeng@lyx.org>
Sun, 21 Oct 2007 18:06:00 +0000 (18:06 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21104 a592a061-630c-0410-9148-cb99ea01b6c8

development/FORMAT
lib/lyx2lyx/LyX.py
lib/lyx2lyx/lyx_1_6.py
src/Buffer.cpp
src/EmbeddedFiles.cpp
src/EmbeddedFiles.h

index 24d03c2fbbc94688e4542bb3dafa3b42b7ba0367..118d8c6657052735ffd96b93b93407e070336f33 100644 (file)
@@ -39,7 +39,6 @@ LyX file-format changes
 
 2007-09-11 Bo Peng <ben.bob@gmail.com>
        * Format incremented to 285: Tweaks to embedded file format.
-         Add manifest to .lyx file. 
          Remove inzip parameter from graphics insets.
 
 2007-09-09 Helge Hafting <helge.hafting@aitel.hist.no>
index d81f16fad10231c73c720458fad525f113a427af..57012dc3f802823c104b9b0df2f42c86b5bf2e9d 100644 (file)
@@ -178,7 +178,6 @@ class LyX_base:
         self.default_layout = ''
         self.header = []
         self.preamble = []
-        self.manifest = []
         self.body = []
         self.status = 0
         self.encoding = encoding
@@ -203,7 +202,7 @@ class LyX_base:
 
 
     def read(self):
-        """Reads a file into the self.header, self.manifest and
+        """Reads a file into the self.header and
         self.body parts, from self.input."""
 
         while True:
@@ -235,27 +234,6 @@ class LyX_base:
             if check_token(line, '\\end_preamble'):
                 continue
 
-            if check_token(line, '\\begin_manifest'):
-                while 1:
-                    line = self.input.readline()
-                    if not line:
-                        self.error("Invalid LyX file.")
-
-                    line = trim_eol(line)
-                    if check_token(line, "\\end_manifest"):
-                        break
-
-                    if not line.startswith('\\filename') and \
-                       not line.startswith('\\inzipName') and \
-                       not line.startswith('\\embed'):
-                        self.warning("Malformed LyX file: Missing"
-                                     "'\\end_manifest'.")
-
-                    self.manifest.append(line)
-            
-            if check_token(line, '\\end_manifest'):
-                continue
-
             line = line.strip()
             if not line:
                 continue
@@ -311,14 +289,7 @@ class LyX_base:
         else:
             header = self.header
 
-        # LyX file format <= 284 does not have a manifest section
-        # so this section is set to None
-        if self.manifest is None:
-            manifest = []
-        else:
-            manifest = ['\\begin_manifest'] + self.manifest + ['\\end_manifest', '']
-
-        for line in header + [''] + manifest + self.body:
+        for line in header + [''] + self.body:
             self.output.write(line.encode(self.encoding)+"\n")
 
 
index 7bd38a2e6bdc38a4ae64377b042e744757f4b93d..31d5cb28ca429793c328af284c903f46e62aee10 100644 (file)
@@ -174,11 +174,6 @@ def revert_flex(document):
         document.body[i] = document.body[i].replace('\\begin_inset Flex', '\\begin_inset CharStyle')
 
 
-def remove_manifest(document):
-    "Remove the manifest section"
-    document.manifest = None
-
-
 #  Discard PDF options for hyperref
 def revert_pdf_options(document):
         "Revert PDF options for hyperref."
@@ -600,7 +595,7 @@ convert = [[277, [fix_wrong_tables]],
            [282, []],
            [283, [convert_flex]],
            [284, []],
-           [285, []], # an empty manifest is automatically added
+           [285, []],
            [286, []],
            [287, [convert_wrapfig_options]],
            [288, [convert_inset_command]],
@@ -623,7 +618,7 @@ revert =  [[294, [revert_href]],
            [287, [revert_inset_command]],
            [286, [revert_wrapfig_options]],
            [285, [revert_pdf_options]],
-           [284, [remove_manifest, remove_inzip_options]],
+           [284, [remove_inzip_options]],
            [283, []],
            [282, [revert_flex]],
            [281, []],
index e50a9745096ba590bb90211c2da9624eb51add46..c7ed0a0c4b12d3a9d1ef99067214e0d164332feb 100644 (file)
@@ -570,8 +570,6 @@ bool Buffer::readDocument(Lexer & lex)
                                         "\\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);
@@ -962,12 +960,6 @@ bool Buffer::write(ostream & ofs) const
        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);
index 590ecddf8325d2f29d65ddbdb8b67cab14c8d370..4255a3023e7abc3573ffc7600a9bfd5e98c0244e 100644 (file)
@@ -410,78 +410,6 @@ string const EmbeddedFiles::getInzipName(string const & abs_filename, string con
 }
 
 
-bool EmbeddedFiles::readManifest(Lexer & lex, ErrorList & errorList)
-{
-       int line = -1;
-       int begin_manifest_line = -1;
-
-       file_list_.clear();
-       string filename;
-       string inzipName;
-       bool embedded = false;
-
-       while (lex.isOK()) {
-               lex.next();
-               string const token = lex.getString();
-
-               if (token.empty())
-                       continue;
-
-               if (token == "\\end_manifest")
-                       break;
-
-               ++line;
-               if (token == "\\begin_manifest") {
-                       begin_manifest_line = line;
-                       continue;
-               }
-               
-               LYXERR(Debug::PARSER) << "Handling document manifest token: `"
-                                     << token << '\'' << endl;
-
-               if (token == "\\filename")
-                       lex >> filename;
-               else if (token == "\\inzipName")
-                       lex >> inzipName;
-               else if (token == "\\embed") {
-                       lex >> embedded;
-                       registerFile(filename, embedded, NULL, inzipName);
-                       filename = "";
-                       inzipName = "";
-               } else {
-                       docstring const s = _("\\begin_file is missing");
-                       errorList.push_back(ErrorItem(_("Manifest error"),
-                               s, -1, 0, 0));
-               }
-       }
-       if (begin_manifest_line) {
-               docstring const s = _("\\begin_manifest is missing");
-               errorList.push_back(ErrorItem(_("Manifest error"),
-                       s, -1, 0, 0));
-       }
-       return true;
-}
-
-
-void EmbeddedFiles::writeManifest(ostream & os) const
-{
-       EmbeddedFiles::EmbeddedFileList::const_iterator it = begin();
-       EmbeddedFiles::EmbeddedFileList::const_iterator it_end = end();
-       for (; it != it_end; ++it) {
-               // only saved 'extra' files. Other embedded files are saved
-               // with insets.
-               if (!it->valid() || it->refCount() > 0)
-                       continue;
-               // save the relative path
-               os << "\\filename "
-                       << to_utf8(makeRelPath(from_utf8(it->absFilename()),
-                               from_utf8(buffer_->filePath()))) << '\n'
-                       << "\\inzipName " << it->inzipName() << '\n'
-                       << "\\embed " << (it->embedded() ? "true" : "false") << '\n';
-       }
-}
-
-
 void EmbeddedFiles::updateInsets() const
 {
        EmbeddedFiles::EmbeddedFileList::const_iterator it = begin();
index 1d526973d3cbafd6abc1179aea28e4fc71fa48e6..76629b7be2937901836dbb537f1ac78ff4353892 100644 (file)
@@ -227,8 +227,6 @@ public:
        /// update all files from external, used when enable embedding
        bool updateFromExternalFile() const;
        ///
-       bool readManifest(Lexer & lex, ErrorList & errorList);
-       void writeManifest(std::ostream & os) const;
        /// update all insets to use embedded files when embedding status is changed
        void updateInsets() const;
 private: