]> git.lyx.org Git - features.git/commitdiff
Fix bug 3240
authorGeorg Baum <Georg.Baum@post.rwth-aachen.de>
Thu, 15 Feb 2007 21:22:40 +0000 (21:22 +0000)
committerGeorg Baum <Georg.Baum@post.rwth-aachen.de>
Thu, 15 Feb 2007 21:22:40 +0000 (21:22 +0000)
* src/insets/ExternalSupport.C
(updateExternal): Add new dryrun flag and only record updated files
for the exporter if that flag is false
(writeExternal): Call updateExternal also if dryrun is true and the
product contains the $$Contents placeholder. In this case we need to
run the conversion(s) even in dryrun mode, because we would not
output the right stuff to the .tex file otherwise.

* src/insets/ExternalSupport.[Ch]
(writeExternal): rename external_in_comment flag to dryrun

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17204 a592a061-630c-0410-9148-cb99ea01b6c8

src/insets/ExternalSupport.C
src/insets/ExternalSupport.h

index 133eec4138458c0f764f99af6efecbd82dc45ee8..3b7d722ed4e2ab072334bd1a15ab17fffb866683 100644 (file)
@@ -197,7 +197,8 @@ void updateExternal(InsetExternalParams const & params,
                    string const & format,
                    Buffer const & buffer,
                    ExportData & exportdata,
-                   bool external_in_tmpdir)
+                    bool external_in_tmpdir,
+                    bool dryrun)
 {
        Template const * const et_ptr = getTemplatePtr(params);
        if (!et_ptr)
@@ -274,33 +275,35 @@ void updateExternal(InsetExternalParams const & params,
        FileName const abs_to_file(
                support::makeAbsPath(to_file, m_buffer->temppath()));
 
-       // Record the referenced files for the exporter.
-       // The exporter will copy them to the export dir.
-       typedef Template::Format::FileMap FileMap;
-       FileMap::const_iterator rit  = outputFormat.referencedFiles.begin();
-       FileMap::const_iterator rend = outputFormat.referencedFiles.end();
-       for (; rit != rend; ++rit) {
-               vector<string>::const_iterator fit  = rit->second.begin();
-               vector<string>::const_iterator fend = rit->second.end();
-               for (; fit != fend; ++fit) {
-                       FileName const source(support::makeAbsPath(
-                                       doSubstitution(params, buffer, *fit,
-                                                      false, true),
-                                       m_buffer->temppath()));
-                       // The path of the referenced file is never the
-                       // temp path, but the filename may be the mangled
-                       // or the real name. Therefore we substitute the
-                       // paths and names separately.
-                       string file = support::subst(*fit, "$$FName",
-                                       "$$FPath$$Basename$$Extension");
-                       file = doSubstitution(params, buffer, file, false, false,
-                                             PATHS);
-                       file = doSubstitution(params, buffer, file,
-                                             false, external_in_tmpdir,
-                                             ALL_BUT_PATHS);
-                       // if file is a relative name, it is interpreted
-                       // relative to the master document.
-                       exportdata.addExternalFile(rit->first, source, file);
+       if (!dryrun) {
+               // Record the referenced files for the exporter.
+               // The exporter will copy them to the export dir.
+               typedef Template::Format::FileMap FileMap;
+               FileMap::const_iterator rit  = outputFormat.referencedFiles.begin();
+               FileMap::const_iterator rend = outputFormat.referencedFiles.end();
+               for (; rit != rend; ++rit) {
+                       vector<string>::const_iterator fit  = rit->second.begin();
+                       vector<string>::const_iterator fend = rit->second.end();
+                       for (; fit != fend; ++fit) {
+                               FileName const source(support::makeAbsPath(
+                                               doSubstitution(params, buffer, *fit,
+                                                              false, true),
+                                               m_buffer->temppath()));
+                               // The path of the referenced file is never the
+                               // temp path, but the filename may be the mangled
+                               // or the real name. Therefore we substitute the
+                               // paths and names separately.
+                               string file = support::subst(*fit, "$$FName",
+                                               "$$FPath$$Basename$$Extension");
+                               file = doSubstitution(params, buffer, file, false, false,
+                                                     PATHS);
+                               file = doSubstitution(params, buffer, file,
+                                                     false, external_in_tmpdir,
+                                                     ALL_BUT_PATHS);
+                               // if file is a relative name, it is interpreted
+                               // relative to the master document.
+                               exportdata.addExternalFile(rit->first, source, file);
+                       }
                }
        }
 
@@ -333,7 +336,7 @@ int writeExternal(InsetExternalParams const & params,
                  Buffer const & buffer, odocstream & os,
                  ExportData & exportdata,
                  bool external_in_tmpdir,
-                 bool external_in_comment)
+                 bool dryrun)
 {
        Template const * const et_ptr = getTemplatePtr(params);
        if (!et_ptr)
@@ -349,9 +352,9 @@ int writeExternal(InsetExternalParams const & params,
                return 0;
        }
 
-       if (!external_in_comment)
+       if (!dryrun || support::contains(cit->second.product, "$$Contents"))
                updateExternal(params, format, buffer, exportdata,
-                              external_in_tmpdir);
+                              external_in_tmpdir, dryrun);
 
        bool const use_latex_path = format == "LaTeX";
        string str = doSubstitution(params, buffer, cit->second.product,
index b28e42304e275e0f3d742c589a50072d0037aced..9c282e8418c291af01fb9fc1515d9b54223cf20d 100644 (file)
@@ -66,7 +66,7 @@ int writeExternal(InsetExternalParams const &,
                  odocstream &,
                  ExportData &,
                  bool external_in_tmpdir,
-                 bool external_in_comment);
+                 bool dryrun);
 
 } // namespace external
 } // namespace lyx