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.
This commit is contained in:
Juergen Spitzmueller 2020-05-30 12:54:20 +02:00
parent 92d248f712
commit 1bf18368cf
4 changed files with 11 additions and 9 deletions

View File

@ -1299,7 +1299,7 @@ def checkOtherEntries():
rc_entry = [ r'\jbibtex_command "automatic"' ], rc_entry = [ r'\jbibtex_command "automatic"' ],
alt_rc_entry = [ r'\jbibtex_alternatives "%%"' ]) alt_rc_entry = [ r'\jbibtex_alternatives "%%"' ])
checkProgAlternatives('available index processors', 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 "%%"' ], rc_entry = [ r'\index_command "%%"' ],
alt_rc_entry = [ r'\index_alternatives "%%"' ]) alt_rc_entry = [ r'\index_alternatives "%%"' ])
checkProg('an index processor appropriate to Japanese', checkProg('an index processor appropriate to Japanese',

View File

@ -481,8 +481,7 @@ Converters::RetVal Converters::convert(Buffer const * buffer,
runparams.bibtex_command = bp.bibtexCommand(); runparams.bibtex_command = bp.bibtexCommand();
runparams.index_command = (bp.index_command == "default") ? runparams.index_command = (bp.index_command == "default") ?
string() : bp.index_command; string() : bp.index_command;
runparams.document_language = bp.language->babel(); runparams.document_language = bp.language->lang();
runparams.xindy_language = bp.language->xindy();
// Some macros rely on font encoding // Some macros rely on font encoding
runparams.main_fontenc = bp.main_font_encoding(); runparams.main_fontenc = bp.main_font_encoding();
runparams.only_childbibs = !bp.useBiblatex() runparams.only_childbibs = !bp.useBiblatex()

View File

@ -23,6 +23,7 @@
#include "LyX.h" #include "LyX.h"
#include "DepTable.h" #include "DepTable.h"
#include "Encoding.h" #include "Encoding.h"
#include "Language.h"
#include "support/debug.h" #include "support/debug.h"
#include "support/convert.h" #include "support/convert.h"
@ -542,12 +543,14 @@ int LaTeX::runMakeIndex(string const & f, OutputParams const & rp,
if (!rp.index_command.empty()) if (!rp.index_command.empty())
tmp = rp.index_command; tmp = rp.index_command;
Language const * doc_lang = languages.getLanguage(rp.document_language);
if (contains(tmp, "$$x")) { if (contains(tmp, "$$x")) {
// This adds appropriate [te]xindy options // This adds appropriate [te]xindy options
// such as language and codepage (for the // such as language and codepage (for the
// main document language/encoding) as well // main document language/encoding) as well
// as input markup (latex or xelatex) // as input markup (latex or xelatex)
string xdyopts = rp.xindy_language; string xdyopts = doc_lang ? doc_lang->xindy() : string();
if (!xdyopts.empty()) if (!xdyopts.empty())
xdyopts = "-L " + xdyopts; xdyopts = "-L " + xdyopts;
if (rp.isFullUnicode() && rp.encoding->package() == Encoding::none) { 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 (" "idx file has been made, running index processor ("
<< tmp << ") on file " << f); << 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) { if (rp.use_indices) {
tmp = lyxrc.splitindex_command + " -m " + quoteName(tmp); tmp = lyxrc.splitindex_command + " -m " + quoteName(tmp);
LYXERR(Debug::LATEX, LYXERR(Debug::LATEX,

View File

@ -129,7 +129,7 @@ public:
*/ */
Font const * local_font; Font const * local_font;
/** Document language babel name /** Document language lyx name
*/ */
std::string document_language; std::string document_language;
@ -200,9 +200,6 @@ public:
*/ */
std::string index_command; std::string index_command;
/// The Xindy language module
std::string xindy_language;
/** Hyperref driver /** Hyperref driver
*/ */
std::string hyperref_driver; std::string hyperref_driver;