p.skip_spaces();
}
+ else if (name == "wrapfigure" || name == "wraptable") {
+ // syntax is \begin{wrapfigure}[lines]{placement}[overhang]{width}
+ eat_whitespace(p, os, parent_context, false);
+ parent_context.check_layout(os);
+ // default values
+ string lines = "0";
+ string overhang = "0col%";
+ // parse
+ if (p.hasOpt())
+ lines = p.getArg('[', ']');
+ string const placement = p.getArg('{', '}');
+ if (p.hasOpt())
+ overhang = p.getArg('[', ']');
+ string const width = p.getArg('{', '}');
+ // write
+ if (name == "wrapfigure")
+ begin_inset(os, "Wrap figure\n");
+ else
+ begin_inset(os, "Wrap table\n");
+ os << "lines " << lines
+ << "\nplacement " << placement
+ << "\noverhang " << lyx::translate_len(overhang)
+ << "\nwidth " << lyx::translate_len(width)
+ << "\nstatus open\n\n";
+ parse_text_in_inset(p, os, FLAG_END, outer, parent_context);
+ end_inset(os);
+ // We don't need really a new paragraph, but
+ // we must make sure that the next item gets a \begin_layout.
+ parent_context.new_paragraph(os);
+ p.skip_spaces();
+ }
+
else if (name == "minipage") {
eat_whitespace(p, os, parent_context, false);
parse_box(p, os, 0, FLAG_END, outer, parent_context, "", "", name);
if (t.cs() == "phantom")
begin_inset(os, "Phantom Phantom\n");
if (t.cs() == "hphantom")
- begin_inset(os, "Phantom Hhantom\n");
+ begin_inset(os, "Phantom HPhantom\n");
if (t.cs() == "vphantom")
- begin_inset(os, "Phantom Vhantom\n");
+ begin_inset(os, "Phantom VPhantom\n");
os << "status open\n";
parse_text_in_inset(p, os, FLAG_ITEM, outer, context);
end_inset(os);
}
+
+ else if (t.cs() == "href") {
+ context.check_layout(os);
+ string target = p.getArg('{', '}');
+ string name = p.getArg('{', '}');
+ string type;
+ size_t i = target.find(':');
+ if (i != string::npos) {
+ type = target.substr(0, i + 1);
+ if (type == "mailto:" || type == "file:")
+ target = target.substr(i + 1);
+ // handle the case that name is equal to target, except of "http://"
+ else if (target.substr(i + 3) == name && type == "http:")
+ target = name;
+ }
+ begin_command_inset(os, "href", "href");
+ if (name != target)
+ os << "name \"" << name << "\"\n";
+ os << "target \"" << target << "\"\n";
+ if (type == "mailto:" || type == "file:")
+ os << "type \"" << type << "\"\n";
+ end_inset(os);
+ skip_spaces_braces(p);
+ }
else if (t.cs() == "lyxline") {
// swallow size argument (it is not used anyway)
}
else if (t.cs() == "rule") {
- string offset = "";
- string width;
- string thickness;
- if (p.hasOpt())
- offset = p.getArg('[', ']');
- width = p.getArg('{', '}');
- thickness = p.getArg('{', '}');
-
+ string const offset = (p.hasOpt() ? p.getArg('[', ']') : string());
+ string const width = p.getArg('{', '}');
+ string const thickness = p.getArg('{', '}');
context.check_layout(os);
begin_command_inset(os, "line", "rule");
if (!offset.empty())