#include "Buffer.h"
#include "Converter.h"
#include "debug.h"
+#include "gettext.h"
+#include "ErrorList.h"
#include "Exporter.h"
#include "Format.h"
#include "Mover.h"
+#include "frontends/alert.h"
+
#include "support/filetools.h"
#include "support/Forkedcall.h"
#include "support/lstrings.h"
#include <boost/filesystem/operations.hpp>
+#include <algorithm>
+
using std::endl;
using std::string;
using std::vector;
namespace lyx {
using support::FileName;
+using support::isValidLaTeXFilename;
namespace external {
// FIXME UNICODE
string relToMasterPath = support::onlyPath(
to_utf8(support::makeRelPath(from_utf8(absname),
- from_utf8(masterpath))));
+ from_utf8(masterpath))));
if (relToMasterPath == "./")
relToMasterPath.clear();
// FIXME UNICODE
string relToParentPath = support::onlyPath(
to_utf8(support::makeRelPath(from_utf8(absname),
- from_utf8(parentpath))));
+ from_utf8(parentpath))));
if (relToParentPath == "./")
relToParentPath.clear();
string::size_type const send = s.find("\")", spos);
string const file_template = s.substr(spos + 12, send - (spos + 12));
string const file = doSubstitution(params, buffer,
- file_template, false,
- external_in_tmpdir, what);
+ file_template, false,
+ external_in_tmpdir, what);
string contents;
FileName const absfile(
string const & format,
Buffer const & buffer,
ExportData & exportdata,
- bool external_in_tmpdir,
- bool dryrun)
+ bool external_in_tmpdir,
+ bool dryrun)
{
Template const * const et_ptr = getTemplatePtr(params);
if (!et_ptr)
ErrorList el;
bool const success =
theConverters().convert(&buffer, temp_file, abs_to_file,
- params.filename, from_format, to_format, el,
- Converters::try_default | Converters::try_cache);
+ params.filename, from_format, to_format, el,
+ Converters::try_default | Converters::try_cache);
- if (!success)
+ if (!success) {
LYXERR(Debug::EXTERNAL)
<< "external::updateExternal. "
<< "Unable to convert from "
<< from_format << " to " << to_format << endl;
+ }
// return success
}
if (!dryrun || support::contains(cit->second.product, "$$Contents"))
updateExternal(params, format, buffer, exportdata,
- external_in_tmpdir, dryrun);
+ external_in_tmpdir, dryrun);
bool const use_latex_path = format == "LaTeX";
string str = doSubstitution(params, buffer, cit->second.product,
use_latex_path, external_in_tmpdir);
+
+ string const absname = support::makeAbsPath(
+ params.filename.outputFilename(buffer.filePath()), buffer.filePath()).absFilename();
+
+ if (!external_in_tmpdir && !isValidLaTeXFilename(absname)) {
+ lyx::frontend::Alert::warning(_("Invalid filename"),
+ _("The following filename is likely to cause trouble "
+ "when running the exported file through LaTeX: ") +
+ from_utf8(absname));
+ }
+
str = substituteCommands(params, str, format);
str = substituteOptions(params, str, format);
// FIXME UNICODE
os << from_utf8(str);
- return int(lyx::count(str.begin(), str.end(),'\n'));
+ return int(std::count(str.begin(), str.end(),'\n'));
}
namespace {