A bit of renaming, plus default values for htmlTag() and htmlClass().

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32244 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Richard Heck 2009-11-30 17:08:56 +00:00
parent 6eb15ce722
commit d88e9655be
4 changed files with 24 additions and 22 deletions

View File

@ -27,11 +27,11 @@ Floating::Floating()
Floating::Floating(string const & type, string const & placement,
string const & ext, string const & within,
string const & style, string const & name,
string const & listName, string const & htmlType,
string const & listName, string const & htmlTag,
string const & htmlClass, string const & htmlStyle,
bool builtin)
: type_(type), placement_(placement), ext_(ext), within_(within),
style_(style), name_(name), listName_(listName), htmlType_(htmlType),
style_(style), name_(name), listName_(listName), htmlTag_(htmlTag),
htmlClass_(htmlClass), htmlStyle_(htmlStyle), builtin_(builtin)
{}
@ -86,13 +86,17 @@ string const & Floating::htmlStyle() const
string const & Floating::htmlClass() const
{
if (htmlClass_.empty())
htmlClass_ = "float-" + type_;
return htmlClass_;
}
string const & Floating::htmlType() const
string const & Floating::htmlTag() const
{
return htmlType_;
if (htmlTag_.empty())
htmlTag_ = "div";
return htmlTag_;
}

View File

@ -50,10 +50,10 @@ public:
std::string const & listName() const;
/// style information, for preamble
std::string const & htmlStyle() const;
/// class, for css
/// class, for css, defaults to "float-" + type()
std::string const & htmlClass() const;
/// tag type
std::string const & htmlType() const;
/// tag type, defaults to "div"
std::string const & htmlTag() const;
///
bool builtin() const;
private:
@ -71,11 +71,11 @@ private:
std::string name_;
///
std::string listName_;
/// HTML Element type, usually div
std::string htmlType_;
/// class attribute, e.g., float-table, for CSS
std::string htmlClass_;
/// CSS information for this element
///
mutable std::string htmlTag_;
///
mutable std::string htmlClass_;
///
std::string htmlStyle_;
///
bool builtin_;

View File

@ -853,7 +853,7 @@ void TextClass::readFloat(Lexer & lexrc)
FT_BUILTIN,
FT_HTMLSTYLE,
FT_HTMLCLASS,
FT_HTMLTYPE,
FT_HTMLTAG,
FT_END
};
@ -863,7 +863,7 @@ void TextClass::readFloat(Lexer & lexrc)
{ "guiname", FT_NAME },
{ "htmlclass", FT_HTMLCLASS },
{ "htmlstyle", FT_HTMLSTYLE },
{ "htmltype", FT_HTMLTYPE },
{ "htmltag", FT_HTMLTAG },
{ "latexbuiltin", FT_BUILTIN },
{ "listname", FT_LISTNAME },
{ "numberwithin", FT_WITHIN },
@ -877,7 +877,7 @@ void TextClass::readFloat(Lexer & lexrc)
string ext;
string htmlclass;
string htmlstyle;
string htmltype;
string htmltag;
string listName;
string name;
string placement;
@ -948,9 +948,9 @@ void TextClass::readFloat(Lexer & lexrc)
lexrc.next();
htmlstyle = lexrc.getLongString("EndHTMLStyle");
break;
case FT_HTMLTYPE:
case FT_HTMLTAG:
lexrc.next();
htmltype = lexrc.getString();
htmltag = lexrc.getString();
break;
case FT_END:
getout = true;
@ -961,7 +961,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, htmltype, htmlclass, htmlstyle, builtin);
listName, htmltag, htmlclass, htmlstyle, builtin);
floatlist_.newFloat(fl);
// each float has its own counter
counters_.newCounter(from_ascii(type), from_ascii(within),

View File

@ -285,10 +285,8 @@ docstring InsetFloat::xhtml(odocstream & os, OutputParams const & rp) const
{
FloatList const & floats = buffer().params().documentClass().floats();
Floating const & ftype = floats.getType(params_.type);
string const htmltype = ftype.htmlType().empty() ?
"div" : ftype.htmlType();
string const htmlclass = ftype.htmlClass().empty() ?
"float-" + params_.type : ftype.htmlClass();
string const & htmltype = ftype.htmlTag();
string const & htmlclass = ftype.htmlClass();
docstring const otag =
from_ascii("<" + htmltype + " class='float " + htmlclass + "'>\n");
docstring const ctag = from_ascii("</" + htmltype + ">\n");