mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-29 13:04:58 +00:00
Warn in GUI when mixing Title and InTitle layouts
Since we process layouts sequentially, we export LaTeX code for the title once we arrive to a layout that has InTitle false. If the document then later has a layout with InTitle true, we do not (currently) go back to add it to the title and just output it in-place. We previously warned with LYXERR0, but since this can cause missing or unexpected output we now warn in the GUI. For more information, see the following lyx-devel thread: https://www.mail-archive.com/search?l=mid&q=a65ae226-d3bd-8fc5-a93b-7bb23f1cda82%40lyx.org
This commit is contained in:
parent
fb46b3a1ee
commit
0b1cf1330d
@ -29,12 +29,15 @@
|
|||||||
#include "insets/InsetBibitem.h"
|
#include "insets/InsetBibitem.h"
|
||||||
#include "insets/InsetArgument.h"
|
#include "insets/InsetArgument.h"
|
||||||
|
|
||||||
|
#include "frontends/alert.h"
|
||||||
|
|
||||||
#include "support/lassert.h"
|
#include "support/lassert.h"
|
||||||
#include "support/convert.h"
|
#include "support/convert.h"
|
||||||
#include "support/debug.h"
|
#include "support/debug.h"
|
||||||
#include "support/lstrings.h"
|
#include "support/lstrings.h"
|
||||||
#include "support/lyxalgo.h"
|
#include "support/lyxalgo.h"
|
||||||
#include "support/textutils.h"
|
#include "support/textutils.h"
|
||||||
|
#include "support/gettext.h"
|
||||||
|
|
||||||
#include <QThreadStorage>
|
#include <QThreadStorage>
|
||||||
|
|
||||||
@ -1178,6 +1181,8 @@ void latexParagraphs(Buffer const & buf,
|
|||||||
bool already_title = false;
|
bool already_title = false;
|
||||||
DocumentClass const & tclass = bparams.documentClass();
|
DocumentClass const & tclass = bparams.documentClass();
|
||||||
|
|
||||||
|
// Did we already warn about inTitle layout mixing? (we only warn once)
|
||||||
|
bool gave_layout_warning = false;
|
||||||
for (; pit < runparams.par_end; ++pit) {
|
for (; pit < runparams.par_end; ++pit) {
|
||||||
lastpit = pit;
|
lastpit = pit;
|
||||||
ParagraphList::const_iterator par = paragraphs.constIterator(pit);
|
ParagraphList::const_iterator par = paragraphs.constIterator(pit);
|
||||||
@ -1189,10 +1194,15 @@ void latexParagraphs(Buffer const & buf,
|
|||||||
|
|
||||||
if (layout.intitle) {
|
if (layout.intitle) {
|
||||||
if (already_title) {
|
if (already_title) {
|
||||||
LYXERR0("Error in latexParagraphs: You"
|
if (!gave_layout_warning) {
|
||||||
" are using a layout (\"" << layout.name() << "\")"
|
gave_layout_warning = true;
|
||||||
" intended for the title, after using"
|
frontend::Alert::warning(_("Error in latexParagraphs"),
|
||||||
" non-title layouts.");
|
bformat(_("You are using at least one "
|
||||||
|
"layout (%1$s) intended for the title, "
|
||||||
|
"after using non-title layouts. This "
|
||||||
|
"could lead to missing or incorrect output."
|
||||||
|
), layout.name()));
|
||||||
|
}
|
||||||
} else if (!was_title) {
|
} else if (!was_title) {
|
||||||
was_title = true;
|
was_title = true;
|
||||||
if (tclass.titletype() == TITLE_ENVIRONMENT) {
|
if (tclass.titletype() == TITLE_ENVIRONMENT) {
|
||||||
|
Loading…
Reference in New Issue
Block a user