+2005-07-08 Georg Baum <Georg.Baum@post.rwth-aachen.de>
+
+ * ExternalSupport.C (subst_path): new argument exclude_extension
+ * ExternalSupport.C (doSubstitution): exclude the extension when
+ quoting $$FName
+ * insetgraphics.C (stripExtensionIfPossible, prepareFile): exclude
+ the extension when quoting the file name
+
2005-06-16 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* insetquotes.C (latex): always use \og/\fg for the french
string const subst_path(string const & input,
string const & placeholder,
string const & path,
- bool use_latex_path)
+ bool use_latex_path,
+ bool exclude_extension = false)
{
if (input.find(placeholder) == string::npos)
return input;
string const path2 = use_latex_path ?
- support::latex_path(path) : support::os::external_path(path);
+ support::latex_path(path, exclude_extension, use_lyxdot) :
+ support::os::external_path(path);
return support::subst(input, placeholder, path2);
}
if (what == PATHS)
return result;
- result = subst_path(result, "$$FName", filename, use_latex_path);
+ result = subst_path(result, "$$FName", filename, use_latex_path, true);
result = subst_path(result, "$$Basename", basename, use_latex_path);
result = subst_path(result, "$$Extension",
'.' + support::GetExtension(filename), use_latex_path);
// dots with a macro whose definition is just a dot ;-)
// The automatic format selection does not work if the file
// name is escaped.
- string const latex_name = latex_path(file);
+ string const latex_name = latex_path(file, true);
if (contains(latex_name, '"'))
return latex_name;
return subst(latex_path(RemoveExtension(file)), ".", "\\lyxdot ");
(to_format == "eps" && file_format == "ps") ||
(to_format == "ps" && file_format == "eps"))
return stripExtensionIfPossible(file);
- return latex_path(file);
+ return latex_path(file, true);
}
} // namespace anon
source_file, output_file);
// We can't strip the extension, because we don't know
// the unzipped file format
- return latex_path(output_file);
+ return latex_path(output_file, true);
}
string const unzipped_temp_file = unzippedFileName(temp_file);
return;
features.includeFile(graphic_label,
- RemoveExtension(params().filename.absFilename()));
+ RemoveExtension(params().filename.absFilename()));
features.require("graphicx");
+2005-07-08 Georg Baum <Georg.Baum@post.rwth-aachen.de>
+
+ * filetools.[Ch] (latex_path): add exclude_extension argument
+
2005-07-05 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* lyxtime.[Ch]: two new functions formatted_time, which return
}
-string const latex_path(string const & original_path)
+string const latex_path(string const & original_path, bool exclude_extension)
{
string path = subst(original_path, "\\", "/");
path = subst(path, "~", "\\string~");
if (path.find(' ') != string::npos)
// We can't use '"' because " is sometimes active (e.g. if
// babel is loaded with the "german" option)
- path = "\\string\"" + path + "\\string\"";
+ if (exclude_extension) {
+ string const base = ChangeExtension(path, string());
+ string const ext = GetExtension(path);
+ // ChangeExtension calls os::internal_path internally
+ // so don't use it to re-add the extension.
+ path = "\\string\"" + base + "\\string\"." + ext;
+ } else
+ path = "\\string\"" + path + "\\string\"";
return path;
}
bool IsSGMLFilename(std::string const & filename);
/** Returns the path of a library data file.
- Search the file name.ext in the subdirectory dir of
- \begin{enumerate}
- \item user_lyxdir
- \item build_lyxdir (if not empty)
- \item system_lyxdir
- \end{enumerate}
+ Search the file name.ext in the subdirectory dir of
+ -# user_lyxdir
+ -# build_lyxdir (if not empty)
+ -# system_lyxdir
The third parameter `ext' is optional.
*/
std::string const LibFileSearch(std::string const & dir, std::string const & name,
* Manipulates @c path into a form suitable for inclusion in a LaTeX
* document.
* If @c path contains LaTeX special characters, these are escaped.
- * Eg, '~' -> '\string~'
+ * Eg, '~' -> '\\string~'
* If @c path contains spaces, then the returned path is enclosed in
* "-quotes. This last fix will lead to successful compiliation of the
* LaTeX file only if a sufficiently modern LaTeX compiler is used.
+ * If @c exclude_extension is true the extension is left outside the quotes.
+ * This is needed for pdfeTeX, Version 3.141592-1.21a-2.2 (Web2C 7.5.4)
+ * (format=pdflatex 2005.4.11) in combination with
+ * pdftex.def 2002/06/19 v0.03k graphics/color for pdftex:
+ * It does not recognize the file extension if it is inside the quotes.
*/
-std::string const latex_path(std::string const & path);
+std::string const latex_path(std::string const & path,
+ bool exclude_extension = false)
/// Substitutes active latex characters with underscores in filename
std::string const MakeLatexName(std::string const & file);