Parse starred InsetLayout correctly

Previously, an InsetLayout was not found if the LaTeX name was starred, e.g.
for "\caption*".
This commit is contained in:
Georg Baum 2014-12-26 21:01:08 +01:00
parent 614862fccc
commit 0c90821138

View File

@ -2268,6 +2268,8 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
// //
// cat codes // cat codes
// //
bool const starred = p.next_token().asInput() == "*";
string const starredname(starred ? (t.cs() + '*') : t.cs());
if (t.cat() == catMath) { if (t.cat() == catMath) {
// we are inside some text mode thingy, so opening new math is allowed // we are inside some text mode thingy, so opening new math is allowed
context.check_layout(os); context.check_layout(os);
@ -2824,11 +2826,8 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
else if (t.cs() == "caption" || t.cs() == "captionabove" || else if (t.cs() == "caption" || t.cs() == "captionabove" ||
t.cs() == "captionbelow") { t.cs() == "captionbelow") {
bool starred = false; if (starred)
if (p.next_token().asInput() == "*") {
p.get_token(); p.get_token();
starred = true;
}
p.skip_spaces(); p.skip_spaces();
context.check_layout(os); context.check_layout(os);
p.skip_spaces(); p.skip_spaces();
@ -4336,11 +4335,8 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
} }
else if (t.cs() == "hspace" || t.cs() == "vspace") { else if (t.cs() == "hspace" || t.cs() == "vspace") {
bool starred = false; if (starred)
if (p.next_token().asInput() == "*") {
p.get_token(); p.get_token();
starred = true;
}
string name = t.asInput(); string name = t.asInput();
string const length = p.verbatim_item(); string const length = p.verbatim_item();
string unit; string unit;
@ -4474,7 +4470,9 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
} }
// The single '=' is meant here. // The single '=' is meant here.
else if ((newinsetlayout = findInsetLayout(context.textclass, t.cs(), true))) { else if ((newinsetlayout = findInsetLayout(context.textclass, starredname, true))) {
if (starred)
p.get_token();
p.skip_spaces(); p.skip_spaces();
context.check_layout(os); context.check_layout(os);
begin_inset(os, "Flex "); begin_inset(os, "Flex ");