]> git.lyx.org Git - features.git/commitdiff
tex2lyx support for english quotes; revert the layout format change because we are...
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Mon, 28 Jul 2003 15:45:41 +0000 (15:45 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Mon, 28 Jul 2003 15:45:41 +0000 (15:45 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7422 a592a061-630c-0410-9148-cb99ea01b6c8

src/insets/ChangeLog
src/insets/insetquotes.C
src/tex2lyx/ChangeLog
src/tex2lyx/preamble.C
src/tex2lyx/table.C
src/tex2lyx/tex2lyx.C
src/tex2lyx/text.C

index 1b0149868ae8841184c1b7e95ee7d58e0547d6a9..be593a33a1bff7bbc04c9948759d1552ff6d4540 100644 (file)
@@ -5,6 +5,8 @@
        
 2003-07-28  Jean-Marc Lasgouttes  <lasgouttes@lyx.org>
 
+       * insetquotes.C: document a bit the format
+
        * insettabular.C (write): remove extra space
 
 2003-07-28     Martin Vermeer  <martin.vermeer@hut.fi>
index b2196880205a75de8d507c9b7493aa167170edf5..425c89e0ab43fbc8b81708a821290e1ae4c52597 100644 (file)
@@ -37,7 +37,15 @@ using std::auto_ptr;
 
 namespace {
 
-// codes used to read/write quotes to LyX files
+/* codes used to read/write quotes to LyX files
+ * e    ``english''
+ * s    ''spanish''
+ * g    ,,german``
+ * p    ,,polish''
+ * f    <<french>>
+ * a    >>danish<<
+ */
+
 char const * const language_char = "esgpfa";
 char const * const side_char = "lr" ;
 char const * const times_char = "sd";
index f7eff69173c93651ab23f146a20fcfdfc5a7b23d..bbcc70fa6d06120bd8191a493437f2c4440e6a48 100644 (file)
@@ -1,3 +1,11 @@
+2003-07-28  Jean-Marc Lasgouttes  <lasgouttes@lyx.org>
+
+       * text.C:
+       * tex2lyx.C:
+       * preamble.C:
+       * table.C: \begin_layout -> \layout. We are not quite ready for
+       that yet
+
 2003-07-28  José Matos  <jamatos@lyx.org>
 
        * text.C:
@@ -8,7 +16,10 @@
 2003-07-28  Jean-Marc Lasgouttes  <lasgouttes@lyx.org>
 
        * text.C (parse_text): read environment from layout file too. Now,
-       all layout entries are supported (but many hacks remain)
+       all layout entries are supported (but many hacks remain); note
+       that the nesting support is broken and will have to be completely
+       redone
+       (parse_text): basic support for english double quotes
 
        * table.C (handle_tabular): make the output more similar to LyX
        and fix a little
index bdcafa22eb6327c7361daa0d44f23ed99dd8c2a2..bf262641db72c20ff34f3d15dee31d1508b7a526 100644 (file)
@@ -135,7 +135,7 @@ void handle_package(string const & name, string const & options)
 
 
 
-void end_preamble(ostream & os, LyXTextClass const & textclass)
+void end_preamble(ostream & os, LyXTextClass const & /*textclass*/)
 {
        os << "# tex2lyx 0.0.3 created this file\n"
           << "\\lyxformat 224\n"
@@ -166,7 +166,7 @@ void end_preamble(ostream & os, LyXTextClass const & textclass)
           << "\\papersides " << h_papersides << "\n"
           << "\\paperpagestyle " << h_paperpagestyle << "\n"
           << "\\tracking_changes " << h_tracking_changes << "\n"
-          << "\\end_header\n\n\\begin_layout Standard\n";
+          << "\\end_header\n\n\\layout Standard\n";
 }
 
 
index cf3d0cbfa9db4bf1f2dc35c6e40cd60b9fe51dc3..0d00c8e4fb397c5c3899206abdd86c75ad308097 100644 (file)
@@ -490,7 +490,7 @@ void handle_tabular(Parser & p, ostream & os,
                        os << " usebox=\"none\""
                           << ">"
                           << "\n\\begin_inset Text"
-                          << "\n\n\\begin_layout Standard\n\n"
+                          << "\n\n\\layout Standard\n\n"
                           << cell.content
                           << "\n\\end_inset \n"
                           << "</cell>\n";
index ddfdd110836125d09764b948945aeb4163517d08..9412dfec02410764b00a3186c848d9fd90fc6599 100644 (file)
@@ -121,7 +121,7 @@ void clean_layouts(istream & is, ostream & os)
        bool eating = false;
        while (getline(is, line)) {
                string tline = trim(line, " ");
-               if (line.substr(0, 8) == "\\begin_layout ") {
+               if (line.substr(0, 8) == "\\layout ") {
                        //cerr << "layout: " << line << "\n";
                        last = line;
                        eating = true;
index 10bc1a911ef9bd3767d33cff23e66ceabdab9c48..ffb9dc8f56937f080417bdf1092781f92af85673 100644 (file)
@@ -100,7 +100,7 @@ void skip_braces(Parser & p)
 void handle_ert(ostream & os, string const & s)
 {
        begin_inset(os, "ERT");
-       os << "\nstatus Collapsed\n\n\\begin_layout Standard\n\n";
+       os << "\nstatus Collapsed\n\n\\layout Standard\n\n";
        for (string::const_iterator it = s.begin(), et = s.end(); it != et; ++it) {
                if (*it == '\\')
                        os << "\n\\backslash \n";
@@ -115,7 +115,7 @@ void handle_par(ostream & os)
 {
        if (active_environments.empty())
                return;
-       os << "\n\\begin_layout ";
+       os << "\n\\layout ";
        string s = active_environment();
        if (s == "document" || s == "table")
                os << "Standard\n\n";
@@ -156,19 +156,19 @@ void output_layout(ostream & os, LyXLayout_ptr const & layout_ptr,
                  Parser & p, bool outer, LyXTextClass const & textclass)
 {
        string name = layout_ptr->name();
-       os << "\n\n\\begin_layout " << name << "\n\n";
+       os << "\n\n\\layout " << name << "\n\n";
        if (layout_ptr->optionalargs > 0) {
                string s; 
                if (p.next_token().character() == '[') {
                        p.get_token(); // eat '['
                        begin_inset(os, "OptArg\n");
-                       os << "collapsed true\n\n\\begin_layout Standard\n\n";
+                       os << "collapsed true\n\n\\layout Standard\n\n";
                        parse_text(p, os, FLAG_BRACK_LAST, outer, textclass);
                        end_inset(os);
                }
        }
        parse_text(p, os, FLAG_ITEM, outer, textclass);
-       os << "\n\n\\begin_layout Standard\n\n";
+       os << "\n\n\\layout Standard\n\n";
 }
 
 } // anonymous namespace
@@ -230,6 +230,28 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
                else if (t.cat() == catSuper || t.cat() == catSub)
                        cerr << "catcode " << t << " illegal in text mode\n";
 
+               // Basic support for english quotes. This should be
+               // extended to other quotes, but is not so easy (a
+               // left english quote is the same as a right german
+               // quote...)
+               else if (t.asInput() == "`" 
+                        && p.next_token().asInput() == "`") {
+                       begin_inset(os, "Quotes ");
+                       os << "eld";
+                       end_inset(os);
+                       p.get_token();
+                       skip_braces(p);
+               }       
+               else if (t.asInput() == "'" 
+                        && p.next_token().asInput() == "'") {
+                       begin_inset(os, "Quotes ");
+                       os << "erd";
+                       end_inset(os);
+                       p.get_token();
+                       skip_braces(p);
+               }       
+
+
                else if (t.cat() == catLetter ||
                               t.cat() == catSpace ||
                               t.cat() == catOther ||
@@ -327,7 +349,7 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
                                }
                                os << "wide " << tostr(is_starred)
                                   << "\ncollapsed false\n\n"
-                                  << "\\begin_layout Standard\n";
+                                  << "\\layout Standard\n";
                                parse_text(p, os, FLAG_END, outer,
                                           textclass);
                                end_inset(os);
@@ -344,7 +366,7 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
                                        || s == "lyxlist";
                                if (deeper)
                                        os << "\n\\begin_deeper";
-                               os << "\n\\begin_layout " << layout_ptr->name() 
+                               os << "\n\\layout " << layout_ptr->name() 
                                   << "\n\n";
                                switch (layout_ptr->latextype) {
                                case  LATEX_LIST_ENVIRONMENT:
@@ -438,7 +460,7 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
                
                else if (t.cs() == "footnote") {
                        begin_inset(os, "Foot\n");
-                       os << "collapsed true\n\n\\begin_layout Standard\n\n";
+                       os << "collapsed true\n\n\\layout Standard\n\n";
                        parse_text(p, os, FLAG_ITEM, false, textclass);
                        end_inset(os);
                }
@@ -453,7 +475,7 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
 
                else if (t.cs() == "marginpar") {
                        begin_inset(os, "Marginal\n");
-                       os << "collapsed true\n\n\\begin_layout Standard\n\n";
+                       os << "collapsed true\n\n\\layout Standard\n\n";
                        parse_text(p, os, FLAG_ITEM, false, textclass);
                        end_inset(os);
                }
@@ -523,7 +545,7 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
                }
 
                else if (t.cs() == "bibitem") {
-                       os << "\n\\begin_layout Bibliography\n\\bibitem ";
+                       os << "\n\\layout Bibliography\n\\bibitem ";
                        os << p.getOpt();
                        os << '{' << p.verbatim_item() << '}' << "\n";
                }