char const * const known_ref_commands[] = { "ref", "pageref", "vref",
"vpageref", "prettyref", "eqref", 0 };
+char const * const known_coded_ref_commands[] = { "ref", "pageref", "vref",
+ "vpageref", "formatted", "eqref", 0 };
+
/*!
* natbib commands.
* The starred forms are also known except for "citefullauthor",
char const * const known_tex_extensions[] = {"tex", 0};
/// spaces known by InsetSpace
-char const * const known_spaces[] = { " ", "space", ",", "thinspace", "quad",
-"qquad", "enspace", "enskip", "negthinspace", "hfill", "dotfill", "hrulefill",
-"leftarrowfill", "rightarrowfill", "upbracefill", "downbracefill", 0};
+char const * const known_spaces[] = { " ", "space", ",",
+"thinspace", "quad", "qquad", "enspace", "enskip",
+"negthinspace", "negmedspace", "negthickspace", "textvisiblespace",
+"hfill", "dotfill", "hrulefill", "leftarrowfill", "rightarrowfill",
+"upbracefill", "downbracefill", 0};
/// the same as known_spaces with .lyx names
char const * const known_coded_spaces[] = { "space{}", "space{}",
"thinspace{}", "thinspace{}", "quad{}", "qquad{}", "enspace{}", "enskip{}",
-"negthinspace{}", "hfill{}", "dotfill{}", "hrulefill{}", "leftarrowfill{}",
-"rightarrowfill{}", "upbracefill{}", "downbracefill{}", 0};
+"negthinspace{}", "negmedspace{}", "negthickspace{}", "textvisiblespace{}",
+"hfill{}", "dotfill{}", "hrulefill{}", "leftarrowfill{}", "rightarrowfill{}",
+"upbracefill{}", "downbracefill{}", 0};
/// These are translated by LyX to commands like "\\LyX{}", so we have to put
/// them in ERT. "LaTeXe" must come before "LaTeX"!
Context context(true, parent_context.textclass);
context.font = parent_context.font;
+ // FIXME, the inset layout should be plain, not standard, see bug #7846
+
// If we have no inner box the contens will be read with the outer box
if (!inner_type.empty())
parse_text(p, os, inner_flags, outer, context);
p.skip_spaces();
}
+ else if (unstarred_name == "sidewaysfigure"
+ || unstarred_name == "sidewaystable") {
+ eat_whitespace(p, os, parent_context, false);
+ parent_context.check_layout(os);
+ if (unstarred_name == "sidewaysfigure")
+ begin_inset(os, "Float figure\n");
+ else
+ begin_inset(os, "Float table\n");
+ os << "wide " << convert<string>(is_starred)
+ << "\nsideways true"
+ << "\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 == "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);
os << subst(t.asInput(), "\\", "\n\\backslash\n");
else {
ostringstream oss;
- begin_inset(oss, "Newline newline");
- end_inset(oss);
+ Context tmp(false, context.textclass,
+ &context.textclass[from_ascii("Scrap")]);
+ tmp.need_end_layout = true;
+ tmp.check_layout(oss);
os << subst(t.asInput(), "\n", oss.str());
}
// The scrap chunk is ended by an @ at the beginning of a line.
os << "\n\\bar default\n";
}
- else if (t.cs() == "emph" || t.cs() == "noun") {
+ else if (t.cs() == "sout") {
+ context.check_layout(os);
+ os << "\n\\strikeout on\n";
+ parse_text_snippet(p, os, FLAG_ITEM, outer, context);
+ context.check_layout(os);
+ os << "\n\\strikeout default\n";
+ }
+
+ else if (t.cs() == "uuline" || t.cs() == "uwave" ||
+ t.cs() == "emph" || t.cs() == "noun") {
context.check_layout(os);
os << "\n\\" << t.cs() << " on\n";
parse_text_snippet(p, os, FLAG_ITEM, outer, context);
os << "\n\\" << t.cs() << " default\n";
}
+ // FIXME, the inset layout should be plain, not standard, see bug #7846
+ else if (t.cs() == "phantom" || t.cs() == "hphantom" ||
+ t.cs() == "vphantom") {
+ context.check_layout(os);
+ if (t.cs() == "phantom")
+ begin_inset(os, "Phantom Phantom\n");
+ if (t.cs() == "hphantom")
+ begin_inset(os, "Phantom HPhantom\n");
+ if (t.cs() == "vphantom")
+ 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)
p.getArg('{', '}');
end_inset(os);
}
+ else if (t.cs() == "rule") {
+ 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())
+ os << "offset \"" << translate_len(offset) << "\"\n";
+ os << "width \"" << translate_len(width) << "\"\n"
+ "height \"" << translate_len(thickness) << "\"\n";
+ end_inset(os);
+ }
+
else if (is_known(t.cs(), known_phrases) ||
(t.cs() == "protect" &&
p.next_token().cat() == catEscape &&
string const opt = p.getOpt();
if (opt.empty()) {
context.check_layout(os);
- begin_command_inset(os, "ref", t.cs());
+ char const * const * where = is_known(t.cs(),
+ known_ref_commands);
+ begin_command_inset(os, "ref",
+ known_coded_ref_commands[where - known_ref_commands]);
os << "reference \""
<< convert_command_inset_arg(p.verbatim_item())
<< "\"\n";
}
else if (t.cs() == "printnomenclature") {
+ string width = "";
+ string width_type = "";
context.check_layout(os);
begin_command_inset(os, "nomencl_print", "printnomenclature");
+ // case of a custom width
+ if (p.hasOpt()) {
+ width = p.getArg('[', ']');
+ width = translate_len(width);
+ width_type = "custom";
+ }
+ // case of no custom width
+ // the case of no custom width but the width set
+ // via \settowidth{\nomlabelwidth}{***} cannot be supported
+ // because the user could have set anything, not only the width
+ // of the longest label (which would be width_type = "auto")
+ string label = convert_command_inset_arg(p.getArg('{', '}'));
+ if (label.empty() && width_type.empty())
+ width_type = "none";
+ os << "set_width \"" << width_type << "\"\n";
+ if (width_type == "custom")
+ os << "width \"" << width << '\"';
end_inset(os);
skip_spaces_braces(p);
}
- else if (LYX_FORMAT >= 408 &&
- (t.cs() == "textsuperscript" || t.cs() == "textsubscript")) {
+ else if ((t.cs() == "textsuperscript" || t.cs() == "textsubscript")) {
context.check_layout(os);
begin_inset(os, "script ");
os << t.cs().substr(4) << '\n';