Prepare for fixing bug 3235

* src/output_latex.C
	(TeXEnvironment): Rename language variables to make it very clear
	that they denote the paragraph language, not the character language.
	(TeXOnePar): ditto


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17422 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Georg Baum 2007-03-12 17:19:08 +00:00
parent 566d80d064
commit 9f75809bc5

View File

@ -96,30 +96,30 @@ TeXEnvironment(Buffer const & buf,
LyXLayout_ptr const & style = pit->layout(); LyXLayout_ptr const & style = pit->layout();
Language const * language = pit->getParLanguage(bparams); Language const * const par_language = pit->getParLanguage(bparams);
Language const * doc_language = bparams.language; Language const * const doc_language = bparams.language;
Language const * previous_language = Language const * const prev_par_language =
(pit != paragraphs.begin()) (pit != paragraphs.begin())
? boost::prior(pit)->getParLanguage(bparams) ? boost::prior(pit)->getParLanguage(bparams)
: doc_language; : doc_language;
if (language->babel() != previous_language->babel()) { if (par_language->babel() != prev_par_language->babel()) {
if (!lyxrc.language_command_end.empty() && if (!lyxrc.language_command_end.empty() &&
previous_language->babel() != doc_language->babel()) { prev_par_language->babel() != doc_language->babel()) {
os << from_ascii(subst( os << from_ascii(subst(
lyxrc.language_command_end, lyxrc.language_command_end,
"$$lang", "$$lang",
previous_language->babel())) prev_par_language->babel()))
<< '\n'; << '\n';
texrow.newline(); texrow.newline();
} }
if (lyxrc.language_command_end.empty() || if (lyxrc.language_command_end.empty() ||
language->babel() != doc_language->babel()) { par_language->babel() != doc_language->babel()) {
os << from_ascii(subst( os << from_ascii(subst(
lyxrc.language_command_begin, lyxrc.language_command_begin,
"$$lang", "$$lang",
language->babel())) par_language->babel()))
<< '\n'; << '\n';
texrow.newline(); texrow.newline();
} }
@ -255,14 +255,14 @@ TeXOnePar(Buffer const & buf,
OutputParams runparams = runparams_in; OutputParams runparams = runparams_in;
runparams.moving_arg |= style->needprotect; runparams.moving_arg |= style->needprotect;
Language const * language = pit->getParLanguage(bparams); Language const * const par_language = pit->getParLanguage(bparams);
Language const * doc_language = bparams.language; Language const * const doc_language = bparams.language;
Language const * previous_language = Language const * const prev_par_language =
(pit != paragraphs.begin()) (pit != paragraphs.begin())
? boost::prior(pit)->getParLanguage(bparams) ? boost::prior(pit)->getParLanguage(bparams)
: doc_language; : doc_language;
if (language->babel() != previous_language->babel() if (par_language->babel() != prev_par_language->babel()
// check if we already put language command in TeXEnvironment() // check if we already put language command in TeXEnvironment()
&& !(style->isEnvironment() && !(style->isEnvironment()
&& (pit == paragraphs.begin() || && (pit == paragraphs.begin() ||
@ -271,22 +271,22 @@ TeXOnePar(Buffer const & buf,
|| boost::prior(pit)->getDepth() < pit->getDepth()))) || boost::prior(pit)->getDepth() < pit->getDepth())))
{ {
if (!lyxrc.language_command_end.empty() && if (!lyxrc.language_command_end.empty() &&
previous_language->babel() != doc_language->babel()) prev_par_language->babel() != doc_language->babel())
{ {
os << from_ascii(subst(lyxrc.language_command_end, os << from_ascii(subst(lyxrc.language_command_end,
"$$lang", "$$lang",
previous_language->babel())) prev_par_language->babel()))
<< '\n'; << '\n';
texrow.newline(); texrow.newline();
} }
if (lyxrc.language_command_end.empty() || if (lyxrc.language_command_end.empty() ||
language->babel() != doc_language->babel()) par_language->babel() != doc_language->babel())
{ {
os << from_ascii(subst( os << from_ascii(subst(
lyxrc.language_command_begin, lyxrc.language_command_begin,
"$$lang", "$$lang",
language->babel())) par_language->babel()))
<< '\n'; << '\n';
texrow.newline(); texrow.newline();
} }
@ -434,7 +434,7 @@ TeXOnePar(Buffer const & buf,
} }
if (boost::next(pit) == paragraphs.end() if (boost::next(pit) == paragraphs.end()
&& language->babel() != doc_language->babel()) { && par_language->babel() != doc_language->babel()) {
// Since \selectlanguage write the language to the aux file, // Since \selectlanguage write the language to the aux file,
// we need to reset the language at the end of footnote or // we need to reset the language at the end of footnote or
// float. // float.
@ -452,7 +452,7 @@ TeXOnePar(Buffer const & buf,
os << from_ascii(subst( os << from_ascii(subst(
lyxrc.language_command_end, lyxrc.language_command_end,
"$$lang", "$$lang",
language->babel())); par_language->babel()));
pending_newline = true; pending_newline = true;
} }