]> git.lyx.org Git - features.git/commitdiff
tex2lyx: Fixes to the btUnit import
authorJuergen Spitzmueller <spitz@lyx.org>
Wed, 22 Aug 2018 06:39:13 +0000 (08:39 +0200)
committerJuergen Spitzmueller <spitz@lyx.org>
Mon, 10 Sep 2018 15:50:30 +0000 (17:50 +0200)
1. Do not attempt to mix diverging btUnits (e.g., chapters and sections).
2. use parse_text to properly parse the contents.

(cherry picked from commit 68d48b0015065f3c3cdd1377678bca56551cc203)

src/tex2lyx/Preamble.h
src/tex2lyx/text.cpp
status.23x

index 5c8b17f12803fb507f1709331410ea5322c2a1ea..adbffbe5e149052b54f6332315e6470a9a026b02 100644 (file)
@@ -82,6 +82,8 @@ public:
        ///
        void citeEngine(std::string const & e) { h_cite_engine = e; }
        ///
+       std::string multibib() const { return h_multibib; }
+       ///
        void multibib(std::string const & s) { h_multibib = s; }
        ///
        bool titleLayoutFound() const { return title_layout_found; }
index 531d4c4517b1d6a44a2924ec9d2573d6544dc0b5..2e10421b730246a6c3091c925a9244cd87769d7f 100644 (file)
@@ -1944,9 +1944,12 @@ void parse_environment(Parser & p, ostream & os, bool outer,
 
        else if (name == "btUnit") {
                string const nt = p.next_next_token().cs();
-               if (nt == "part" || nt == "chapter"
-                  || nt == "section" || nt == "subsection") {
-                       active_environments.push_back("btUnit");
+               // Do not attempt to overwrite a former diverging multibib.
+               // Those are output as ERT instead.
+               if ((nt == "part" || nt == "chapter"
+                    || nt == "section" || nt == "subsection")
+                  && (preamble.multibib().empty() || preamble.multibib() == nt)) {
+                       parse_text(p, os, FLAG_END, outer, parent_context);
                        preamble.multibib(nt);
                } else
                        parse_unknown_environment(p, name, os, FLAG_END, outer,
index 2daf9c72a5c2582cf8bab3fa190044e8be88e027..96fe47636439aed69aa1e454a2f7c72b77a38f9b 100644 (file)
@@ -39,6 +39,8 @@ What's new
 
 - Add support for horizontal longtabular alignment.
 
+- Add support for btUnit (multibib).
+
 
 
 * USER INTERFACE