/**
- * \file text.C
+ * \file tex2lyx/text.C
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
using std::cerr;
using std::endl;
+
using std::map;
using std::ostream;
using std::ostringstream;
return len;
}
-
+
void begin_inset(ostream & os, string const & name)
{
os << "\n\\begin_inset " << name;
LyXLayout_ptr findLayout(LyXTextClass const & textclass,
- string const & name)
+ string const & name)
{
LyXTextClass::const_iterator it = textclass.begin();
LyXTextClass::const_iterator end = textclass.end();
context.check_deeper(os);
context.check_layout(os);
if (context.layout->optionalargs > 0) {
- string s;
+ string s;
if (p.next_token().character() == '[') {
p.get_token(); // eat '['
begin_inset(os, "OptArg\n");
}
if (p.next_token().asInput() == "[") {
height = translate_len(p.getArg('[', ']'));
-
+
if (p.next_token().asInput() == "[") {
switch(p.getArg('[', ']')[0]) {
case 't': inner_pos = "0"; break;
flags |= FLAG_LEAVE;
}
- if (t.character() == ']' && (flags & FLAG_BRACK_LAST))
+ if (t.character() == ']' && (flags & FLAG_BRACK_LAST))
return;
//
// extended to other quotes, but is not so easy (a
// left english quote is the same as a right german
// quote...)
- else if (t.asInput() == "`"
+ else if (t.asInput() == "`"
&& p.next_token().asInput() == "`") {
context.check_layout(os);
begin_inset(os, "Quotes ");
end_inset(os);
p.get_token();
skip_braces(p);
- }
- else if (t.asInput() == "'"
+ }
+ else if (t.asInput() == "'"
&& p.next_token().asInput() == "'") {
context.check_layout(os);
begin_inset(os, "Quotes ");
end_inset(os);
p.get_token();
skip_braces(p);
- }
+ }
else if (t.cat() == catLetter ||
if (t.character() == '~') {
if (context.layout->free_spacing)
os << ' ';
- else
+ else
os << "\\InsetSpace ~\n";
} else
os << t.character();
}
else if (t.cat() == catBegin) {
-// FIXME???
+// FIXME???
// special handling of size changes
context.check_layout(os);
bool const is_size = is_known(p.next_token().cs(), known_sizes);
else if (t.cs() == "item") {
// should be done automatically by Parser::tokenize
//p.skip_spaces();
- string s;
+ string s;
if (p.next_token().character() == '[') {
p.get_token(); // eat '['
Context newcontext(false, context.textclass);
else if (t.cs() == "includegraphics") {
map<string, string> opts = split_map(p.getArg('[', ']'));
string name = p.verbatim_item();
-
+
context.check_layout(os);
begin_inset(os, "Graphics ");
os << "\n\tfilename " << name << '\n';
<< translate_len(opts["height"]) << '\n';
end_inset(os);
}
-
+
else if (t.cs() == "footnote") {
context.check_layout(os);
begin_inset(os, "Foot\n");
os << name << "\n";
end_inset(os);
p.get_token(); // swallow second arg
- } else
+ } else
handle_ert(os, "\\listof{" + name + "}", context);
}
os << "\n\\size " << known_coded_sizes[where - known_sizes] << "\n";
}
- else if (t.cs() == "LyX" || t.cs() == "TeX"
+ else if (t.cs() == "LyX" || t.cs() == "TeX"
|| t.cs() == "LaTeX") {
context.check_layout(os);
os << t.cs();
skip_braces(p);
}
- else if (t.cs() == "_" || t.cs() == "&" || t.cs() == "#"
- || t.cs() == "$" || t.cs() == "{" || t.cs() == "}"
+ else if (t.cs() == "_" || t.cs() == "&" || t.cs() == "#"
+ || t.cs() == "$" || t.cs() == "{" || t.cs() == "}"
|| t.cs() == "%") {
context.check_layout(os);
os << t.cs();
os << "\n\\newline \n";
}
}
-
+
else if (t.cs() == "input" || t.cs() == "include"
|| t.cs() == "verbatiminput") {
string name = '\\' + t.cs();
if (t.cs() == "verbatiminput"
- && p.next_token().asInput() == "*")
+ && p.next_token().asInput() == "*")
name += p.get_token().asInput();
context.check_layout(os);
begin_inset(os, "Include ");