From a566db1d51b283c733c142a22fe5da118a63332b Mon Sep 17 00:00:00 2001 From: Martin Vermeer Date: Thu, 7 Oct 2004 15:21:03 +0000 Subject: [PATCH] Implement use of babel language in xindy. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9061 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/ChangeLog | 4 ++++ src/LaTeX.C | 8 +++++--- src/LaTeX.h | 2 +- src/converter.C | 4 +++- src/insets/insetquotes.C | 4 ++-- src/outputparams.h | 6 +++++- src/paragraph.C | 2 +- 7 files changed, 21 insertions(+), 9 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 217a9c917e..5202aa768b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2004-10-07 Martin Vermeer + + * LaTeX.C: implement use of babel language in xindy. + 2004-10-05 José Matos * bufferparams.[Ch] (readBullets, readBulletsLaTeX): new methods. diff --git a/src/LaTeX.C b/src/LaTeX.C index 1ef36e1bfe..d63ce35b99 100644 --- a/src/LaTeX.C +++ b/src/LaTeX.C @@ -44,6 +44,7 @@ using lyx::support::prefixIs; using lyx::support::QuoteName; using lyx::support::rtrim; using lyx::support::split; +using lyx::support::subst; using lyx::support::suffixIs; using lyx::support::Systemcall; using lyx::support::unlink; @@ -274,7 +275,7 @@ int LaTeX::run(TeXErrors & terr) // no checks for now lyxerr[Debug::LATEX] << "Running MakeIndex." << endl; message(_("Running MakeIndex.")); - rerun = runMakeIndex(OnlyFilename(ChangeExtension(file, ".idx"))); + rerun = runMakeIndex(OnlyFilename(ChangeExtension(file, ".idx")), runparams); } // run bibtex @@ -342,7 +343,7 @@ int LaTeX::run(TeXErrors & terr) // no checks for now lyxerr[Debug::LATEX] << "Running MakeIndex." << endl; message(_("Running MakeIndex.")); - rerun = runMakeIndex(OnlyFilename(ChangeExtension(file, ".idx"))); + rerun = runMakeIndex(OnlyFilename(ChangeExtension(file, ".idx")), runparams); } // 2 @@ -393,12 +394,13 @@ int LaTeX::startscript() } -bool LaTeX::runMakeIndex(string const & f) +bool LaTeX::runMakeIndex(string const & f, OutputParams const & runparams) { lyxerr[Debug::LATEX] << "idx file has been made," " running makeindex on file " << f << endl; string tmp = lyxrc.index_command + " "; + tmp = subst(tmp, "$$lang", runparams.document_language); tmp += QuoteName(f); Systemcall one; one.startscript(Systemcall::Wait, tmp); diff --git a/src/LaTeX.h b/src/LaTeX.h index fb2bd7c56b..18e8c19a9e 100644 --- a/src/LaTeX.h +++ b/src/LaTeX.h @@ -155,7 +155,7 @@ private: void deplog(DepTable & head); /// - bool runMakeIndex(std::string const &); + bool runMakeIndex(std::string const &, OutputParams const &); /// std::vector const scanAuxFiles(std::string const &); diff --git a/src/converter.C b/src/converter.C index 40b31e2735..6591c65152 100644 --- a/src/converter.C +++ b/src/converter.C @@ -18,6 +18,7 @@ #include "debug.h" #include "format.h" #include "gettext.h" +#include "language.h" #include "LaTeX.h" #include "frontends/Alert.h" @@ -290,7 +291,6 @@ bool Converters::convert(Buffer const * buffer, } OutputParams runparams; runparams.flavor = getFlavor(edgepath); - string path = OnlyPath(from_file); Path p(path); @@ -531,6 +531,8 @@ bool Converters::runLaTeX(Buffer const & buffer, string const & command, { buffer.busy(true); buffer.message(_("Running LaTeX...")); + + runparams.document_language = buffer.params().language->babel(); // do the LaTeX run(s) string name = buffer.getLatexName(); diff --git a/src/insets/insetquotes.C b/src/insets/insetquotes.C index 3774e4335d..ffbe7286c4 100644 --- a/src/insets/insetquotes.C +++ b/src/insets/insetquotes.C @@ -270,13 +270,13 @@ int InsetQuotes::latex(Buffer const &, ostream & os, string qstr; if (language_ == FrenchQ && times_ == DoubleQ - && runparams.lang == "frenchb") { + && runparams.local_language == "frenchb") { if (side_ == LeftQ) qstr = "\\og "; //the spaces are important here else qstr = " \\fg{}"; //and here } else if (language_ == FrenchQ && times_ == DoubleQ - && runparams.lang == "french") { + && runparams.local_language == "french") { if (side_ == LeftQ) qstr = "<< "; //the spaces are important here else diff --git a/src/outputparams.h b/src/outputparams.h index 7102597b42..d8dd9c6a53 100644 --- a/src/outputparams.h +++ b/src/outputparams.h @@ -58,7 +58,11 @@ struct OutputParams { /** the babel name of the language at the point where the inset is */ - std::string lang; + std::string local_language; + + /** Document language babel name + */ + mutable std::string document_language; /** free_spacing == true means that the inset is in a free-spacing paragraph. diff --git a/src/paragraph.C b/src/paragraph.C index eaeee2efba..83cc81d24a 100644 --- a/src/paragraph.C +++ b/src/paragraph.C @@ -1031,7 +1031,7 @@ bool Paragraph::simpleTeXOnePar(Buffer const & buf, OutputParams rp = runparams; rp.moving_arg = moving_arg; rp.free_spacing = style->free_spacing; - rp.lang = font.language()->babel(); + rp.local_language = font.language()->babel(); rp.intitle = style->intitle; pimpl_->simpleTeXSpecialChars(buf, bparams, os, texrow, rp,