mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 01:59:02 +00:00
* add PreBabelPreamble to Language definition (fixes #4786).
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36291 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
37d45c01c8
commit
12c7e7dde3
@ -12,6 +12,9 @@
|
||||
# RTL <true|false>
|
||||
# LangCode <language_code>
|
||||
# LangVariety <language_variety>
|
||||
# PreBabelPreamble
|
||||
# <extra latex code inserted before babel>
|
||||
# EndPreBabelPreamble
|
||||
# PostBabelPreamble
|
||||
# <extra latex code inserted after babel>
|
||||
# EndPostBabelPreamble
|
||||
@ -250,8 +253,8 @@ Language farsi
|
||||
RTL true
|
||||
LangCode fa_IR
|
||||
PostBabelPreamble
|
||||
\DeclareTextSymbol{\guillemotright}{LFE}{62}
|
||||
\DeclareTextSymbol{\guillemotleft}{LFE}{60}
|
||||
\DeclareTextSymbol{\guillemotright}{LFE}{62}
|
||||
\DeclareTextSymbol{\guillemotleft}{LFE}{60}
|
||||
EndPostBabelPreamble
|
||||
End
|
||||
|
||||
@ -269,10 +272,10 @@ Language french
|
||||
Encoding iso8859-15
|
||||
LangCode fr_FR
|
||||
PostBabelPreamble
|
||||
\addto\extrasfrench{%
|
||||
\providecommand{\og}{\leavevmode\flqq~}
|
||||
\providecommand{\fg}{\ifdim\lastskip>\z@\unskip\fi~\frqq}
|
||||
}
|
||||
\addto\extrasfrench{%
|
||||
\providecommand{\og}{\leavevmode\flqq~}
|
||||
\providecommand{\fg}{\ifdim\lastskip>\z@\unskip\fi~\frqq}
|
||||
}
|
||||
EndPostBabelPreamble
|
||||
End
|
||||
|
||||
@ -530,7 +533,7 @@ Language spanish
|
||||
Encoding iso8859-15
|
||||
LangCode es_ES
|
||||
PostBabelPreamble
|
||||
\addto\shorthandsspanish{\spanishdeactivate{~<>}}
|
||||
\addto\shorthandsspanish{\spanishdeactivate{~<>}}
|
||||
EndPostBabelPreamble
|
||||
End
|
||||
|
||||
@ -540,7 +543,7 @@ Language spanish-mexico
|
||||
Encoding iso8859-15
|
||||
LangCode es_MX
|
||||
PostBabelPreamble
|
||||
\addto\shorthandsspanish{\spanishdeactivate{~<>.}}
|
||||
\addto\shorthandsspanish{\spanishdeactivate{~<>.}}
|
||||
EndPostBabelPreamble
|
||||
End
|
||||
|
||||
@ -557,7 +560,7 @@ Language thai
|
||||
Encoding tis620-0
|
||||
LangCode th_TH
|
||||
PostBabelPreamble
|
||||
\usepackage{thswitch}
|
||||
\usepackage{thswitch}
|
||||
EndPostBabelPreamble
|
||||
End
|
||||
|
||||
|
@ -1743,8 +1743,9 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features,
|
||||
|| features.isRequired("vietnamese")
|
||||
|| features.isRequired("japanese") ) ) {
|
||||
// FIXME UNICODE
|
||||
lyxpreamble += from_utf8(features.getBabelPresettings());
|
||||
lyxpreamble += from_utf8(babelCall(language_options.str())) + '\n';
|
||||
lyxpreamble += from_utf8(features.getBabelPostsettings()) + '\n';
|
||||
lyxpreamble += from_utf8(features.getBabelPostsettings());
|
||||
}
|
||||
|
||||
// The optional packages;
|
||||
@ -1886,8 +1887,9 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features,
|
||||
&& !features.isRequired("vietnamese")
|
||||
&& !features.isRequired("japanese")) {
|
||||
// FIXME UNICODE
|
||||
lyxpreamble += from_utf8(features.getBabelPresettings());
|
||||
lyxpreamble += from_utf8(babelCall(language_options.str())) + '\n';
|
||||
lyxpreamble += from_utf8(features.getBabelPostsettings()) + '\n';
|
||||
lyxpreamble += from_utf8(features.getBabelPostsettings());
|
||||
}
|
||||
|
||||
docstring const i18npreamble = features.getTClassI18nPreamble(use_babel);
|
||||
|
@ -947,6 +947,22 @@ docstring const LaTeXFeatures::getMacros() const
|
||||
}
|
||||
|
||||
|
||||
string const LaTeXFeatures::getBabelPresettings() const
|
||||
{
|
||||
ostringstream tmp;
|
||||
|
||||
LanguageList::const_iterator it = UsedLanguages_.begin();
|
||||
LanguageList::const_iterator end = UsedLanguages_.end();
|
||||
for (; it != end; ++it)
|
||||
if (!(*it)->babel_presettings().empty())
|
||||
tmp << (*it)->babel_presettings() << '\n';
|
||||
if (!params_.language->babel_presettings().empty())
|
||||
tmp << params_.language->babel_presettings() << '\n';
|
||||
|
||||
return tmp.str();
|
||||
}
|
||||
|
||||
|
||||
string const LaTeXFeatures::getBabelPostsettings() const
|
||||
{
|
||||
ostringstream tmp;
|
||||
|
@ -52,7 +52,9 @@ public:
|
||||
std::string const getPackages() const;
|
||||
/// The macros definitions needed by the document
|
||||
docstring const getMacros() const;
|
||||
///
|
||||
/// Extra preamble code before babel is called
|
||||
std::string const getBabelPresettings() const;
|
||||
/// Extra preamble code after babel is called
|
||||
std::string const getBabelPostsettings() const;
|
||||
/// The definitions needed by the document's textclass
|
||||
docstring const getTClassPreamble() const;
|
||||
|
@ -5,6 +5,7 @@
|
||||
*
|
||||
* \author Lars Gullik Bjønnes
|
||||
* \author Jean-Marc Lasgouttes
|
||||
* \author Jürgen Spitzmüller
|
||||
* \author Dekel Tsur
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
@ -48,6 +49,7 @@ bool Language::readLanguage(Lexer & lex)
|
||||
LA_LANG_CODE,
|
||||
LA_LANG_VARIETY,
|
||||
LA_POSTBABELPREAMBLE,
|
||||
LA_PREBABELPREAMBLE,
|
||||
LA_RTL
|
||||
};
|
||||
|
||||
@ -61,6 +63,7 @@ bool Language::readLanguage(Lexer & lex)
|
||||
{ "langcode", LA_LANG_CODE },
|
||||
{ "langvariety", LA_LANG_VARIETY },
|
||||
{ "postbabelpreamble", LA_POSTBABELPREAMBLE },
|
||||
{ "prebabelpreamble", LA_PREBABELPREAMBLE },
|
||||
{ "rtl", LA_RTL }
|
||||
};
|
||||
|
||||
@ -109,6 +112,10 @@ bool Language::readLanguage(Lexer & lex)
|
||||
babel_postsettings_ =
|
||||
lex.getLongString("EndPostBabelPreamble");
|
||||
break;
|
||||
case LA_PREBABELPREAMBLE:
|
||||
babel_presettings_ =
|
||||
lex.getLongString("EndPreBabelPreamble");
|
||||
break;
|
||||
case LA_RTL:
|
||||
lex >> rightToLeft_;
|
||||
break;
|
||||
|
@ -54,6 +54,8 @@ public:
|
||||
///
|
||||
std::string const & babel_postsettings() const { return babel_postsettings_; }
|
||||
///
|
||||
std::string const & babel_presettings() const { return babel_presettings_; }
|
||||
///
|
||||
bool internalFontEncoding() const { return internal_enc_; }
|
||||
///
|
||||
bool read(Lexer & lex);
|
||||
@ -81,6 +83,8 @@ private:
|
||||
///
|
||||
std::string babel_postsettings_;
|
||||
///
|
||||
std::string babel_presettings_;
|
||||
///
|
||||
bool internal_enc_;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user