bool const using_begin_end =
runparams.use_polyglossia ||
!lyxrc.language_command_end.empty();
- if (using_begin_end)
+ if (using_begin_end && !languageStackEmpty())
popLanguageName();
}
string end_tag = subst(lang_end_command, "$$lang", running_lang);
os << from_ascii(end_tag);
column += end_tag.length();
- popLanguageName();
+ if (!languageStackEmpty())
+ popLanguageName();
}
// Switch file encoding if necessary (and allowed)
}
+bool languageStackEmpty()
+{
+ OutputState * state = getOutputState();
+
+ return state->lang_switch_depth_.empty();
+}
+
+
string const & openLanguageName()
{
OutputState * state = getOutputState();
<< '\n';
// If we have language_auto_begin, the stack will
// already be empty, nothing to pop()
- if (using_begin_end && !lyxrc.language_auto_begin)
+ if (using_begin_end && langOpenedAtThisLevel(state))
popLanguageName();
}
*/
void popLanguageName();
+// Check if we have an empty language stack
+bool languageStackEmpty();
+
/** Return a reference to the last active language opened with
polyglossia or when using begin/end commands. If none or when
using babel with only a begin command, return a reference to