indicates what prefix to use when constructing formatted references.
Documentation to follow.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33784
a592a061-630c-0410-9148-
cb99ea01b6c8
12 files changed:
ListName "List of Tables"
NeedsFloatPkg false
ListCommand listoftables
ListName "List of Tables"
NeedsFloatPkg false
ListCommand listoftables
ListName "List of Figures"
NeedsFloatPkg false
ListCommand listoffigures
ListName "List of Figures"
NeedsFloatPkg false
ListCommand listoffigures
Style ruled
ListName "List of Algorithms"
NeedsFloatPkg true
Style ruled
ListName "List of Algorithms"
NeedsFloatPkg true
Size Small
EndFont
MultiPar true
Size Small
EndFont
MultiPar true
HTMLLabel \arabic{footnote}
HTMLInnerTag div
HTMLStyle
HTMLLabel \arabic{footnote}
HTMLInnerTag div
HTMLStyle
KeepEmpty true
FreeSpacing true
ForceLTR true
KeepEmpty true
FreeSpacing true
ForceLTR true
Size Small
EndFont
MultiPar true
Size Small
EndFont
MultiPar true
HTMLStyle
div.wrap {
float: right;
HTMLStyle
div.wrap {
float: right;
BottomSep 4
ParSep 0.8
Align Center
BottomSep 4
ParSep 0.8
Align Center
Alignpossible Center
Font
Series Bold
Alignpossible Center
Font
Series Bold
ParSep 0.8
Align Block
OptionalArgs 1
ParSep 0.8
Align Block
OptionalArgs 1
Font
Series Bold
Size Huge
Font
Series Bold
Size Huge
ParSep 0.7
Align Block
OptionalArgs 1
ParSep 0.7
Align Block
OptionalArgs 1
Font
Series Bold
Size Larger
Font
Series Bold
Size Larger
Series Bold
Size Large
EndFont
Series Bold
Size Large
EndFont
Series Bold
Size Normal
EndFont
Series Bold
Size Normal
EndFont
LatexName paragraph
TopSep 0.4
BottomSep 0
LatexName paragraph
TopSep 0.4
BottomSep 0
LatexName subparagraph
NextNoIndent 0
LeftMargin MM
LatexName subparagraph
NextNoIndent 0
LeftMargin MM
# Changed LaTeXBuiltin tag to NeedsFloatPkg and
# added new tag ListCommand.
# Changed LaTeXBuiltin tag to NeedsFloatPkg and
# added new tag ListCommand.
+# Incremented to format 25, 12 March 2010 by rgh
+# Added RefPrefix tag for layouts and floats.
+
# Do not forget to document format change in Customization
# Manual (section "Declaring a new text class").
# Do not forget to document format change in Customization
# Manual (section "Declaring a new text class").
# development/tools/updatelayouts.sh script to update all
# layout files to the new format.
# development/tools/updatelayouts.sh script to update all
# layout files to the new format.
while i < len(lines) and not re_EndBabelPreamble.match(lines[i]):
i += 1
continue
while i < len(lines) and not re_EndBabelPreamble.match(lines[i]):
i += 1
continue
+
+ # Only new features
+ if format == 24:
+ i += 1
+ continue
if format == 23:
match = re_Float.match(lines[i])
if format == 23:
match = re_Float.match(lines[i])
string const & ext, string const & within,
string const & style, string const & name,
string const & listName, std::string const & listCmd,
string const & ext, string const & within,
string const & style, string const & name,
string const & listName, std::string const & listCmd,
+ string const & refPrefix,
string const & htmlTag, string const & htmlAttrib,
string const & htmlStyle, bool needsfloat)
: floattype_(type), placement_(placement), ext_(ext), within_(within),
style_(style), name_(name), listname_(listName), listcommand_(listCmd),
string const & htmlTag, string const & htmlAttrib,
string const & htmlStyle, bool needsfloat)
: floattype_(type), placement_(placement), ext_(ext), within_(within),
style_(style), name_(name), listname_(listName), listcommand_(listCmd),
- needsfloatpkg_(needsfloat), html_tag_(htmlTag), html_attrib_(htmlAttrib),
- html_style_(htmlStyle)
+ refprefix_(refPrefix), needsfloatpkg_(needsfloat), html_tag_(htmlTag),
+ html_attrib_(htmlAttrib), html_style_(htmlStyle)
std::string const & ext, std::string const & within,
std::string const & style, std::string const & name,
std::string const & listName, std::string const & listCmd,
std::string const & ext, std::string const & within,
std::string const & style, std::string const & name,
std::string const & listName, std::string const & listCmd,
+ std::string const & refPrefix,
std::string const & htmlType, std::string const & htmlClass,
std::string const & htmlStyle, bool builtin = false);
///
std::string const & htmlType, std::string const & htmlClass,
std::string const & htmlStyle, bool builtin = false);
///
/// if needsFloatPkg() is false. note that this should not contain
/// the leading "\".
std::string const & listCommand() const { return listcommand_; }
/// if needsFloatPkg() is false. note that this should not contain
/// the leading "\".
std::string const & listCommand() const { return listcommand_; }
+ /// prefix to use for formatted references to such floats
+ std::string const & refPrefix() const { return refprefix_; }
///
bool needsFloatPkg() const { return needsfloatpkg_; }
/// style information, for preamble
///
bool needsFloatPkg() const { return needsfloatpkg_; }
/// style information, for preamble
///
std::string listcommand_;
///
///
std::string listcommand_;
///
+ std::string refprefix_;
+ ///
bool needsfloatpkg_;
///
mutable std::string html_tag_;
bool needsfloatpkg_;
///
mutable std::string html_tag_;
LT_INPREAMBLE,
LT_HTMLTITLE,
LT_SPELLCHECK,
LT_INPREAMBLE,
LT_HTMLTITLE,
LT_SPELLCHECK,
LT_INTITLE // keep this last!
};
LT_INTITLE // keep this last!
};
{ "parskip", LT_PARSKIP },
{ "passthru", LT_PASS_THRU },
{ "preamble", LT_PREAMBLE },
{ "parskip", LT_PARSKIP },
{ "passthru", LT_PASS_THRU },
{ "preamble", LT_PREAMBLE },
+ { "refprefix", LT_REFPREFIX },
{ "requires", LT_REQUIRES },
{ "rightmargin", LT_RIGHTMARGIN },
{ "spacing", LT_SPACING },
{ "requires", LT_REQUIRES },
{ "rightmargin", LT_RIGHTMARGIN },
{ "spacing", LT_SPACING },
requires_.insert(req.begin(), req.end());
break;
}
requires_.insert(req.begin(), req.end());
break;
}
+
+ case LT_REFPREFIX:
+ lex >> refprefix;
+ break;
case LT_HTMLTAG:
lex >> htmltag_;
case LT_HTMLTAG:
lex >> htmltag_;
int optionalargs;
/// Which counter to step
docstring counter;
int optionalargs;
/// Which counter to step
docstring counter;
+ /// Prefix to use when creating labels
+ docstring refprefix;
/// Depth of XML command
int commanddepth;
/// Depth of XML command
int commanddepth;
}
}
if (layout->latextype != LATEX_PARAGRAPH)
}
}
if (layout->latextype != LATEX_PARAGRAPH)
- name = from_ascii(layout->latexname());
+ name = layout->refprefix;
// for captions, we just take the caption type
Inset * caption_inset = cur.innerInsetOfType(CAPTION_CODE);
// for captions, we just take the caption type
Inset * caption_inset = cur.innerInsetOfType(CAPTION_CODE);
- if (caption_inset)
- name = from_ascii(static_cast<InsetCaption *>(caption_inset)->type());
-
- // If none of the above worked, we'll see if we're inside various
- // types of insets and take our abbreviation from them.
- if (name.empty()) {
- InsetCode const codes[] = {
- FLOAT_CODE,
- WRAP_CODE,
- FOOT_CODE
- };
- for (unsigned int i = 0; i < (sizeof codes / sizeof codes[0]); ++i) {
- Inset * float_inset = cur.innerInsetOfType(codes[i]);
- if (float_inset) {
- name = float_inset->name();
- break;
- }
+ if (caption_inset) {
+ string const & ftype = static_cast<InsetCaption *>(caption_inset)->type();
+ FloatList const & fl = cur.buffer()->params().documentClass().floats();
+ if (fl.typeExist(ftype)) {
+ Floating const & flt = fl.getType(ftype);
+ name = from_utf8(flt.refPrefix());
+ if (name.empty())
+ name = from_utf8(ftype.substr(0,3));
- // Create a correct prefix for prettyref
- if (name == "theorem")
- name = from_ascii("thm");
- else if (name == "Foot")
- name = from_ascii("fn");
- else if (name == "listing")
- name = from_ascii("lst");
+ // If none of the above worked, see if the inset knows.
+ if (name.empty()) {
+ InsetLayout const & il = cur.inset().getLayout();
+ name = il.refprefix();
+ }
- text = name.substr(0, 3) + ':' + text;
+ // FIXME
+ // we should allow customization of the separator or else change it
+ // once we have refstyle
+ text = name + ':' + text;
};
// Keep the changes documented in the Customization manual.
};
// Keep the changes documented in the Customization manual.
bool layout2layout(FileName const & filename, FileName const & tempfile)
bool layout2layout(FileName const & filename, FileName const & tempfile)
FT_HTMLATTR,
FT_HTMLTAG,
FT_LISTCOMMAND,
FT_HTMLATTR,
FT_HTMLTAG,
FT_LISTCOMMAND,
{ "needsfloatpkg", FT_NEEDSFLOAT },
{ "numberwithin", FT_WITHIN },
{ "placement", FT_PLACEMENT },
{ "needsfloatpkg", FT_NEEDSFLOAT },
{ "numberwithin", FT_WITHIN },
{ "placement", FT_PLACEMENT },
+ { "refprefix", FT_REFPREFIX },
{ "style", FT_STYLE },
{ "type", FT_TYPE }
};
{ "style", FT_STYLE },
{ "type", FT_TYPE }
};
string htmlattr;
string htmlstyle;
string htmltag;
string htmlattr;
string htmlstyle;
string htmltag;
- string listName;
- string listCommand;
+ string listname;
+ string listcommand;
string name;
string placement;
string name;
string placement;
string style;
string type;
string within;
string style;
string type;
string within;
within = fl.within();
style = fl.style();
name = fl.name();
within = fl.within();
style = fl.style();
name = fl.name();
- listName = fl.listName();
+ listname = fl.listName();
needsfloat = fl.needsFloatPkg();
needsfloat = fl.needsFloatPkg();
- listCommand = fl.listCommand();
+ listcommand = fl.listCommand();
+ refprefix = fl.refPrefix();
break;
case FT_LISTCOMMAND:
lexrc.next();
break;
case FT_LISTCOMMAND:
lexrc.next();
- listCommand = lexrc.getString();
+ listcommand = lexrc.getString();
+ break;
+ case FT_REFPREFIX:
+ lexrc.next();
+ refprefix = lexrc.getString();
break;
case FT_LISTNAME:
lexrc.next();
break;
case FT_LISTNAME:
lexrc.next();
- listName = lexrc.getString();
+ listname = lexrc.getString();
break;
case FT_NEEDSFLOAT:
lexrc.next();
break;
case FT_NEEDSFLOAT:
lexrc.next();
// Here we have a full float if getout == true
if (getout) {
// Here we have a full float if getout == true
if (getout) {
- if (!needsfloat && listCommand.empty())
+ 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,
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, listCommand, htmltag, htmlattr, htmlstyle,
- needsfloat);
+ listname, listcommand, refprefix,
+ htmltag, htmlattr, htmlstyle, needsfloat);
floatlist_.newFloat(fl);
// each float has its own counter
counters_.newCounter(from_ascii(type), from_ascii(within),
floatlist_.newFloat(fl);
// each float has its own counter
counters_.newCounter(from_ascii(type), from_ascii(within),
IL_PREAMBLE,
IL_REQUIRES,
IL_SPELLCHECK,
IL_PREAMBLE,
IL_REQUIRES,
IL_SPELLCHECK,
{ "needprotect", IL_NEEDPROTECT },
{ "passthru", IL_PASSTHRU },
{ "preamble", IL_PREAMBLE },
{ "needprotect", IL_NEEDPROTECT },
{ "passthru", IL_PASSTHRU },
{ "preamble", IL_PREAMBLE },
+ { "refprefix", IL_REFPREFIX },
{ "requires", IL_REQUIRES },
{ "spellcheck", IL_SPELLCHECK }
};
{ "requires", IL_REQUIRES },
{ "spellcheck", IL_SPELLCHECK }
};
case IL_PREAMBLE:
preamble_ = from_utf8(lex.getLongString("EndPreamble"));
break;
case IL_PREAMBLE:
preamble_ = from_utf8(lex.getLongString("EndPreamble"));
break;
+ case IL_REFPREFIX:
+ lex >> refprefix_;
+ break;
case IL_HTMLTAG:
lex >> htmltag_;
break;
case IL_HTMLTAG:
lex >> htmltag_;
break;
docstring preamble() const { return preamble_; }
///
docstring counter() const { return counter_; }
docstring preamble() const { return preamble_; }
///
docstring counter() const { return counter_; }
+ ///
+ docstring refprefix() const { return refprefix_; }
/// The tag enclosing all the material in this inset. Default is "span".
std::string const & htmltag() const;
/// Additional attributes for inclusion with the start tag. Default (if
/// The tag enclosing all the material in this inset. Default is "span".
std::string const & htmltag() const;
/// Additional attributes for inclusion with the start tag. Default (if
///
docstring preamble_;
///
///
docstring preamble_;
///
+ docstring refprefix_;
+ ///
mutable std::string htmltag_;
///
mutable std::string htmlattr_;
mutable std::string htmltag_;
///
mutable std::string htmlattr_;