]> git.lyx.org Git - lyx.git/blobdiff - src/tex2lyx/text.C
* support/qstring_helpers.h: erase ucs4_to_qstring() method.
[lyx.git] / src / tex2lyx / text.C
index 8b169b2167ed72817fb63c9f8efd730378fe5e01..d28fdea83bc4c58cec6b3edf4510df10cff40df2 100644 (file)
@@ -1055,7 +1055,13 @@ void parse_noweb(Parser & p, ostream & os, Context & context)
                return;
        }
 
-       context.check_end_layout(os);
+       // We use new_paragraph instead of check_end_layout because the stuff
+       // following the noweb chunk needs to start with a \begin_layout.
+       // This may create a new paragraph even if there was none in the
+       // noweb file, but the alternative is an invalid LyX file. Since
+       // noweb code chunks are implemented with a layout style in LyX they
+       // always must be in an own paragraph.
+       context.new_paragraph(os);
        Context newcontext(true, context.textclass, context.textclass["Scrap"]);
        newcontext.check_layout(os);
        os << name;
@@ -2094,9 +2100,16 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
                         || t.cs() == "'" || t.cs() == "`"
                         || t.cs() == "~" || t.cs() == "." || t.cs() == "=") {
                        // we need the trim as the LyX parser chokes on such spaces
+                       // The argument of InsetLatexAccent is parsed as a
+                       // subset of LaTeX, so don't parse anything here,
+                       // but use the raw argument.
+                       // Otherwise we would convert \~{\i} wrongly.
+                       // This will of course not translate \~{\ss} to \~{ß},
+                       // but that does at least compile and does only look
+                       // strange on screen.
                        context.check_layout(os);
                        os << "\\i \\" << t.cs() << "{"
-                          << trim(parse_text_snippet(p, FLAG_ITEM, outer, context), " ")
+                          << trim(p.verbatim_item(), " ")
                           << "}\n";
                }