]> git.lyx.org Git - lyx.git/commitdiff
Do not push options to \babelprovide which do not make sense there
authorJürgen Spitzmüller <spitz@lyx.org>
Tue, 10 Sep 2024 11:58:33 +0000 (13:58 +0200)
committerJürgen Spitzmüller <spitz@lyx.org>
Tue, 10 Sep 2024 11:58:33 +0000 (13:58 +0200)
Should fix a couple of tests

src/BufferParams.cpp
src/BufferParams.h

index 944d0714e9849d21fb2d3c6c7fee2aba9bbc2fac..a4c020e6e7dd6ef1fb3934506067e2af368f0a06 100644 (file)
@@ -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;
 }
index 6118688fb0965e6b584534117eee8dec86f34f38..1b3393cdb3c4e8b9d13ab757a9eb4de5b69f0a9e 100644 (file)
@@ -343,7 +343,8 @@ public:
        /// babel language options
        std::map<std::string, std::string> 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; }