From 498135ef383a6e755a3e69328f0f2d16513aed2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Spitzm=C3=BCller?= Date: Tue, 10 Sep 2024 13:58:33 +0200 Subject: [PATCH] Do not push options to \babelprovide which do not make sense there Should fix a couple of tests --- src/BufferParams.cpp | 9 +++++---- src/BufferParams.h | 3 ++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp index 944d0714e9..a4c020e6e7 100644 --- a/src/BufferParams.cpp +++ b/src/BufferParams.cpp @@ -3532,7 +3532,7 @@ string BufferParams::babelCall(LaTeXFeatures const & features, string lang_opts, os << "\n\\babelprovide[import"; if (l == language) os << ", main"; - if (!babelLangOptions(l->lang()).empty()) + if (!babelLangOptions(l->lang(), true).empty()) os << ", " << babelLangOptions(l->lang()); os << "]{" << blang << "}"; have_mods = true; @@ -3555,7 +3555,8 @@ string BufferParams::babelCall(LaTeXFeatures const & features, string lang_opts, } if ((bp == 2 && useNonTeXFonts) || have_other_forceprovide) { // Options need to go to \babeprovide - if (!babelLangOptions(l->lang()).empty()) + // but only those set in document settings + if (!babelLangOptions(l->lang(), true).empty()) os << "\n\\babelprovide[" << babelLangOptions(l->lang()) << "]{" << blang << "}"; @@ -4095,11 +4096,11 @@ string const BufferParams::bibFileEncoding(string const & file) const } -string const BufferParams::babelLangOptions(string const & lang) const +string const BufferParams::babelLangOptions(string const & lang, bool const onlycust) const { if (lang_options_babel_.find(lang) == lang_options_babel_.end()) { Language const * l = languages.getLanguage(lang); - return l ? l->babelOpts() :string(); + return (l && !onlycust) ? l->babelOpts() : string(); } return lang_options_babel_.find(lang)->second; } diff --git a/src/BufferParams.h b/src/BufferParams.h index 6118688fb0..1b3393cdb3 100644 --- a/src/BufferParams.h +++ b/src/BufferParams.h @@ -343,7 +343,8 @@ public: /// babel language options std::map lang_options_babel_; /// - std::string const babelLangOptions(std::string const & lang) const; + std::string const babelLangOptions(std::string const & lang, + bool const onlycust = false) const; /// void setBabelLangOptions(std::string const & lang, std::string const & opts) { lang_options_babel_[lang] = opts; }