X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FConverter.cpp;h=d8d1dd1ca87a512388f024ad87506127ace1d9ab;hb=bb80bd78f981c888efcc030168bd4e366b0ca6cd;hp=7c71cff525b188dd0ebe882c1975cd1513c1e7ef;hpb=c52bd08442214e4d768ee73886dee68e2b812cd1;p=lyx.git diff --git a/src/Converter.cpp b/src/Converter.cpp index 7c71cff525..d8d1dd1ca8 100644 --- a/src/Converter.cpp +++ b/src/Converter.cpp @@ -326,10 +326,14 @@ bool Converters::convert(Buffer const * buffer, OutputParams runparams(buffer ? &buffer->params().encoding() : 0); runparams.flavor = getFlavor(edgepath); - runparams.use_indices = buffer->params().use_indices; - - if (buffer) + if (buffer) { runparams.use_japanese = buffer->bufferFormat() == "platex"; + runparams.use_indices = buffer->params().use_indices; + runparams.bibtex_command = (buffer->params().bibtex_command == "default") ? + string() : buffer->params().bibtex_command; + runparams.index_command = (buffer->params().index_command == "default") ? + string() : buffer->params().index_command; + } // Some converters (e.g. lilypond) can only output files to the // current directory, so we need to change the current directory. @@ -604,13 +608,13 @@ bool Converters::runLaTeX(Buffer const & buffer, string const & command, buffer.bufferErrors(terr, errorList); // check return value from latex.run(). - if ((result & LaTeX::NO_LOGFILE)) { + if ((result & LaTeX::NO_LOGFILE) && !buffer.isClone()) { docstring const str = bformat(_("LaTeX did not run successfully. " "Additionally, LyX could not locate " "the LaTeX log %1$s."), from_utf8(name)); Alert::error(_("LaTeX failed"), str); - } else if (result & LaTeX::NO_OUTPUT) { + } else if ((result & LaTeX::NO_OUTPUT) && !buffer.isClone()) { Alert::warning(_("Output is empty"), _("An empty output file was generated.")); } @@ -631,13 +635,17 @@ bool Converters::runLaTeX(Buffer const & buffer, string const & command, void Converters::buildGraph() { + // clear graph's data structures G_.init(formats.size()); - ConverterList::iterator beg = converterlist_.begin(); + // each of the converters knows how to convert one format to another + // so, for each of them, we create an arrow on the graph, going from + // the one to the other + ConverterList::iterator it = converterlist_.begin(); ConverterList::iterator const end = converterlist_.end(); - for (ConverterList::iterator it = beg; it != end ; ++it) { - int const s = formats.getNumber(it->from); - int const t = formats.getNumber(it->to); - G_.addEdge(s,t); + for (; it != end ; ++it) { + int const from = formats.getNumber(it->from); + int const to = formats.getNumber(it->to); + G_.addEdge(from, to); } } @@ -707,6 +715,20 @@ vector Converters::importableFormats() } +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 r = + getReachable(*it, only_viewable, false); + result.insert(result.end(), r.begin(), r.end()); + } + return result; +} + + vector Converters::loaders() const { vector v; @@ -717,4 +739,20 @@ vector Converters::loaders() const } +vector Converters::savers() const +{ + vector v; + v.push_back("docbook"); + v.push_back("latex"); + v.push_back("literate"); + v.push_back("lyx"); + v.push_back("xhtml"); + v.push_back("pdflatex"); + v.push_back("platex"); + v.push_back("text"); + v.push_back("xetex"); + return v; +} + + } // namespace lyx