]> git.lyx.org Git - features.git/commitdiff
Revert "Fix bug reported by Kornel."
authorRichard Kimberly Heck <rikiheck@lyx.org>
Fri, 20 Mar 2020 21:18:11 +0000 (17:18 -0400)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 18 Jun 2020 13:48:55 +0000 (15:48 +0200)
This reverts commit 438f15da21a4e6aa2594bb1f6d619540fd0ef02c.

Revert "Track whether we have warned about mixing layouts across e.g. branches."

This reverts commit 861c6167ca5f1329e16dd788489a7c03772e2332.

Revert "Track whether title has been issued via OutputParams."

This reverts commit b536759c0769dab641993347baeb62400455be04.

There are massive complications here, and I don't have time to fix them all
right now.

src/OutputParams.cpp
src/OutputParams.h
src/output_latex.cpp

index 7913758276fd8179db18dcdbeb7336a2f67b1fd7..d26955e69aa68189bdf414675806102c24a0628f 100644 (file)
@@ -33,8 +33,7 @@ OutputParams::OutputParams(Encoding const * enc)
          dryrun(false), silent(false), pass_thru(false),
          html_disable_captions(false), html_in_par(false),
          html_make_pars(true), for_toc(false), for_tooltip(false),
-         for_search(false), for_preview(false), includeall(false),
-         already_title(false), issued_title_cmd(false), gave_layout_warning(false)
+         for_search(false), for_preview(false), includeall(false)
 {
        // Note: in PreviewLoader::Impl::dumpPreamble
        // OutputParams runparams(0);
index 9a9577f560fc29d2a8af3e9576b0bfdae0097b18..5503d8b7cd191b1f2c944abd14b69fa18ce320b0 100644 (file)
@@ -357,15 +357,6 @@ public:
 
        /// Explicit output folder, if any is desired
        std::string export_folder;
-
-       /// Have we already output the title?
-       mutable bool already_title;
-       /// Used to signal we need to output \end{TITLEBLOCK} when title
-       /// environment is used.
-       mutable bool issued_title_cmd;
-       /// Did we already issue the warning about mixing title and
-       /// non-title layouts?
-       mutable bool gave_layout_warning;
 };
 
 
index d495c634398c563ba80ee9f4b9ec6773312cb6da..1185e2d6e343149dbb0e7eddbb740958c9bed6ea 100644 (file)
@@ -1593,8 +1593,12 @@ void latexParagraphs(Buffer const & buf,
        // lastpit is for the language check after the loop.
        pit_type lastpit = pit;
        // variables used in the loop:
+       bool was_title = false;
+       bool already_title = false;
        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) {
                lastpit = pit;
                ParagraphList::const_iterator par = paragraphs.constIterator(pit);
@@ -1605,9 +1609,9 @@ void latexParagraphs(Buffer const & buf,
                                tclass.plainLayout() : par->layout();
 
                if (layout.intitle) {
-                       if (runparams.already_title) {
-                               if (!runparams.gave_layout_warning && !runparams.dryrun) {
-                                       runparams.gave_layout_warning = true;
+                       if (already_title) {
+                               if (!gave_layout_warning && !runparams.dryrun) {
+                                       gave_layout_warning = true;
                                        frontend::Alert::warning(_("Error in latexParagraphs"),
                                                        bformat(_("You are using at least one "
                                                          "layout (%1$s) intended for the title, "
@@ -1615,16 +1619,15 @@ void latexParagraphs(Buffer const & buf,
                                                          "could lead to missing or incorrect output."
                                                          ), layout.name()));
                                }
-                       } else if (!runparams.issued_title_cmd) {
+                       } else if (!was_title) {
+                               was_title = true;
                                if (tclass.titletype() == TITLE_ENVIRONMENT) {
                                        os << "\\begin{"
                                                        << from_ascii(tclass.titlename())
                                                        << "}\n";
-                                       runparams.issued_title_cmd = true;
                                }
                        }
-               } else if (runparams.issued_title_cmd &&
-                                  !runparams.already_title && !layout.inpreamble) {
+               } else if (was_title && !already_title && !layout.inpreamble) {
                        if (tclass.titletype() == TITLE_ENVIRONMENT) {
                                os << "\\end{" << from_ascii(tclass.titlename())
                                                << "}\n";
@@ -1633,8 +1636,8 @@ void latexParagraphs(Buffer const & buf,
                                os << "\\" << from_ascii(tclass.titlename())
                                                << "\n";
                        }
-                       runparams.already_title = true;
-                       runparams.issued_title_cmd = false;
+                       already_title = true;
+                       was_title = false;
                }
 
                if (layout.isCommand() && !layout.latexname().empty()
@@ -1689,17 +1692,14 @@ void latexParagraphs(Buffer const & buf,
        // But if we're in a branch, this is not the end of
        // the document. (There may be some other checks of this
        // kind that are needed.)
-       if (runparams.issued_title_cmd &&
-                       !runparams.already_title && !runparams.inbranch) {
+       if (was_title && !already_title && !runparams.inbranch) {
                if (tclass.titletype() == TITLE_ENVIRONMENT) {
                        os << "\\end{" << from_ascii(tclass.titlename())
                           << "}\n";
-                       runparams.issued_title_cmd = false;
                } else {
                        os << "\\" << from_ascii(tclass.titlename())
                           << "\n";
                }
-               runparams.already_title = true;
        }
 
        if (maintext && !is_child && runparams.openbtUnit)