mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 21:21:32 +00:00
tex2lyx: fix subfloat import
Fixes: #10385
(cherry picked from commit 1dcb2a0976
)
This commit is contained in:
parent
566f368885
commit
94fe126161
@ -3176,7 +3176,6 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
|
|||||||
if (t.cs() == "subfloat") {
|
if (t.cs() == "subfloat") {
|
||||||
// the syntax is \subfloat[list entry][sub caption]{content}
|
// the syntax is \subfloat[list entry][sub caption]{content}
|
||||||
// if it is a table of figure depends on the surrounding float
|
// if it is a table of figure depends on the surrounding float
|
||||||
// FIXME: second optional argument is not parsed
|
|
||||||
p.skip_spaces();
|
p.skip_spaces();
|
||||||
// do nothing if there is no outer float
|
// do nothing if there is no outer float
|
||||||
if (!float_type.empty()) {
|
if (!float_type.empty()) {
|
||||||
@ -3195,6 +3194,12 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
|
|||||||
caption = parse_text_snippet(p, FLAG_BRACK_LAST, outer, context);
|
caption = parse_text_snippet(p, FLAG_BRACK_LAST, outer, context);
|
||||||
has_caption = true;
|
has_caption = true;
|
||||||
}
|
}
|
||||||
|
// In case we have two optional args, the second is the caption.
|
||||||
|
if (p.next_token().cat() != catEscape &&
|
||||||
|
p.next_token().character() == '[') {
|
||||||
|
p.get_token(); // eat '['
|
||||||
|
caption = parse_text_snippet(p, FLAG_BRACK_LAST, outer, context);
|
||||||
|
}
|
||||||
// the content
|
// the content
|
||||||
parse_text_in_inset(p, os, FLAG_ITEM, outer, context);
|
parse_text_in_inset(p, os, FLAG_ITEM, outer, context);
|
||||||
// the caption comes always as the last
|
// the caption comes always as the last
|
||||||
@ -3208,31 +3213,25 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
|
|||||||
newcontext.check_layout(os);
|
newcontext.check_layout(os);
|
||||||
os << caption << "\n";
|
os << caption << "\n";
|
||||||
newcontext.check_end_layout(os);
|
newcontext.check_end_layout(os);
|
||||||
// We don't need really a new paragraph, but
|
|
||||||
// we must make sure that the next item gets a \begin_layout.
|
|
||||||
//newcontext.new_paragraph(os);
|
|
||||||
end_inset(os);
|
end_inset(os);
|
||||||
p.skip_spaces();
|
p.skip_spaces();
|
||||||
}
|
|
||||||
// We don't need really a new paragraph, but
|
|
||||||
// we must make sure that the next item gets a \begin_layout.
|
|
||||||
if (has_caption)
|
|
||||||
context.new_paragraph(os);
|
|
||||||
end_inset(os);
|
|
||||||
p.skip_spaces();
|
|
||||||
context.check_end_layout(os);
|
|
||||||
// close the layout we opened
|
// close the layout we opened
|
||||||
if (has_caption)
|
os << "\n\\end_layout";
|
||||||
os << "\n\\end_layout\n";
|
}
|
||||||
|
end_inset(os);
|
||||||
|
p.skip_spaces();
|
||||||
} else {
|
} else {
|
||||||
// if the float type is not supported or there is no surrounding float
|
// if the float type is not supported or there is no surrounding float
|
||||||
// output it as ERT
|
// output it as ERT
|
||||||
|
string opt_arg1;
|
||||||
|
string opt_arg2;
|
||||||
if (p.hasOpt()) {
|
if (p.hasOpt()) {
|
||||||
string opt_arg = convert_command_inset_arg(p.getArg('[', ']'));
|
opt_arg1 = convert_command_inset_arg(p.getFullOpt());
|
||||||
output_ert_inset(os, t.asInput() + '[' + opt_arg +
|
if (p.hasOpt())
|
||||||
"]{" + p.verbatim_item() + '}', context);
|
opt_arg2 = convert_command_inset_arg(p.getFullOpt());
|
||||||
} else
|
}
|
||||||
output_ert_inset(os, t.asInput() + "{" + p.verbatim_item() + '}', context);
|
output_ert_inset(os, t.asInput() + opt_arg1 + opt_arg2
|
||||||
|
+ "{" + p.verbatim_item() + '}', context);
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -97,6 +97,8 @@ What's new
|
|||||||
|
|
||||||
* TEX2LYX
|
* TEX2LYX
|
||||||
|
|
||||||
|
- Fix import of subfloats without caption (bug 10385).
|
||||||
|
|
||||||
- Import straight quotations marks (e.g. babel shorthands) as ERT (bug 75).
|
- Import straight quotations marks (e.g. babel shorthands) as ERT (bug 75).
|
||||||
|
|
||||||
- Consider options passed via \PassOptionsToPackage.
|
- Consider options passed via \PassOptionsToPackage.
|
||||||
|
Loading…
Reference in New Issue
Block a user