diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index 1b0149868a..be593a33a1 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -5,6 +5,8 @@ 2003-07-28 Jean-Marc Lasgouttes + * insetquotes.C: document a bit the format + * insettabular.C (write): remove extra space 2003-07-28 Martin Vermeer diff --git a/src/insets/insetquotes.C b/src/insets/insetquotes.C index b219688020..425c89e0ab 100644 --- a/src/insets/insetquotes.C +++ b/src/insets/insetquotes.C @@ -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 <> + * a >>danish<< + */ + char const * const language_char = "esgpfa"; char const * const side_char = "lr" ; char const * const times_char = "sd"; diff --git a/src/tex2lyx/ChangeLog b/src/tex2lyx/ChangeLog index f7eff69173..bbcc70fa6d 100644 --- a/src/tex2lyx/ChangeLog +++ b/src/tex2lyx/ChangeLog @@ -1,3 +1,11 @@ +2003-07-28 Jean-Marc Lasgouttes + + * text.C: + * tex2lyx.C: + * preamble.C: + * table.C: \begin_layout -> \layout. We are not quite ready for + that yet + 2003-07-28 José Matos * text.C: @@ -8,7 +16,10 @@ 2003-07-28 Jean-Marc Lasgouttes * 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 diff --git a/src/tex2lyx/preamble.C b/src/tex2lyx/preamble.C index bdcafa22eb..bf262641db 100644 --- a/src/tex2lyx/preamble.C +++ b/src/tex2lyx/preamble.C @@ -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"; } diff --git a/src/tex2lyx/table.C b/src/tex2lyx/table.C index cf3d0cbfa9..0d00c8e4fb 100644 --- a/src/tex2lyx/table.C +++ b/src/tex2lyx/table.C @@ -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" << "\n"; diff --git a/src/tex2lyx/tex2lyx.C b/src/tex2lyx/tex2lyx.C index ddfdd11083..9412dfec02 100644 --- a/src/tex2lyx/tex2lyx.C +++ b/src/tex2lyx/tex2lyx.C @@ -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; diff --git a/src/tex2lyx/text.C b/src/tex2lyx/text.C index 10bc1a911e..ffb9dc8f56 100644 --- a/src/tex2lyx/text.C +++ b/src/tex2lyx/text.C @@ -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"; }