mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
Add BabelOpts to languages
This way, some settings that were hardcoded in BabelPreamble are customizable in document settings
This commit is contained in:
parent
8ff3e467a1
commit
7e09f574ba
@ -8,6 +8,7 @@
|
|||||||
# GuiName "<Gui Name>"
|
# GuiName "<Gui Name>"
|
||||||
# HasGuiSupport <true|false>
|
# HasGuiSupport <true|false>
|
||||||
# BabelName <babelname>
|
# BabelName <babelname>
|
||||||
|
# BabelOpts "<language-specific options>"
|
||||||
# BabelOptFormat <format of option specification>
|
# BabelOptFormat <format of option specification>
|
||||||
# PolyglossiaName <polyglossianame>
|
# PolyglossiaName <polyglossianame>
|
||||||
# PolyglossiaOpts "<language-specific options>"
|
# PolyglossiaOpts "<language-specific options>"
|
||||||
@ -129,6 +130,8 @@
|
|||||||
# be de-activated in some contexts (such as - or =).
|
# be de-activated in some contexts (such as - or =).
|
||||||
# * XindyName holds the value to the (te)xindy -L option. We only give it
|
# * XindyName holds the value to the (te)xindy -L option. We only give it
|
||||||
# if a corresponding language module exists.
|
# if a corresponding language module exists.
|
||||||
|
# * BabelOpts are comma separated, no matter how they shall be represented
|
||||||
|
# in the output.
|
||||||
# * BabelOptFormat specifies how the language-specific options shall be
|
# * BabelOptFormat specifies how the language-specific options shall be
|
||||||
# passed with babel (which differs between languages).
|
# passed with babel (which differs between languages).
|
||||||
# You can use the placeholders $lang$ and $opts$ (as in
|
# You can use the placeholders $lang$ and $opts$ (as in
|
||||||
@ -218,10 +221,8 @@ End
|
|||||||
Language ancientgreek
|
Language ancientgreek
|
||||||
GuiName "Greek (ancient)"
|
GuiName "Greek (ancient)"
|
||||||
BabelName greek
|
BabelName greek
|
||||||
|
BabelOpts "ancient"
|
||||||
BabelOptFormat modifier
|
BabelOptFormat modifier
|
||||||
PostBabelPreamble
|
|
||||||
\languageattribute{greek}{ancient}
|
|
||||||
EndPostBabelPreamble
|
|
||||||
PolyglossiaName greek
|
PolyglossiaName greek
|
||||||
PolyglossiaOpts "variant=ancient"
|
PolyglossiaOpts "variant=ancient"
|
||||||
XindyName greek
|
XindyName greek
|
||||||
@ -670,6 +671,7 @@ End
|
|||||||
Language estonian
|
Language estonian
|
||||||
GuiName "Estonian"
|
GuiName "Estonian"
|
||||||
BabelName estonian
|
BabelName estonian
|
||||||
|
BabelOpts notilde
|
||||||
BabelOptFormat modifier
|
BabelOptFormat modifier
|
||||||
PolyglossiaName estonian
|
PolyglossiaName estonian
|
||||||
XindyName estonian
|
XindyName estonian
|
||||||
@ -678,9 +680,6 @@ Language estonian
|
|||||||
FontEncoding T1|OT1
|
FontEncoding T1|OT1
|
||||||
DateFormats "d MMMM yyyy|d MMM yyyy|dd.MM.yyyy"
|
DateFormats "d MMMM yyyy|d MMM yyyy|dd.MM.yyyy"
|
||||||
LangCode et_EE
|
LangCode et_EE
|
||||||
PostBabelPreamble
|
|
||||||
\addto\extrasestonian{\bbl@deactivate{~}}
|
|
||||||
EndPostBabelPreamble
|
|
||||||
End
|
End
|
||||||
|
|
||||||
# the preamble definitions are only used due to bugs in the
|
# the preamble definitions are only used due to bugs in the
|
||||||
@ -1450,6 +1449,7 @@ Language spanish
|
|||||||
GuiName "Spanish"
|
GuiName "Spanish"
|
||||||
HasGuiSupport true
|
HasGuiSupport true
|
||||||
BabelName spanish
|
BabelName spanish
|
||||||
|
BabelOpts "noquoting, nodecimaldot"
|
||||||
BabelOptFormat modifier
|
BabelOptFormat modifier
|
||||||
PolyglossiaName spanish
|
PolyglossiaName spanish
|
||||||
XindyName spanish-modern
|
XindyName spanish-modern
|
||||||
@ -1458,27 +1458,23 @@ Language spanish
|
|||||||
FontEncoding T1|OT1
|
FontEncoding T1|OT1
|
||||||
DateFormats "d 'de' MMMM 'de' yyyy|d MMM yyyy|dd/MM/yyyy"
|
DateFormats "d 'de' MMMM 'de' yyyy|d MMM yyyy|dd/MM/yyyy"
|
||||||
LangCode es_ES
|
LangCode es_ES
|
||||||
PostBabelPreamble
|
|
||||||
\addto\shorthandsspanish{\spanishdeactivate{~<>}}
|
|
||||||
\deactivatequoting
|
|
||||||
EndPostBabelPreamble
|
|
||||||
End
|
End
|
||||||
|
|
||||||
# there are no spanish shorthands in polyglossia
|
# there are no spanish shorthands in polyglossia
|
||||||
Language spanish-mexico
|
Language spanish-mexico
|
||||||
GuiName "Spanish (Mexico)"
|
GuiName "Spanish (Mexico)"
|
||||||
BabelName spanish
|
BabelName spanish
|
||||||
|
# mexico implies nodecimaldot
|
||||||
|
BabelOpts "mexico, noquoting"
|
||||||
|
BabelOptFormat modifier
|
||||||
PolyglossiaName spanish
|
PolyglossiaName spanish
|
||||||
|
PolyglossiaOpts "variant=mexican"
|
||||||
XindyName spanish-modern
|
XindyName spanish-modern
|
||||||
QuoteStyle french
|
QuoteStyle french
|
||||||
Encoding iso8859-15
|
Encoding iso8859-15
|
||||||
FontEncoding T1|OT1
|
FontEncoding T1|OT1
|
||||||
DateFormats "d 'de' MMMM 'de' yyyy|d MMM yyyy|dd/MM/yyyy"
|
DateFormats "d 'de' MMMM 'de' yyyy|d MMM yyyy|dd/MM/yyyy"
|
||||||
LangCode es_MX
|
LangCode es_MX
|
||||||
PostBabelPreamble
|
|
||||||
\addto\shorthandsspanish{\spanishdeactivate{~<>.}}
|
|
||||||
\deactivatequoting
|
|
||||||
EndPostBabelPreamble
|
|
||||||
End
|
End
|
||||||
|
|
||||||
Language swedish
|
Language swedish
|
||||||
|
@ -1371,7 +1371,9 @@ void BufferParams::writeFile(ostream & os, Buffer const * buf) const
|
|||||||
if (language != ignore_language)
|
if (language != ignore_language)
|
||||||
os << "\\language " << language->lang() << '\n';
|
os << "\\language " << language->lang() << '\n';
|
||||||
for (auto const & s : lang_options_babel_) {
|
for (auto const & s : lang_options_babel_) {
|
||||||
if (!s.second.empty())
|
Language const * l = languages.getLanguage(s.first);
|
||||||
|
if (l && l->babelOpts() != s.second)
|
||||||
|
// babel options can be empty
|
||||||
os << "\\language_options_babel " << s.first << " \"" << s.second << "\"\n";
|
os << "\\language_options_babel " << s.first << " \"" << s.second << "\"\n";
|
||||||
}
|
}
|
||||||
for (auto const & s : lang_options_polyglossia_) {
|
for (auto const & s : lang_options_polyglossia_) {
|
||||||
@ -4039,8 +4041,10 @@ string const BufferParams::bibFileEncoding(string const & file) const
|
|||||||
|
|
||||||
string const BufferParams::babelLangOptions(string const & lang) const
|
string const BufferParams::babelLangOptions(string const & lang) const
|
||||||
{
|
{
|
||||||
if (lang_options_babel_.find(lang) == lang_options_babel_.end())
|
if (lang_options_babel_.find(lang) == lang_options_babel_.end()) {
|
||||||
return string();
|
Language const * l = languages.getLanguage(lang);
|
||||||
|
return l ? l->babelOpts() :string();
|
||||||
|
}
|
||||||
return lang_options_babel_.find(lang)->second;
|
return lang_options_babel_.find(lang)->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,6 +132,7 @@ bool Language::readLanguage(Lexer & lex)
|
|||||||
enum LanguageTags {
|
enum LanguageTags {
|
||||||
LA_BABELNAME = 1,
|
LA_BABELNAME = 1,
|
||||||
LA_BABELOPTFORMAT,
|
LA_BABELOPTFORMAT,
|
||||||
|
LA_BABELOPTS,
|
||||||
LA_DATEFORMATS,
|
LA_DATEFORMATS,
|
||||||
LA_ENCODING,
|
LA_ENCODING,
|
||||||
LA_END,
|
LA_END,
|
||||||
@ -159,6 +160,7 @@ bool Language::readLanguage(Lexer & lex)
|
|||||||
{ "activechars", LA_ACTIVECHARS },
|
{ "activechars", LA_ACTIVECHARS },
|
||||||
{ "babelname", LA_BABELNAME },
|
{ "babelname", LA_BABELNAME },
|
||||||
{ "babeloptformat", LA_BABELOPTFORMAT },
|
{ "babeloptformat", LA_BABELOPTFORMAT },
|
||||||
|
{ "babelopts", LA_BABELOPTS },
|
||||||
{ "dateformats", LA_DATEFORMATS },
|
{ "dateformats", LA_DATEFORMATS },
|
||||||
{ "encoding", LA_ENCODING },
|
{ "encoding", LA_ENCODING },
|
||||||
{ "end", LA_END },
|
{ "end", LA_END },
|
||||||
@ -209,6 +211,9 @@ bool Language::readLanguage(Lexer & lex)
|
|||||||
case LA_BABELOPTFORMAT:
|
case LA_BABELOPTFORMAT:
|
||||||
lex >> babeloptformat_;
|
lex >> babeloptformat_;
|
||||||
break;
|
break;
|
||||||
|
case LA_BABELOPTS:
|
||||||
|
lex >> babel_opts_;
|
||||||
|
break;
|
||||||
case LA_POLYGLOSSIANAME:
|
case LA_POLYGLOSSIANAME:
|
||||||
lex >> polyglossia_name_;
|
lex >> polyglossia_name_;
|
||||||
break;
|
break;
|
||||||
|
@ -43,6 +43,8 @@ public:
|
|||||||
std::string const lang() const { return lang_; }
|
std::string const lang() const { return lang_; }
|
||||||
/// Babel language name
|
/// Babel language name
|
||||||
std::string const babel() const { return babel_; }
|
std::string const babel() const { return babel_; }
|
||||||
|
/// babel language options
|
||||||
|
std::string const babelOpts() const { return babel_opts_; }
|
||||||
/// Babel option format
|
/// Babel option format
|
||||||
std::string const babelOptFormat() const { return babeloptformat_; }
|
std::string const babelOptFormat() const { return babeloptformat_; }
|
||||||
/// polyglossia language name
|
/// polyglossia language name
|
||||||
@ -118,6 +120,8 @@ private:
|
|||||||
///
|
///
|
||||||
trivstring babel_;
|
trivstring babel_;
|
||||||
///
|
///
|
||||||
|
trivstring babel_opts_;
|
||||||
|
///
|
||||||
trivstring babeloptformat_;
|
trivstring babeloptformat_;
|
||||||
///
|
///
|
||||||
trivstring polyglossia_name_;
|
trivstring polyglossia_name_;
|
||||||
|
Loading…
Reference in New Issue
Block a user