};
// Keep the changes documented in the Customization manual.
-int const FORMAT = 21;
+int const FORMAT = 26;
bool layout2layout(FileName const & filename, FileName const & tempfile)
}
-std::string translateRT(TextClass::ReadType rt)
+string translateRT(TextClass::ReadType rt)
{
switch (rt) {
case TextClass::BASECLASS:
TC_DEFAULTMODULE,
TC_PROVIDESMODULE,
TC_EXCLUDESMODULE,
- TC_HTMLTOCSECTION
+ TC_HTMLTOCSECTION,
+ TC_CITEFORMAT
};
LexerKeyword textClassTags[] = {
{ "addtohtmlpreamble", TC_ADDTOHTMLPREAMBLE },
{ "addtopreamble", TC_ADDTOPREAMBLE },
+ { "citeformat", TC_CITEFORMAT },
{ "classoptions", TC_CLASSOPTIONS },
{ "columns", TC_COLUMNS },
{ "counter", TC_COUNTER },
case TC_FLOAT:
readFloat(lexrc);
break;
+
+ case TC_CITEFORMAT:
+ readCiteFormat(lexrc);
+ break;
case TC_IFCOUNTER:
ifcounter = true;
break;
case CO_OTHER:
lexrc.next();
- options_ = lexrc.getString();
+ if (options_.empty())
+ options_ = lexrc.getString();
+ else
+ options_ += ',' + lexrc.getString();
break;
case CO_HEADER:
lexrc.next();
}
+void TextClass::readCiteFormat(Lexer & lexrc)
+{
+ string etype;
+ string definition;
+ while (lexrc.isOK()) {
+ lexrc.next();
+ etype = lexrc.getString();
+ if (!lexrc.isOK() || compare_ascii_no_case(etype, "end") == 0)
+ break;
+ lexrc.eatLine();
+ definition = lexrc.getString();
+ char initchar = etype[0];
+ if (initchar == '#')
+ continue;
+ if (initchar == '!' || initchar == '_')
+ cite_macros_[etype] = definition;
+ else
+ cite_formats_[etype] = definition;
+ }
+}
+
+
void TextClass::readFloat(Lexer & lexrc)
{
enum {
FT_WITHIN,
FT_STYLE,
FT_LISTNAME,
- FT_BUILTIN,
+ FT_NEEDSFLOAT,
FT_HTMLSTYLE,
FT_HTMLATTR,
FT_HTMLTAG,
+ FT_LISTCOMMAND,
+ FT_REFPREFIX,
FT_END
};
{ "htmlattr", FT_HTMLATTR },
{ "htmlstyle", FT_HTMLSTYLE },
{ "htmltag", FT_HTMLTAG },
- { "latexbuiltin", FT_BUILTIN },
+ { "listcommand", FT_LISTCOMMAND },
{ "listname", FT_LISTNAME },
+ { "needsfloatpkg", FT_NEEDSFLOAT },
{ "numberwithin", FT_WITHIN },
{ "placement", FT_PLACEMENT },
+ { "refprefix", FT_REFPREFIX },
{ "style", FT_STYLE },
{ "type", FT_TYPE }
};
string htmlattr;
string htmlstyle;
string htmltag;
- string listName;
+ string listname;
+ string listcommand;
string name;
string placement;
+ string refprefix;
string style;
string type;
string within;
- bool builtin = false;
+ bool needsfloat = true;
bool getout = false;
while (!getout && lexrc.isOK()) {
within = fl.within();
style = fl.style();
name = fl.name();
- listName = fl.listName();
- builtin = fl.builtin();
+ listname = fl.listName();
+ needsfloat = fl.needsFloatPkg();
+ listcommand = fl.listCommand();
+ refprefix = fl.refPrefix();
}
break;
case FT_NAME:
lexrc.next();
style = lexrc.getString();
break;
+ case FT_LISTCOMMAND:
+ lexrc.next();
+ listcommand = lexrc.getString();
+ break;
+ case FT_REFPREFIX:
+ lexrc.next();
+ refprefix = lexrc.getString();
+ break;
case FT_LISTNAME:
lexrc.next();
- listName = lexrc.getString();
+ listname = lexrc.getString();
break;
- case FT_BUILTIN:
+ case FT_NEEDSFLOAT:
lexrc.next();
- builtin = lexrc.getBool();
+ needsfloat = lexrc.getBool();
break;
case FT_HTMLATTR:
lexrc.next();
}
}
- // Here if have a full float if getout == true
+ // Here we have a full float if getout == true
if (getout) {
+ if (!needsfloat && listcommand.empty())
+ LYXERR0("The layout does not provide a list command " <<
+ "for the builtin float `" << type << "'. LyX will " <<
+ "not be able to produce a float list.");
Floating fl(type, placement, ext, within, style, name,
- listName, htmltag, htmlattr, htmlstyle, builtin);
+ listname, listcommand, refprefix,
+ htmltag, htmlattr, htmlstyle, needsfloat);
floatlist_.newFloat(fl);
// each float has its own counter
counters_.newCounter(from_ascii(type), from_ascii(within),
}
+string const & TextClass::prerequisites() const
+{
+ if (contains(prerequisites_, ',')) {
+ vector<string> const pres = getVectorFromString(prerequisites_);
+ prerequisites_ = getStringFromVector(pres, "\n\t");
+ }
+ return prerequisites_;
+}
+
bool TextClass::hasLayout(docstring const & n) const
{
docstring const name = n.empty() ? defaultLayoutName() : n;
<< to_utf8(makeDisplayPath(layout_file.absFilename()))
<< "'\n(Check `" << name_
<< "')\nCheck your installation and "
- "try Options/Reconfigure..." << endl;
+ "try Options/Reconfigure..."
+ << endl;
}
return loaded_;
{
if (html_toc_section_.empty()) {
// we're going to look for the layout with the minimum toclevel
- // number > 0, because we don't want Part.
- // we'll take the first one, just because.
TextClass::LayoutList::const_iterator lit = begin();
TextClass::LayoutList::const_iterator const len = end();
int minlevel = 1000;
Layout const * lay = NULL;
for (; lit != len; ++lit) {
int const level = lit->toclevel;
- if (level > 0 && (level == Layout::NOT_IN_TOC || level >= minlevel))
+ // we don't want Part
+ if (level == Layout::NOT_IN_TOC || level < 0 || level >= minlevel)
continue;
lay = &*lit;
minlevel = level;
}
+string const & DocumentClass::getCiteFormat(string const & entry_type) const
+{
+ static string default_format = N_("{%author%[[%author%, ]][[{%editor%[[%editor%, ed., ]]}]]}\"%title%\"{%journal%[[, {!<i>!}%journal%{!</i>!}]][[{%publisher%[[, %publisher%]][[{%institution%[[, %institution%]]}]]}]]}{%year%[[ (%year%)]]}{%pages%[[, %pages%]]}.");
+
+ map<string, string>::const_iterator it = cite_formats_.find(entry_type);
+ if (it != cite_formats_.end())
+ return it->second;
+ return default_format;
+}
+
+
+string const & DocumentClass::getCiteMacro(string const & macro) const
+{
+ static string empty;
+ map<string, string>::const_iterator it = cite_macros_.find(macro);
+ if (it != cite_macros_.end())
+ return it->second;
+ return empty;
+}
+
+
/////////////////////////////////////////////////////////////////////////
//
// PageSides