X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ftex2lyx%2Ftext.cpp;h=7f633f4a04623915658616a44d54907a5e1a6dc8;hb=87944eedc77693238343103138c91ac7e2faab8f;hp=c3457fb8f14f264cf667c9d06d0c4457b42b86e6;hpb=d8e5e1369064cbc2953cdaf83e581423b2341616;p=lyx.git diff --git a/src/tex2lyx/text.cpp b/src/tex2lyx/text.cpp index c3457fb8f1..7f633f4a04 100644 --- a/src/tex2lyx/text.cpp +++ b/src/tex2lyx/text.cpp @@ -41,10 +41,15 @@ namespace lyx { void parse_text_in_inset(Parser & p, ostream & os, unsigned flags, bool outer, - Context const & context) + Context const & context, InsetLayout const * layout) { + bool const forcePlainLayout = + layout ? layout->forcePlainLayout() : false; Context newcontext(true, context.textclass); - newcontext.font = context.font; + if (forcePlainLayout) + newcontext.layout = &context.textclass.plainLayout(); + else + newcontext.font = context.font; parse_text(p, os, flags, outer, newcontext); newcontext.check_end_layout(os); } @@ -52,6 +57,17 @@ void parse_text_in_inset(Parser & p, ostream & os, unsigned flags, bool outer, namespace { +void parse_text_in_inset(Parser & p, ostream & os, unsigned flags, bool outer, + Context const & context, string const & name) +{ + InsetLayout const * layout = 0; + DocumentClass::InsetLayouts::const_iterator it = + context.textclass.insetLayouts().find(from_ascii(name)); + if (it != context.textclass.insetLayouts().end()) + layout = &(it->second); + parse_text_in_inset(p, os, flags, outer, context, layout); +} + /// parses a paragraph snippet, useful for example for \\emph{...} void parse_text_snippet(Parser & p, ostream & os, unsigned flags, bool outer, Context & context) @@ -2419,7 +2435,7 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer, context.check_layout(os); begin_inset(os, "Index\n"); os << "status collapsed\n"; - parse_text_in_inset(p, os, FLAG_ITEM, false, context); + parse_text_in_inset(p, os, FLAG_ITEM, false, context, "Index"); end_inset(os); } @@ -2457,14 +2473,6 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer, skip_spaces_braces(p); } - else if (t.cs() == "url") { - context.check_layout(os); - begin_inset(os, "Flex URL\n"); - os << "status collapsed\n"; - parse_text_in_inset(p, os, FLAG_ITEM, false, context); - end_inset(os); - } - else if (LYX_FORMAT >= 408 && (t.cs() == "textsuperscript" || t.cs() == "textsubscript")) { context.check_layout(os); @@ -3149,7 +3157,7 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer, begin_inset(os, "Flex "); os << to_utf8(newinsetlayout->name()) << '\n' << "status collapsed\n"; - parse_text_in_inset(p, os, FLAG_ITEM, false, context); + parse_text_in_inset(p, os, FLAG_ITEM, false, context, newinsetlayout); end_inset(os); }