mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-25 10:58:52 +00:00
tex2lyx: fix import of unknown commands'/environments' options
If we detect options via hasOpt(), output the brackets as ERT.
Fixes: #8685
(cherry picked from commit da62299f37
)
This commit is contained in:
parent
93f3727b53
commit
0a89b08f68
@ -1576,6 +1576,14 @@ void parse_unknown_environment(Parser & p, string const & name, ostream & os,
|
||||
if (specialfont)
|
||||
parent_context.new_layout_allowed = false;
|
||||
output_ert_inset(os, "\\begin{" + name + "}", parent_context);
|
||||
// Try to handle options: Look if we have an optional arguments,
|
||||
// and if so, put the brackets in ERT.
|
||||
while (p.hasOpt()) {
|
||||
p.get_token(); // eat '['
|
||||
output_ert_inset(os, "[", parent_context);
|
||||
os << parse_text_snippet(p, FLAG_BRACK_LAST, outer, parent_context);
|
||||
output_ert_inset(os, "]", parent_context);
|
||||
}
|
||||
parse_text_snippet(p, os, flags, outer, parent_context);
|
||||
output_ert_inset(os, "\\end{" + name + "}", parent_context);
|
||||
if (specialfont)
|
||||
@ -5849,8 +5857,18 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
|
||||
p.get_token(); // Eat '*'
|
||||
name += '*';
|
||||
}
|
||||
if (!parse_command(name, p, os, outer, context))
|
||||
if (!parse_command(name, p, os, outer, context)) {
|
||||
output_ert_inset(os, name, context);
|
||||
// Try to handle options of unknown commands:
|
||||
// Look if we have an optional arguments,
|
||||
// and if so, put the brackets in ERT.
|
||||
while (p.hasOpt()) {
|
||||
p.get_token(); // eat '['
|
||||
output_ert_inset(os, "[", context);
|
||||
os << parse_text_snippet(p, FLAG_BRACK_LAST, outer, context);
|
||||
output_ert_inset(os, "]", context);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -99,7 +99,9 @@ What's new
|
||||
- Consider required modules when checking for layout definitions in modules
|
||||
(bug 11156).
|
||||
|
||||
- Fix import of Arabic polyglossia environment (part of bug 10111).
|
||||
- Fix import of Arabic polyglossia environment (part of bug 10111).
|
||||
|
||||
- Fix import of unknown commands'/environments' options (bug 8685).
|
||||
|
||||
|
||||
* ADVANCED FIND AND REPLACE
|
||||
|
Loading…
Reference in New Issue
Block a user