X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FConverter.cpp;h=f208b7415f90fad9b8508c343596b6ac1d2d7a1a;hb=13739f37d5208e87e97c44ef2eeba35807ddb9c5;hp=4128129fc76bcab9f7008bd0487dd4a6bb040887;hpb=9ebd4405cf162a528aaa9d7357a574a2f22c4f5d;p=lyx.git diff --git a/src/Converter.cpp b/src/Converter.cpp index 4128129fc7..f208b7415f 100644 --- a/src/Converter.cpp +++ b/src/Converter.cpp @@ -108,9 +108,11 @@ void Converter::readFlags() string flag_name, flag_value; flag_list = split(flag_list, flag_value, ','); flag_value = split(flag_value, flag_name, '='); - if (flag_name == "latex") + if (flag_name == "latex") { latex = true; - else if (flag_name == "xml") + latex_flavor = flag_value.empty() ? + "latex" : flag_value; + } else if (flag_name == "xml") xml = true; else if (flag_name == "needaux") need_aux = true; @@ -186,11 +188,12 @@ void Converters::add(string const & from, string const & to, } converter.readFlags(); - if (converter.latex && (latex_command_.empty() || to == "dvi")) - latex_command_ = subst(command, token_from, ""); // If we have both latex & pdflatex, we set latex_command to latex. // The latex_command is used to update the .aux file when running // a converter that uses it. + if (converter.latex + && (latex_command_.empty() || converter.latex_flavor == "latex")) + latex_command_ = subst(command, token_from, ""); if (it == converterlist_.end()) { converterlist_.push_back(converter); @@ -255,9 +258,11 @@ OutputParams::FLAVOR Converters::getFlavor(Graph::EdgePath const & path) cit != path.end(); ++cit) { Converter const & conv = converterlist_[*cit]; if (conv.latex) - if (contains(conv.from, "xetex")) + if (conv.latex_flavor == "xelatex") return OutputParams::XETEX; - if (contains(conv.to, "pdf")) + if (conv.latex_flavor == "lualatex") + return OutputParams::LUATEX; + if (conv.latex_flavor == "pdflatex") return OutputParams::PDFLATEX; if (conv.xml) return OutputParams::XML; @@ -407,8 +412,8 @@ bool Converters::convert(Buffer const * buffer, command = subst(command, token_from, quoteName(infile2)); command = subst(command, token_base, quoteName(from_base)); command = subst(command, token_to, quoteName(outfile2)); - command = subst(command, token_path, quoteName(infile.onlyPath().absFileName())); - command = subst(command, token_orig_path, quoteName(orig_from.onlyPath().absFileName())); + command = subst(command, token_path, quoteName(onlyPath(infile.absFileName()))); + command = subst(command, token_orig_path, quoteName(onlyPath(orig_from.absFileName()))); command = subst(command, token_encoding, buffer ? buffer->params().encoding().iconvName() : string()); command = libScriptSearch(command); @@ -470,8 +475,8 @@ bool Converters::convert(Buffer const * buffer, // FIXME: this should go out of here. For example, here we cannot say if // it is a document (.lyx) or something else. Same goes for elsewhere. Alert::error(_("Cannot convert file"), - bformat(_("An error occurred whilst running %1$s"), - from_utf8(command.substr(0, 50)))); + bformat(_("An error occurred while running:\n%1$s"), + wrapParas(from_utf8(command)))); } return false; } @@ -708,8 +713,9 @@ vector Converters::importableFormats() { vector l = loaders(); vector result = getReachableTo(l[0], true); - for (vector::const_iterator it = l.begin() + 1; - it != l.end(); ++it) { + vector::const_iterator it = l.begin() + 1; + vector::const_iterator en = l.end(); + for (; it != en; ++it) { vector r = getReachableTo(*it, false); result.insert(result.end(), r.begin(), r.end()); } @@ -721,8 +727,9 @@ vector Converters::exportableFormats(bool only_viewable) { vector s = savers(); vector result = getReachable(s[0], only_viewable, true); - for (vector::const_iterator it = s.begin() + 1; - it != s.end(); ++it) { + vector::const_iterator it = s.begin() + 1; + vector::const_iterator en = s.end(); + for (; it != en; ++it) { vector r = getReachable(*it, only_viewable, false); result.insert(result.end(), r.begin(), r.end()); @@ -747,6 +754,7 @@ vector Converters::savers() const v.push_back("docbook"); v.push_back("latex"); v.push_back("literate"); + v.push_back("luatex"); v.push_back("lyx"); v.push_back("xhtml"); v.push_back("pdflatex");