mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
Fix bug #5716.
Since separators are not allowed by the current .lyx version written by tex2lyx, an empty note is used instead. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36838 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
aec686905b
commit
e693a60c34
@ -489,7 +489,7 @@ void end_preamble(ostream & os, TextClass const & /*textclass*/)
|
||||
|
||||
// output the LyX file settings
|
||||
os << "#LyX file created by tex2lyx " << PACKAGE_VERSION << "\n"
|
||||
<< "\\lyxformat 264\n"
|
||||
<< "\\lyxformat " << LYX_FORMAT << '\n'
|
||||
<< "\\begin_document\n"
|
||||
<< "\\begin_header\n"
|
||||
<< "\\textclass " << h_textclass << "\n";
|
||||
|
@ -91,6 +91,15 @@ We can also nest enumerations
|
||||
\end{enumerate}
|
||||
\item Item2
|
||||
\end{enumerate}
|
||||
\begin{enumerate}
|
||||
\item Item1 (appears as Item3 with bug 5716)
|
||||
|
||||
Normal paragraph in Item1
|
||||
|
||||
\begin{enumerate}
|
||||
\item Item1.a
|
||||
\end{enumerate}
|
||||
\end{enumerate}
|
||||
|
||||
Let's see what happens when normal paragraphs are inserted in lists:
|
||||
|
||||
|
@ -113,6 +113,8 @@ extern CommandMap known_environments;
|
||||
extern CommandMap known_math_environments;
|
||||
///
|
||||
extern bool noweb_mode;
|
||||
/// LyX format that is created by tex2lyx
|
||||
int const LYX_FORMAT = 264;
|
||||
|
||||
/// path of the master .tex file
|
||||
extern std::string getMasterFilePath();
|
||||
|
@ -715,7 +715,7 @@ void parse_unknown_environment(Parser & p, string const & name, ostream & os,
|
||||
|
||||
|
||||
void parse_environment(Parser & p, ostream & os, bool outer,
|
||||
Context & parent_context)
|
||||
string & last_env, Context & parent_context)
|
||||
{
|
||||
Layout const * newlayout;
|
||||
string const name = p.getArg('{', '}');
|
||||
@ -862,6 +862,28 @@ void parse_environment(Parser & p, ostream & os, bool outer,
|
||||
context.need_end_deeper = true;
|
||||
}
|
||||
parent_context.check_end_layout(os);
|
||||
if (last_env == name) {
|
||||
// we need to output a separator since LyX would export
|
||||
// the two environments as one otherwise (bug 5716)
|
||||
docstring const sep = from_ascii("--Separator--");
|
||||
TeX2LyXDocClass const & textclass(parent_context.textclass);
|
||||
if (LYX_FORMAT >= 273 && textclass.hasLayout(sep)) {
|
||||
Context newcontext(parent_context);
|
||||
newcontext.layout = &(textclass[sep]);
|
||||
newcontext.check_layout(os);
|
||||
newcontext.check_end_layout(os);
|
||||
} else {
|
||||
parent_context.check_layout(os);
|
||||
begin_inset(os, "Note Note\n");
|
||||
os << "status closed\n";
|
||||
Context newcontext(true, textclass,
|
||||
&(textclass.defaultLayout()));
|
||||
newcontext.check_layout(os);
|
||||
newcontext.check_end_layout(os);
|
||||
end_inset(os);
|
||||
parent_context.check_end_layout(os);
|
||||
}
|
||||
}
|
||||
switch (context.layout->latextype) {
|
||||
case LATEX_LIST_ENVIRONMENT:
|
||||
context.add_par_extra_stuff("\\labelwidthstring "
|
||||
@ -936,6 +958,7 @@ void parse_environment(Parser & p, ostream & os, bool outer,
|
||||
parse_unknown_environment(p, name, os, FLAG_END, outer,
|
||||
parent_context);
|
||||
|
||||
last_env = name;
|
||||
active_environments.pop_back();
|
||||
}
|
||||
|
||||
@ -1145,6 +1168,7 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
|
||||
string bibliographystyle;
|
||||
bool const use_natbib = used_packages.find("natbib") != used_packages.end();
|
||||
bool const use_jurabib = used_packages.find("jurabib") != used_packages.end();
|
||||
string last_env;
|
||||
while (p.good()) {
|
||||
Token const & t = p.get_token();
|
||||
|
||||
@ -1173,6 +1197,12 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
|
||||
if (t.character() == '}' && (flags & FLAG_BRACE_LAST))
|
||||
return;
|
||||
|
||||
// If there is anything between \end{env} and \begin{env} we
|
||||
// don't need to output a separator.
|
||||
if (t.cat() != catSpace && t.cat() != catNewline &&
|
||||
t.asInput() != "\\begin")
|
||||
last_env = "";
|
||||
|
||||
//
|
||||
// cat codes
|
||||
//
|
||||
@ -1417,7 +1447,7 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
|
||||
}
|
||||
|
||||
else if (t.cs() == "begin")
|
||||
parse_environment(p, os, outer, context);
|
||||
parse_environment(p, os, outer, last_env, context);
|
||||
|
||||
else if (t.cs() == "end") {
|
||||
if (flags & FLAG_END) {
|
||||
|
Loading…
Reference in New Issue
Block a user