Change the LaTeXBuiltin tag to a NeedsFloatPkg tag. Discussion on the

list revealed that the former is confusing to people. The latter
indicates more clearly what the tag does.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33626 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Richard Heck 2010-03-05 17:24:38 +00:00
parent 75dcff81ab
commit b64e2d4103
7 changed files with 113 additions and 83 deletions

View File

@ -12545,72 +12545,6 @@ HTML*
\begin_inset Flex CharStyle:Code
status collapsed
\begin_layout Plain Layout
LaTeXBuiltin
\end_layout
\end_inset
[
\begin_inset Flex CharStyle:Code
status collapsed
\begin_layout Plain Layout
\emph on
0
\end_layout
\end_inset
,
\begin_inset Flex CharStyle:Code
status collapsed
\begin_layout Plain Layout
1
\end_layout
\end_inset
] Set to
\begin_inset Flex CharStyle:Code
status collapsed
\begin_layout Plain Layout
1
\end_layout
\end_inset
if the float is already defined by the LaTeX document class.
If this is set to
\begin_inset Flex CharStyle:Code
status collapsed
\begin_layout Plain Layout
0
\end_layout
\end_inset
, the float will be defined using the LaTeX package
\begin_inset Flex CharStyle:Code
status collapsed
\begin_layout Plain Layout
float
\end_layout
\end_inset
.
\end_layout
\begin_layout Description
\begin_inset Flex CharStyle:Code
status collapsed
\begin_layout Plain Layout
ListName
\end_layout
@ -12646,6 +12580,84 @@ string
\begin_inset Flex CharStyle:Code
status collapsed
\begin_layout Plain Layout
NeedsFloatPkg
\end_layout
\end_inset
[
\begin_inset Flex CharStyle:Code
status open
\begin_layout Plain Layout
0
\end_layout
\end_inset
,
\begin_inset Flex CharStyle:Code
status collapsed
\begin_layout Plain Layout
\emph on
1
\end_layout
\end_inset
] Indicates whether the float is already defined in the document class or
if we instead need to load
\begin_inset Flex CharStyle:Code
status collapsed
\begin_layout Plain Layout
float.sty
\end_layout
\end_inset
and use what it provides.
The default is
\begin_inset Flex CharStyle:Code
status collapsed
\begin_layout Plain Layout
1
\end_layout
\end_inset
, which means: use
\begin_inset Flex CharStyle:Code
status collapsed
\begin_layout Plain Layout
float.sty
\end_layout
\end_inset
.
It should be set to
\begin_inset Flex CharStyle:Code
status collapsed
\begin_layout Plain Layout
0
\end_layout
\end_inset
if the float is already defined by the LaTeX document class.
\end_layout
\begin_layout Description
\begin_inset Flex CharStyle:Code
status collapsed
\begin_layout Plain Layout
NumberWithin
\end_layout

View File

@ -84,6 +84,9 @@ import os, re, string, sys
# Incremented to format 23, 13 February 2010 by spitz
# Added Spellcheck tag.
# Incremented to format 24, 5 March 2010 by rgh
# Changed LaTeXBuiltin tag to NeedsFloatPkg.
# Do not forget to document format change in Customization
# Manual (section "Declaring a new text class").
@ -91,7 +94,7 @@ import os, re, string, sys
# development/tools/updatelayouts.sh script to update all
# layout files to the new format.
currentFormat = 23
currentFormat = 24
def usage(prog_name):
@ -171,6 +174,8 @@ def convert(lines):
re_TocLevel = re.compile(r'^(\s*)(TocLevel)(\s+)(\S+)', re.IGNORECASE)
re_I18nPreamble = re.compile(r'^(\s*)I18nPreamble', re.IGNORECASE)
re_EndI18nPreamble = re.compile(r'^(\s*)EndI18nPreamble', re.IGNORECASE)
re_Builtin = re.compile(r'^(\s*)LaTeXBuiltin\s+(\w*)', re.IGNORECASE)
re_True = re.compile(r'^\s*(?:true|1)\s*$', re.IGNORECASE)
# counters for sectioning styles (hardcoded in 1.3)
counters = {"part" : "\\Roman{part}",
@ -259,6 +264,19 @@ def convert(lines):
i += 1
continue
if format == 23:
match = re_Builtin.match(lines[i])
if match:
ws = match.group(1)
arg = match.group(2)
newarg = ""
if re_True.match(arg):
newarg = "false"
else:
newarg = "true"
lines[i] = ws + "NeedsFloatPkg " + newarg
# This just involved new features, not any changes to old ones
if format >= 14 and format <= 22:
i += 1

View File

@ -31,9 +31,9 @@ Floating::Floating(string const & type, string const & placement,
string const & style, string const & name,
string const & listName, string const & htmlTag,
string const & htmlAttrib, string const & htmlStyle,
bool builtin)
bool needsfloat)
: floattype_(type), placement_(placement), ext_(ext), within_(within),
style_(style), name_(name), listname_(listName), builtin_(builtin),
style_(style), name_(name), listname_(listName), needsfloatpkg_(needsfloat),
html_tag_(htmlTag), html_attrib_(htmlAttrib), html_style_(htmlStyle)
{}

View File

@ -49,7 +49,7 @@ public:
///
std::string const & listName() const { return listname_; }
///
bool builtin() const { return builtin_; }
bool needsFloatPkg() const { return needsfloatpkg_; }
/// style information, for preamble
std::string const & htmlStyle() const { return html_style_; }
/// class, for css, defaults to "float-" + type()
@ -74,7 +74,7 @@ private:
///
std::string listname_;
///
bool builtin_;
bool needsfloatpkg_;
///
mutable std::string html_tag_;
///

View File

@ -432,7 +432,7 @@ void LaTeXFeatures::useFloat(string const & name, bool subfloat)
// use the "H" modifier. This includes modified table and
// figure floats. (Lgb)
Floating const & fl = params_.documentClass().floats().getType(name);
if (!fl.floattype().empty() && !fl.builtin()) {
if (!fl.floattype().empty() && fl.needsFloatPkg()) {
require("float");
}
}
@ -1156,7 +1156,7 @@ void LaTeXFeatures::getFloatDefinitions(odocstream & os) const
Floating const & fl = floats.getType(cit->first);
// For builtin floats we do nothing.
if (fl.builtin())
if (!fl.needsFloatPkg())
continue;
// We have to special case "table" and "figure"

View File

@ -66,7 +66,7 @@ private:
};
// Keep the changes documented in the Customization manual.
int const FORMAT = 23;
int const FORMAT = 24;
bool layout2layout(FileName const & filename, FileName const & tempfile)
@ -856,7 +856,7 @@ void TextClass::readFloat(Lexer & lexrc)
FT_WITHIN,
FT_STYLE,
FT_LISTNAME,
FT_BUILTIN,
FT_NEEDSFLOAT,
FT_HTMLSTYLE,
FT_HTMLATTR,
FT_HTMLTAG,
@ -870,8 +870,8 @@ void TextClass::readFloat(Lexer & lexrc)
{ "htmlattr", FT_HTMLATTR },
{ "htmlstyle", FT_HTMLSTYLE },
{ "htmltag", FT_HTMLTAG },
{ "latexbuiltin", FT_BUILTIN },
{ "listname", FT_LISTNAME },
{ "needsfloatpkg", FT_NEEDSFLOAT },
{ "numberwithin", FT_WITHIN },
{ "placement", FT_PLACEMENT },
{ "style", FT_STYLE },
@ -890,7 +890,7 @@ void TextClass::readFloat(Lexer & lexrc)
string style;
string type;
string within;
bool builtin = false;
bool needsfloat = true;
bool getout = false;
while (!getout && lexrc.isOK()) {
@ -913,7 +913,7 @@ void TextClass::readFloat(Lexer & lexrc)
style = fl.style();
name = fl.name();
listName = fl.listName();
builtin = fl.builtin();
needsfloat = fl.needsFloatPkg();
}
break;
case FT_NAME:
@ -942,9 +942,9 @@ void TextClass::readFloat(Lexer & lexrc)
lexrc.next();
listName = lexrc.getString();
break;
case FT_BUILTIN:
case FT_NEEDSFLOAT:
lexrc.next();
builtin = lexrc.getBool();
needsfloat = lexrc.getBool();
break;
case FT_HTMLATTR:
lexrc.next();
@ -967,7 +967,7 @@ void TextClass::readFloat(Lexer & lexrc)
// Here if have a full float if getout == true
if (getout) {
Floating fl(type, placement, ext, within, style, name,
listName, htmltag, htmlattr, htmlstyle, builtin);
listName, htmltag, htmlattr, htmlstyle, needsfloat);
floatlist_.newFloat(fl);
// each float has its own counter
counters_.newCounter(from_ascii(type), from_ascii(within),

View File

@ -119,7 +119,7 @@ int InsetFloatList::latex(odocstream & os, OutputParams const &) const
FloatList::const_iterator cit = floats[to_ascii(getParam("type"))];
if (cit != floats.end()) {
if (cit->second.builtin()) {
if (!cit->second.needsFloatPkg()) {
// Only two different types allowed here:
string const type = cit->second.floattype();
if (type == "table") {
@ -163,7 +163,7 @@ docstring InsetFloatList::xhtml(XHTMLStream &, OutputParams const &) const {
string toctype;
docstring toclabel;
if (cit->second.builtin()) {
if (!cit->second.needsFloatPkg()) {
// Only two different types allowed here:
string const type = cit->second.floattype();
if (type == "table") {