mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
Restore the master language at the end of an included child document
instead of the child document language. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31665 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
fbb0c219ca
commit
128e349191
@ -20,7 +20,8 @@ namespace lyx {
|
|||||||
|
|
||||||
OutputParams::OutputParams(Encoding const * enc)
|
OutputParams::OutputParams(Encoding const * enc)
|
||||||
: flavor(LATEX), nice(false), moving_arg(false), inulemcmd(false),
|
: flavor(LATEX), nice(false), moving_arg(false), inulemcmd(false),
|
||||||
local_font(0), encoding(enc), free_spacing(false), use_babel(false),
|
local_font(0), master_language(0), encoding(enc),
|
||||||
|
free_spacing(false), use_babel(false),
|
||||||
use_indices(false), use_japanese(false), linelen(0), depth(0),
|
use_indices(false), use_japanese(false), linelen(0), depth(0),
|
||||||
exportdata(new ExportData),
|
exportdata(new ExportData),
|
||||||
inComment(false), inTableCell(NO), inFloat(NONFLOAT),
|
inComment(false), inTableCell(NO), inFloat(NONFLOAT),
|
||||||
|
@ -25,6 +25,7 @@ namespace lyx {
|
|||||||
class Encoding;
|
class Encoding;
|
||||||
class ExportData;
|
class ExportData;
|
||||||
class Font;
|
class Font;
|
||||||
|
class Language;
|
||||||
|
|
||||||
|
|
||||||
class OutputParams {
|
class OutputParams {
|
||||||
@ -91,6 +92,10 @@ public:
|
|||||||
*/
|
*/
|
||||||
mutable std::string document_language;
|
mutable std::string document_language;
|
||||||
|
|
||||||
|
/** The master language. Non-null only for child documents.
|
||||||
|
*/
|
||||||
|
mutable Language const * master_language;
|
||||||
|
|
||||||
/** Current stream encoding. Only used for LaTeX.
|
/** Current stream encoding. Only used for LaTeX.
|
||||||
This must be set to the document encoding (via the constructor)
|
This must be set to the document encoding (via the constructor)
|
||||||
before output starts. Afterwards it must be kept up to date for
|
before output starts. Afterwards it must be kept up to date for
|
||||||
|
@ -540,12 +540,16 @@ int InsetInclude::latex(odocstream & os, OutputParams const & runparams) const
|
|||||||
// argument. Should we set it to string(), or should makeLaTeXFile
|
// argument. Should we set it to string(), or should makeLaTeXFile
|
||||||
// make use of it somehow? (JMarc 20031002)
|
// make use of it somehow? (JMarc 20031002)
|
||||||
// The included file might be written in a different encoding
|
// The included file might be written in a different encoding
|
||||||
|
// and language.
|
||||||
Encoding const * const oldEnc = runparams.encoding;
|
Encoding const * const oldEnc = runparams.encoding;
|
||||||
|
Language const * const oldLang = runparams.master_language;
|
||||||
runparams.encoding = &tmp->params().encoding();
|
runparams.encoding = &tmp->params().encoding();
|
||||||
|
runparams.master_language = masterBuffer->params().language;
|
||||||
tmp->makeLaTeXFile(writefile,
|
tmp->makeLaTeXFile(writefile,
|
||||||
masterFileName(buffer()).onlyPath().absFilename(),
|
masterFileName(buffer()).onlyPath().absFilename(),
|
||||||
runparams, false);
|
runparams, false);
|
||||||
runparams.encoding = oldEnc;
|
runparams.encoding = oldEnc;
|
||||||
|
runparams.master_language = oldLang;
|
||||||
} else {
|
} else {
|
||||||
// In this case, it's not a LyX file, so we copy the file
|
// In this case, it's not a LyX file, so we copy the file
|
||||||
// to the temp dir, so that .aux files etc. are not created
|
// to the temp dir, so that .aux files etc. are not created
|
||||||
|
@ -671,11 +671,18 @@ ParagraphList::const_iterator TeXOnePar(Buffer const & buf,
|
|||||||
// when the paragraph uses CJK, the language has to be closed earlier
|
// when the paragraph uses CJK, the language has to be closed earlier
|
||||||
if (font.language()->encoding()->package() != Encoding::CJK) {
|
if (font.language()->encoding()->package() != Encoding::CJK) {
|
||||||
if (lyxrc.language_command_end.empty()) {
|
if (lyxrc.language_command_end.empty()) {
|
||||||
if (!prev_language->babel().empty()) {
|
// If this is a child, we should restore the
|
||||||
|
// master language after the last paragraph.
|
||||||
|
Language const * const current_language =
|
||||||
|
(nextpit == paragraphs.end()
|
||||||
|
&& runparams.master_language)
|
||||||
|
? runparams.master_language
|
||||||
|
: prev_language;
|
||||||
|
if (!current_language->babel().empty()) {
|
||||||
os << from_ascii(subst(
|
os << from_ascii(subst(
|
||||||
lyxrc.language_command_begin,
|
lyxrc.language_command_begin,
|
||||||
"$$lang",
|
"$$lang",
|
||||||
prev_language->babel()));
|
current_language->babel()));
|
||||||
pending_newline = true;
|
pending_newline = true;
|
||||||
}
|
}
|
||||||
} else if (!par_language->babel().empty()) {
|
} else if (!par_language->babel().empty()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user