#include <config.h>
#include "Layout.h"
-#include "Encoding.h"
#include "FontInfo.h"
#include "Language.h"
#include "Lexer.h"
LT_FREE_SPACING,
LT_PASS_THRU,
LT_PARBREAK_IS_NEWLINE,
+ LT_ITEMCOMMAND,
LT_ITEMSEP,
LT_KEEPEMPTY,
LT_LABEL_BOTTOMSEP,
htmlforcecss_ = false;
htmltitle_ = false;
spellcheck = true;
+ itemcommand_ = "item";
}
{ "innertag", LT_INNERTAG },
{ "inpreamble", LT_INPREAMBLE },
{ "intitle", LT_INTITLE },
+ { "itemcommand", LT_ITEMCOMMAND },
{ "itemsep", LT_ITEMSEP },
{ "itemtag", LT_ITEMTAG },
{ "keepempty", LT_KEEPEMPTY },
if (reset) {
latexargs_.clear();
itemargs_.clear();
+ postcommandargs_.clear();
}
break;
lex >> itemtag_;
break;
+ case LT_ITEMCOMMAND:
+ lex >> itemcommand_;
+ break;
+
case LT_PREAMBLE:
preamble_ = from_utf8(lex.getLongString("EndPreamble"));
break;
enum {
LA_NO_LABEL = 1,
LA_MANUAL,
- LA_TOP_ENVIRONMENT,
- LA_CENTERED_TOP_ENVIRONMENT,
+ LA_ABOVE,
+ LA_CENTERED,
LA_STATIC,
LA_SENSITIVE,
- LA_COUNTER,
LA_ENUMERATE,
LA_ITEMIZE,
LA_BIBLIO
LexerKeyword labelTypeTags[] = {
- { "bibliography", LA_BIBLIO },
- { "centered_top_environment", LA_CENTERED_TOP_ENVIRONMENT },
- { "counter", LA_COUNTER },
- { "enumerate", LA_ENUMERATE },
- { "itemize", LA_ITEMIZE },
- { "manual", LA_MANUAL },
- { "no_label", LA_NO_LABEL },
- { "sensitive", LA_SENSITIVE },
- { "static", LA_STATIC },
- { "top_environment", LA_TOP_ENVIRONMENT }
+ { "above", LA_ABOVE },
+ { "bibliography", LA_BIBLIO },
+ { "centered", LA_CENTERED },
+ { "enumerate", LA_ENUMERATE },
+ { "itemize", LA_ITEMIZE },
+ { "manual", LA_MANUAL },
+ { "no_label", LA_NO_LABEL },
+ { "sensitive", LA_SENSITIVE },
+ { "static", LA_STATIC }
};
PushPopHelper pph(lex, labelTypeTags);
case LA_MANUAL:
labeltype = LABEL_MANUAL;
break;
- case LA_TOP_ENVIRONMENT:
- labeltype = LABEL_TOP_ENVIRONMENT;
+ case LA_ABOVE:
+ labeltype = LABEL_ABOVE;
break;
- case LA_CENTERED_TOP_ENVIRONMENT:
- labeltype = LABEL_CENTERED_TOP_ENVIRONMENT;
+ case LA_CENTERED:
+ labeltype = LABEL_CENTERED;
break;
case LA_STATIC:
labeltype = LABEL_STATIC;
case LA_SENSITIVE:
labeltype = LABEL_SENSITIVE;
break;
- case LA_COUNTER:
- labeltype = LABEL_COUNTER;
- break;
case LA_ENUMERATE:
labeltype = LABEL_ENUMERATE;
break;
{
latexarg arg;
arg.mandatory = false;
+ arg.autoinsert = false;
bool error = false;
bool finished = false;
arg.font = inherit_font;
string id;
lex >> id;
bool const itemarg = prefixIs(id, "item:");
+ bool const postcmd = prefixIs(id, "post:");
while (!finished && lex.isOK() && !error) {
lex.next();
} else if (tok == "labelstring") {
lex.next();
arg.labelstring = lex.getDocString();
+ } else if (tok == "menustring") {
+ lex.next();
+ arg.menustring = lex.getDocString();
} else if (tok == "mandatory") {
lex.next();
arg.mandatory = lex.getBool();
+ } else if (tok == "autoinsert") {
+ lex.next();
+ arg.autoinsert = lex.getBool();
} else if (tok == "leftdelim") {
lex.next();
arg.ldelim = lex.getDocString();
arg.rdelim = lex.getDocString();
arg.rdelim = support::subst(arg.rdelim, from_ascii("<br/>"),
from_ascii("\n"));
+ } else if (tok == "presetarg") {
+ lex.next();
+ arg.presetarg = lex.getDocString();
} else if (tok == "tooltip") {
lex.next();
arg.tooltip = lex.getDocString();
LYXERR0("Incomplete Argument definition!");
else if (itemarg)
itemargs_[id] = arg;
+ else if (postcmd)
+ postcommandargs_[id] = arg;
else
latexargs_[id] = arg;
}
+Layout::LaTeXArgMap Layout::args() const
+{
+ LaTeXArgMap args = latexargs_;
+ if (!postcommandargs_.empty())
+ args.insert(postcommandargs_.begin(), postcommandargs_.end());
+ if (!itemargs_.empty())
+ args.insert(itemargs_.begin(), itemargs_.end());
+ return args;
+}
+
+
int Layout::optArgs() const
{
int nr = 0;
if (!(*it).second.mandatory)
++nr;
}
+ LaTeXArgMap::const_iterator iit = postcommandargs_.begin();
+ for (; iit != postcommandargs_.end(); ++iit) {
+ if (!(*iit).second.mandatory)
+ ++nr;
+ }
return nr;
}
if ((*it).second.mandatory)
++nr;
}
+ LaTeXArgMap::const_iterator iit = postcommandargs_.begin();
+ for (; iit != postcommandargs_.end(); ++iit) {
+ if (!(*iit).second.mandatory)
+ ++nr;
+ }
return nr;
}
string const & Layout::htmllabeltag() const
{
if (htmllabeltag_.empty()) {
- if (labeltype != LABEL_TOP_ENVIRONMENT &&
- labeltype != LABEL_CENTERED_TOP_ENVIRONMENT)
+ if (labeltype != LABEL_ABOVE &&
+ labeltype != LABEL_CENTERED)
htmllabeltag_ = "span";
else
htmllabeltag_ = "div";
// label font
if (labelfont != font)
labelCSS = labelfont.asCSS() + from_ascii("\n");
- if (labeltype == LABEL_CENTERED_TOP_ENVIRONMENT)
+ if (labeltype == LABEL_CENTERED)
labelCSS += from_ascii("text-align: center;\n");
if (!labelCSS.empty())