From d88e9655be4a8b390ed0b4b90bd22c77ae1755d3 Mon Sep 17 00:00:00 2001 From: Richard Heck Date: Mon, 30 Nov 2009 17:08:56 +0000 Subject: [PATCH] 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 --- src/Floating.cpp | 12 ++++++++---- src/Floating.h | 16 ++++++++-------- src/TextClass.cpp | 12 ++++++------ src/insets/InsetFloat.cpp | 6 ++---- 4 files changed, 24 insertions(+), 22 deletions(-) diff --git a/src/Floating.cpp b/src/Floating.cpp index 0e1730eabf..b3c99d4232 100644 --- a/src/Floating.cpp +++ b/src/Floating.cpp @@ -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_; } diff --git a/src/Floating.h b/src/Floating.h index ae1a95f87b..acb98f7e8a 100644 --- a/src/Floating.h +++ b/src/Floating.h @@ -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_; diff --git a/src/TextClass.cpp b/src/TextClass.cpp index 3a9ba6c664..eb69da2a7a 100644 --- a/src/TextClass.cpp +++ b/src/TextClass.cpp @@ -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), diff --git a/src/insets/InsetFloat.cpp b/src/insets/InsetFloat.cpp index f7a1c7acb3..d014493684 100644 --- a/src/insets/InsetFloat.cpp +++ b/src/insets/InsetFloat.cpp @@ -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("\n");