From 1bf18368cfcbb9d2c371a3f2f53a58cc037d5585 Mon Sep 17 00:00:00 2001 From: Juergen Spitzmueller Date: Sat, 30 May 2020 12:54:20 +0200 Subject: [PATCH] Add support for the xindex index processor This is a modern alternative for makeindex that is fully unicode-aware and written in lua. As opposed to xindy, it is more lightweight and actively maintained. The program is still in a rather early stage of development, so we do not propose this as default. This relies on xindex 0.22 (about to be released) to function properly. --- lib/configure.py | 2 +- src/Converter.cpp | 3 +-- src/LaTeX.cpp | 10 ++++++++-- src/OutputParams.h | 5 +---- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/lib/configure.py b/lib/configure.py index 445e68d3ac..bd8d435949 100644 --- a/lib/configure.py +++ b/lib/configure.py @@ -1299,7 +1299,7 @@ def checkOtherEntries(): rc_entry = [ r'\jbibtex_command "automatic"' ], alt_rc_entry = [ r'\jbibtex_alternatives "%%"' ]) checkProgAlternatives('available index processors', - ['texindy $$x -t $$b.ilg', 'makeindex -c -q', 'xindy -M texindy $$x -t $$b.ilg'], + ['texindy $$x -t $$b.ilg', 'xindex -l $$lcode', 'makeindex -c -q', 'xindy -M texindy $$x -t $$b.ilg'], rc_entry = [ r'\index_command "%%"' ], alt_rc_entry = [ r'\index_alternatives "%%"' ]) checkProg('an index processor appropriate to Japanese', diff --git a/src/Converter.cpp b/src/Converter.cpp index 0c541c894b..3487f4b45e 100644 --- a/src/Converter.cpp +++ b/src/Converter.cpp @@ -481,8 +481,7 @@ Converters::RetVal Converters::convert(Buffer const * buffer, runparams.bibtex_command = bp.bibtexCommand(); runparams.index_command = (bp.index_command == "default") ? string() : bp.index_command; - runparams.document_language = bp.language->babel(); - runparams.xindy_language = bp.language->xindy(); + runparams.document_language = bp.language->lang(); // Some macros rely on font encoding runparams.main_fontenc = bp.main_font_encoding(); runparams.only_childbibs = !bp.useBiblatex() diff --git a/src/LaTeX.cpp b/src/LaTeX.cpp index 81f8a39b3a..f5b6d20d30 100644 --- a/src/LaTeX.cpp +++ b/src/LaTeX.cpp @@ -23,6 +23,7 @@ #include "LyX.h" #include "DepTable.h" #include "Encoding.h" +#include "Language.h" #include "support/debug.h" #include "support/convert.h" @@ -541,13 +542,15 @@ int LaTeX::runMakeIndex(string const & f, OutputParams const & rp, if (!rp.index_command.empty()) tmp = rp.index_command; + + Language const * doc_lang = languages.getLanguage(rp.document_language); if (contains(tmp, "$$x")) { // This adds appropriate [te]xindy options // such as language and codepage (for the // main document language/encoding) as well // as input markup (latex or xelatex) - string xdyopts = rp.xindy_language; + string xdyopts = doc_lang ? doc_lang->xindy() : string(); if (!xdyopts.empty()) xdyopts = "-L " + xdyopts; if (rp.isFullUnicode() && rp.encoding->package() == Encoding::none) { @@ -580,7 +583,10 @@ int LaTeX::runMakeIndex(string const & f, OutputParams const & rp, "idx file has been made, running index processor (" << tmp << ") on file " << f); - tmp = subst(tmp, "$$lang", rp.document_language); + if (doc_lang) { + tmp = subst(tmp, "$$lang", doc_lang->babel()); + tmp = subst(tmp, "$$lcode", doc_lang->code()); + } if (rp.use_indices) { tmp = lyxrc.splitindex_command + " -m " + quoteName(tmp); LYXERR(Debug::LATEX, diff --git a/src/OutputParams.h b/src/OutputParams.h index 5aa6080de7..59d7221ff9 100644 --- a/src/OutputParams.h +++ b/src/OutputParams.h @@ -129,7 +129,7 @@ public: */ Font const * local_font; - /** Document language babel name + /** Document language lyx name */ std::string document_language; @@ -200,9 +200,6 @@ public: */ std::string index_command; - /// The Xindy language module - std::string xindy_language; - /** Hyperref driver */ std::string hyperref_driver;