]> git.lyx.org Git - features.git/commitdiff
tex2lyx: also support rotated xltabulars
authorJuergen Spitzmueller <spitz@lyx.org>
Fri, 24 Aug 2018 07:39:46 +0000 (09:39 +0200)
committerJuergen Spitzmueller <spitz@lyx.org>
Fri, 24 Aug 2018 07:39:46 +0000 (09:39 +0200)
src/tex2lyx/Context.cpp
src/tex2lyx/Context.h
src/tex2lyx/table.cpp
src/tex2lyx/text.cpp

index 5112401b08ad408fa0dafdf6b72bc72875282f0e..f28911a3c55884b12573cc130bd0b96fa2cc284d 100644 (file)
@@ -85,7 +85,7 @@ Context::Context(bool need_layout_,
          new_layout_allowed(true), merging_hyphens_allowed(true),
          textclass(textclass_),
          layout(layout_), parent_layout(parent_layout_),
-         font(font_), rotlongtable(false)
+         font(font_), tablerotation(0)
 {
        if (!layout)
                layout = &textclass.defaultLayout();
index 4fd1ff28bb793200ec1881bc8a1787467a73ae75..64d69e356106b64d2f9fe11cd0f1a31727375f04 100644 (file)
@@ -165,8 +165,8 @@ public:
        TeXFont font;
        /// font attributes of normal text
        static TeXFont normalfont;
-       /// A rotated longtable
-       bool rotlongtable;
+       /// Table rotation angle
+       int tablerotation;
 
 private:
        void begin_layout(std::ostream & os, Layout const * const & l);
index c432a2c35f2bff792d07c8f8ee59cdb3b607fb71..8beeb2d28fb5d977f3320412ac21ac835fbac8f2 100644 (file)
@@ -1416,13 +1416,10 @@ void handle_tabular(Parser & p, ostream & os, string const & name,
 
        //cerr << "// output what we have\n";
        // output what we have
-       string rotate = "0";
-       if (is_long_tabular && context.rotlongtable)
-               rotate = "90";
        os << "\n<lyxtabular version=\"3\" rows=\"" << rowinfo.size()
           << "\" columns=\"" << colinfo.size() << "\">\n";
        os << "<features"
-          << write_attribute("rotate", rotate)
+          << write_attribute("rotate", context.tablerotation)
           << write_attribute("booktabs", booktabs)
           << write_attribute("islongtable", is_long_tabular);
        if (is_long_tabular) {
index 3533a505c880b212971493a87d9e18b8afb746d9..61d7a7b3f5ff2e1f90218ce1515c7b2e017cba90 100644 (file)
@@ -1968,16 +1968,17 @@ void parse_environment(Parser & p, ostream & os, bool outer,
                        p.get_token();
                        p.get_token();
                        string envname = p.getArg('{', '}');
-                       if (envname == "longtable") {
+                       if (envname == "longtable" || envname == "xltabular") {
                                // Now we check if the longtable is the only content
                                // of the landscape environment
+                               string const ltenv = envname;
                                while (!found_end && !end_longtable && p.good()) {
                                        envname = p.next_token().cat() == catBegin
                                                        ? p.getArg('{', '}') : string();
                                        Token const & t = p.get_token();
                                        p.skip_spaces();
                                        end_longtable = t.asInput() != "\\end"
-                                                       && envname == "longtable";
+                                                       && envname == ltenv;
                                        found_end = t.asInput() == "\\end"
                                                        && envname == "landscape";
                                }
@@ -1990,10 +1991,10 @@ void parse_environment(Parser & p, ostream & os, bool outer,
                                if (only_longtable) {
                                        p.popPosition();
                                        p.skip_spaces();
-                                       bool const save_rotlongtable = parent_context.rotlongtable;
-                                       parent_context.rotlongtable = true;
+                                       int const save_tablerotation = parent_context.tablerotation;
+                                       parent_context.tablerotation = 90;
                                        parse_text(p, os, FLAG_END, outer, parent_context);
-                                       parent_context.rotlongtable = save_rotlongtable;
+                                       parent_context.tablerotation = save_tablerotation;
                                        p.skip_spaces();
                                        break;
                                }