mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-03 16:31:13 +00:00
tex2lyx: support for fileformat 257: command inset instead of layout inset for captions
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@30098 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
f1a2bf1c66
commit
14021f7233
@ -458,7 +458,7 @@ void handle_package(Parser &p, string const & name, string const & opts,
|
|||||||
void end_preamble(ostream & os, TextClass const & /*textclass*/)
|
void end_preamble(ostream & os, TextClass const & /*textclass*/)
|
||||||
{
|
{
|
||||||
os << "#LyX file created by tex2lyx " << PACKAGE_VERSION << "\n"
|
os << "#LyX file created by tex2lyx " << PACKAGE_VERSION << "\n"
|
||||||
<< "\\lyxformat 256\n"
|
<< "\\lyxformat 257\n"
|
||||||
<< "\\begin_document\n"
|
<< "\\begin_document\n"
|
||||||
<< "\\begin_header\n"
|
<< "\\begin_header\n"
|
||||||
<< "\\textclass " << h_textclass << "\n";
|
<< "\\textclass " << h_textclass << "\n";
|
||||||
|
@ -439,20 +439,6 @@ Layout const * findLayout(TextClass const & textclass, string const & name)
|
|||||||
void eat_whitespace(Parser &, ostream &, Context &, bool);
|
void eat_whitespace(Parser &, ostream &, Context &, bool);
|
||||||
|
|
||||||
|
|
||||||
Layout * captionlayout()
|
|
||||||
{
|
|
||||||
static Layout * lay = 0;
|
|
||||||
if (!lay) {
|
|
||||||
lay = new Layout;
|
|
||||||
lay->setName(from_ascii("Caption"));
|
|
||||||
lay->setLatexName("caption");
|
|
||||||
lay->latextype = LATEX_COMMAND;
|
|
||||||
lay->optionalargs = 1;
|
|
||||||
}
|
|
||||||
return lay;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void output_command_layout(ostream & os, Parser & p, bool outer,
|
void output_command_layout(ostream & os, Parser & p, bool outer,
|
||||||
Context & parent_context,
|
Context & parent_context,
|
||||||
Layout const * newlayout)
|
Layout const * newlayout)
|
||||||
@ -1586,13 +1572,28 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
|
|||||||
p.skip_spaces();
|
p.skip_spaces();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Special handling for \caption
|
else if (t.cs() == "caption") {
|
||||||
// FIXME: remove this when InsetCaption is supported.
|
|
||||||
else if (context.new_layout_allowed &&
|
|
||||||
t.cs() == captionlayout()->latexname()) {
|
|
||||||
output_command_layout(os, p, outer, context,
|
|
||||||
captionlayout());
|
|
||||||
p.skip_spaces();
|
p.skip_spaces();
|
||||||
|
context.check_layout(os);
|
||||||
|
p.skip_spaces();
|
||||||
|
begin_inset(os, "Caption\n\n");
|
||||||
|
os << "\\begin_layout Standard";
|
||||||
|
if (p.next_token().character() == '[') {
|
||||||
|
p.get_token(); // eat '['
|
||||||
|
begin_inset(os, "OptArg\n");
|
||||||
|
os << "status collapsed\n";
|
||||||
|
parse_text_in_inset(p, os, FLAG_BRACK_LAST, outer, context);
|
||||||
|
end_inset(os);
|
||||||
|
eat_whitespace(p, os, context, false);
|
||||||
|
}
|
||||||
|
parse_text(p, os, FLAG_ITEM, outer, context);
|
||||||
|
context.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.
|
||||||
|
context.new_paragraph(os);
|
||||||
|
end_inset(os);
|
||||||
|
p.skip_spaces();
|
||||||
|
os << "\\end_layout\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (t.cs() == "includegraphics") {
|
else if (t.cs() == "includegraphics") {
|
||||||
|
Loading…
Reference in New Issue
Block a user