+2003-07-27 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
+
+ * text.C (output_layout): fix handling of optional argument
+ (parse_text): small tweaks to make output format closer to lyx format
+
2003-07-27 Angus Leeming <leeming@lyx.org>
* Makefile.am: remove unused graphics_link_files cruft.
2003-07-27 Angus Leeming <leeming@lyx.org>
* Makefile.am: remove unused graphics_link_files cruft.
void end_inset(ostream & os)
{
void end_inset(ostream & os)
{
- os << "\n\\end_inset\n\n";
+ os << "\n\\end_inset \n\n";
string name = layout_ptr->name();
os << "\n\n\\layout " << name << "\n\n";
if (layout_ptr->optionalargs > 0) {
string name = layout_ptr->name();
os << "\n\n\\layout " << name << "\n\n";
if (layout_ptr->optionalargs > 0) {
- string opt = p.getOpt();
- if (opt.size()) {
+ string s;
+ if (p.next_token().character() == '[') {
+ p.get_token(); // eat '['
begin_inset(os, "OptArg\n");
begin_inset(os, "OptArg\n");
- os << "collapsed true\n\n\\layout Standard\n\n" << opt;
+ os << "collapsed true\n\n\\layout Standard\n\n";
+ parse_text(p, os, FLAG_BRACK_LAST, outer, textclass);
else if (t.cs() == "begin") {
string const name = p.getArg('{', '}');
else if (t.cs() == "begin") {
string const name = p.getArg('{', '}');
+ const bool is_starred = suffixIs(name, '*');
+ string const unstarred_name = rtrim(name, "*");
active_environments.push_back(name);
if (is_math_env(name)) {
begin_inset(os, "Formula ");
active_environments.push_back(name);
if (is_math_env(name)) {
begin_inset(os, "Formula ");
parse_math(p, os, FLAG_END, MATH_MODE);
os << "\\end{" << name << "}";
end_inset(os);
parse_math(p, os, FLAG_END, MATH_MODE);
os << "\\end{" << name << "}";
end_inset(os);
- continue;
- }
-
- if (name == "tabular") {
+ } else if (name == "tabular") {
begin_inset(os, "Tabular ");
handle_tabular(p, os, textclass);
end_inset(os);
begin_inset(os, "Tabular ");
handle_tabular(p, os, textclass);
end_inset(os);
- continue;
- }
-
- bool is_starred = suffixIs(name, '*');
- string unstarred_name = rtrim(name, "*");
- if (textclass.floats().typeExist(unstarred_name)) {
- string opts = p.getOpt();
+ } else if (textclass.floats().typeExist(unstarred_name)) {
begin_inset(os, "Float " + unstarred_name + "\n");
begin_inset(os, "Float " + unstarred_name + "\n");
- if (opts.size())
- os << "placement " << opts << '\n';
+ if (p.next_token().asInput() == "[") {
+ os << "placement "
+ << p.getArg('[', ']') << '\n';
+ }
os << "wide " << tostr(is_starred)
<< "\ncollapsed false\n\n"
<< "\\layout Standard\n";
os << "wide " << tostr(is_starred)
<< "\ncollapsed false\n\n"
<< "\\layout Standard\n";
}
else if (t.cs() == "item") {
}
else if (t.cs() == "item") {
+ // should be done automatically by Parser::tokenize
+ //p.skip_spaces();
string s;
if (p.next_token().character() == '[') {
p.get_token(); // eat '['
string s;
if (p.next_token().character() == '[') {
p.get_token(); // eat '['
os << '\\' << t.cs();
os << p.getOpt();
os << p.getOpt();
os << '\\' << t.cs();
os << p.getOpt();
os << p.getOpt();
- os << '{' << p.verbatim_item() << '}';
+ os << '{' << p.verbatim_item() << "}\n";