mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +00:00
output babel options via \babelprovide in all cases needed
This commit is contained in:
parent
686b55e70d
commit
b1b8ded15d
@ -3503,12 +3503,17 @@ string BufferParams::babelCall(LaTeXFeatures const & features, string lang_opts,
|
|||||||
ostringstream os;
|
ostringstream os;
|
||||||
string force_provide;
|
string force_provide;
|
||||||
bool have_main_forceprovide = false;
|
bool have_main_forceprovide = false;
|
||||||
|
bool have_other_forceprovide = useNonTeXFonts
|
||||||
|
? languages.haveOtherForceProvide()
|
||||||
|
: false;
|
||||||
for (auto const & l : langs) {
|
for (auto const & l : langs) {
|
||||||
string blang = l->babel();
|
string blang = l->babel();
|
||||||
bool use_opt = langoptions;
|
bool use_opt = langoptions;
|
||||||
if (blang.empty())
|
if (blang.empty())
|
||||||
continue;
|
continue;
|
||||||
if (l->babelOptFormat() == "modifier") {
|
int const bp = l->useBabelProvide();
|
||||||
|
// pass option as modifier if apt
|
||||||
|
if (bp != 2 && !have_other_forceprovide && l->babelOptFormat() == "modifier") {
|
||||||
vector<string> opts = getVectorFromString(babelLangOptions(l->lang()));
|
vector<string> opts = getVectorFromString(babelLangOptions(l->lang()));
|
||||||
bool have_one = false;
|
bool have_one = false;
|
||||||
for (string const & s : opts) {
|
for (string const & s : opts) {
|
||||||
@ -3522,8 +3527,8 @@ string BufferParams::babelCall(LaTeXFeatures const & features, string lang_opts,
|
|||||||
use_opt = true;
|
use_opt = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int const bp = l->useBabelProvide();
|
// language that always requires \babelprovide
|
||||||
if (bp == 1) {
|
if (bp == 1 && !have_other_forceprovide) {
|
||||||
os << "\n\\babelprovide[import";
|
os << "\n\\babelprovide[import";
|
||||||
if (l == language)
|
if (l == language)
|
||||||
os << ", main";
|
os << ", main";
|
||||||
@ -3532,9 +3537,11 @@ string BufferParams::babelCall(LaTeXFeatures const & features, string lang_opts,
|
|||||||
os << "]{" << blang << "}";
|
os << "]{" << blang << "}";
|
||||||
have_mods = true;
|
have_mods = true;
|
||||||
}
|
}
|
||||||
|
// language that only requires \babelprovide with nonTeXFonts
|
||||||
if (bp == 2 && useNonTeXFonts) {
|
if (bp == 2 && useNonTeXFonts) {
|
||||||
// here we need to tell babel to use the ini
|
// here we need to tell babel to use the *.ini
|
||||||
// even though an *.ldf exists
|
// even though an *.ldf exists.
|
||||||
|
// This imports the *ini, so no "import" needed.
|
||||||
if (l == language) {
|
if (l == language) {
|
||||||
force_provide = force_provide.empty()
|
force_provide = force_provide.empty()
|
||||||
? "provide=*"
|
? "provide=*"
|
||||||
@ -3546,6 +3553,13 @@ string BufferParams::babelCall(LaTeXFeatures const & features, string lang_opts,
|
|||||||
: "provide+=*";
|
: "provide+=*";
|
||||||
have_mods = true;
|
have_mods = true;
|
||||||
}
|
}
|
||||||
|
if ((bp == 2 && useNonTeXFonts) || have_other_forceprovide) {
|
||||||
|
// Options need to go to \babeprovide
|
||||||
|
if (!babelLangOptions(l->lang()).empty())
|
||||||
|
os << "\n\\babelprovide["
|
||||||
|
<< babelLangOptions(l->lang())
|
||||||
|
<< "]{" << blang << "}";
|
||||||
|
}
|
||||||
if (bp != 1 && use_opt)
|
if (bp != 1 && use_opt)
|
||||||
blangs.push_back(blang);
|
blangs.push_back(blang);
|
||||||
}
|
}
|
||||||
|
@ -1822,7 +1822,8 @@ docstring const LaTeXFeatures::getBabelPostsettings() const
|
|||||||
for (auto const & lang : langs) {
|
for (auto const & lang : langs) {
|
||||||
if (!lang->babel_postsettings().empty())
|
if (!lang->babel_postsettings().empty())
|
||||||
tmp << lang->babel_postsettings() << '\n';
|
tmp << lang->babel_postsettings() << '\n';
|
||||||
if (lang->babelOptFormat() != "modifier" && lang->useBabelProvide() == 0) {
|
if (lang->babelOptFormat() != "modifier" && lang->useBabelProvide() == 0
|
||||||
|
&& (!params_.useNonTeXFonts || !languages.haveOtherForceProvide())) {
|
||||||
// user-set options
|
// user-set options
|
||||||
string const opts = bufferParams().babelLangOptions(lang->lang());
|
string const opts = bufferParams().babelLangOptions(lang->lang());
|
||||||
if (!opts.empty())
|
if (!opts.empty())
|
||||||
|
@ -535,4 +535,15 @@ Language const * Languages::getLanguage(string const & language) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Languages::haveOtherForceProvide() const
|
||||||
|
{
|
||||||
|
for (auto const & l : languagelist_) {
|
||||||
|
if (l.second.useBabelProvide())
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace lyx
|
} // namespace lyx
|
||||||
|
@ -205,6 +205,8 @@ public:
|
|||||||
const_iterator begin() const { return languagelist_.begin(); }
|
const_iterator begin() const { return languagelist_.begin(); }
|
||||||
///
|
///
|
||||||
const_iterator end() const { return languagelist_.end(); }
|
const_iterator end() const { return languagelist_.end(); }
|
||||||
|
///
|
||||||
|
bool haveOtherForceProvide() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
///
|
///
|
||||||
|
Loading…
Reference in New Issue
Block a user