Rename some things to improve clarity.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31765 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Richard Heck 2009-10-27 13:29:26 +00:00
parent 1d9b4956c3
commit c2b8eeaf96
3 changed files with 34 additions and 28 deletions

View File

@ -494,7 +494,7 @@ bool Layout::read(Lexer & lex, TextClass const & tclass)
break; break;
case LT_HTMLITEM: case LT_HTMLITEM:
lex >> htmlitem_; lex >> htmlitemtag_;
break; break;
case LT_HTMLITEMATTR: case LT_HTMLITEMATTR:
@ -502,7 +502,7 @@ bool Layout::read(Lexer & lex, TextClass const & tclass)
break; break;
case LT_HTMLLABEL: case LT_HTMLLABEL:
lex >> htmllabel_; lex >> htmllabeltag_;
break; break;
case LT_HTMLLABELATTR: case LT_HTMLLABELATTR:
@ -869,10 +869,10 @@ docstring const Layout::babelpreamble(Language const * lang) const
} }
string const Layout::htmltag() const string const & Layout::htmltag() const
{ {
if (htmltag_.empty()) if (htmltag_.empty())
htmltag_ = "div"; htmltag_ = "div";
return htmltag_; return htmltag_;
} }
@ -880,39 +880,39 @@ string const Layout::htmltag() const
string const & Layout::htmlattr() const string const & Layout::htmlattr() const
{ {
if (htmlattr_.empty()) if (htmlattr_.empty())
htmlattr_ = "class=\"" + to_utf8(name()) + "\""; htmlattr_ = "class=\"" + defaultCSSClass() + "\"";
return htmlattr_; return htmlattr_;
} }
string const & Layout::htmlitem() const string const & Layout::htmlitemtag() const
{ {
if (htmlitem_.empty()) if (htmlitemtag_.empty())
htmlitem_ = "div"; htmlitemtag_ = "div";
return htmlitem_; return htmlitemtag_;
} }
string const & Layout::htmlitemattr() const string const & Layout::htmlitemattr() const
{ {
if (htmlitemattr_.empty()) if (htmlitemattr_.empty())
htmlitemattr_ = "class=\"" + to_utf8(name()) + "item\""; htmlitemattr_ = "class=\"" + defaultCSSItemClass() + "\"";
return htmlitemattr_; return htmlitemattr_;
} }
string const & Layout::htmllabel() const string const & Layout::htmllabeltag() const
{ {
if (htmllabel_.empty()) if (htmllabeltag_.empty())
htmllabel_ = "span"; htmllabeltag_ = "span";
return htmllabel_; return htmllabeltag_;
} }
string const & Layout::htmllabelattr() const string const & Layout::htmllabelattr() const
{ {
if (htmllabelattr_.empty()) if (htmllabelattr_.empty())
htmllabelattr_ = "class=\"" + to_utf8(name()) + "label\""; htmllabelattr_ = "class=\"" + defaultCSSLabelClass() + "\"";
return htmllabelattr_; return htmllabelattr_;
} }

View File

@ -110,15 +110,15 @@ public:
/// ///
std::string const & itemtag() const { return itemtag_; } std::string const & itemtag() const { return itemtag_; }
/// ///
std::string const htmltag() const; std::string const & htmltag() const;
/// ///
std::string const & htmlattr() const; std::string const & htmlattr() const;
/// ///
std::string const & htmlitem() const; std::string const & htmlitemtag() const;
/// ///
std::string const & htmlitemattr() const; std::string const & htmlitemattr() const;
/// ///
std::string const & htmllabel() const; std::string const & htmllabeltag() const;
/// ///
std::string const & htmllabelattr() const; std::string const & htmllabelattr() const;
/// ///
@ -251,6 +251,12 @@ public:
private: private:
/// generates the default CSS for this layout /// generates the default CSS for this layout
void makeDefaultCSS() const; void makeDefaultCSS() const;
///
inline std::string defaultCSSClass() const { return to_utf8(name()); }
///
inline std::string defaultCSSItemClass() const { return to_utf8(name()) + "item"; }
///
inline std::string defaultCSSLabelClass() const { return to_utf8(name()) + "label"; }
/// Name of the layout/paragraph environment /// Name of the layout/paragraph environment
docstring name_; docstring name_;
@ -310,15 +316,15 @@ private:
/// in "p" tags. Default is "div". /// in "p" tags. Default is "div".
/// Note that when I said "environment", I meant it: This has no /// Note that when I said "environment", I meant it: This has no
/// effect for LATEX_PARAGRAPH type layouts. /// effect for LATEX_PARAGRAPH type layouts.
mutable std::string htmlitem_; mutable std::string htmlitemtag_;
/// Attributes for htmlitem_. Default is: class="layoutnameitem". /// Attributes for htmlitemtag_. Default is: class="layoutnameitem".
mutable std::string htmlitemattr_; mutable std::string htmlitemattr_;
/// Tag for labels, of whatever sort. One use for this is in setting /// Tag for labels, of whatever sort. One use for this is in setting
/// descriptions, in which case it would be: dt. Another use is to /// descriptions, in which case it would be: dt. Another use is to
/// customize the display of, say, the auto-generated label for /// customize the display of, say, the auto-generated label for
/// sections. Defaults to "span". /// sections. Defaults to "span".
/// If set to "NONE", this suppresses the printing of the label. /// If set to "NONE", this suppresses the printing of the label.
mutable std::string htmllabel_; mutable std::string htmllabeltag_;
/// Attributes for the label. Defaults to: class="layoutnamelabel". /// Attributes for the label. Defaults to: class="layoutnamelabel".
mutable std::string htmllabelattr_; mutable std::string htmllabelattr_;
/// Whether to put the label before the item, or within the item. /// Whether to put the label before the item, or within the item.

View File

@ -122,25 +122,25 @@ bool closeTag(odocstream & os, Layout const & lay)
bool openLabelTag(odocstream & os, Layout const & lay) bool openLabelTag(odocstream & os, Layout const & lay)
{ {
return html::openTag(os, lay.htmllabel(), lay.htmllabelattr()); return html::openTag(os, lay.htmllabeltag(), lay.htmllabelattr());
} }
bool closeLabelTag(odocstream & os, Layout const & lay) bool closeLabelTag(odocstream & os, Layout const & lay)
{ {
return html::closeTag(os, lay.htmllabel()); return html::closeTag(os, lay.htmllabeltag());
} }
bool openItemTag(odocstream & os, Layout const & lay) bool openItemTag(odocstream & os, Layout const & lay)
{ {
return html::openTag(os, lay.htmlitem(), lay.htmlitemattr()); return html::openTag(os, lay.htmlitemtag(), lay.htmlitemattr());
} }
bool closeItemTag(odocstream & os, Layout const & lay) bool closeItemTag(odocstream & os, Layout const & lay)
{ {
return html::closeTag(os, lay.htmlitem()); return html::closeTag(os, lay.htmlitemtag());
} }
ParagraphList::const_iterator searchParagraphHtml( ParagraphList::const_iterator searchParagraphHtml(
@ -305,7 +305,7 @@ ParagraphList::const_iterator makeEnvironmentHtml(Buffer const & buf,
// in this case, we print the label only for the first // in this case, we print the label only for the first
// paragraph (as in a theorem). // paragraph (as in a theorem).
item_tag_opened = openItemTag(os, style); item_tag_opened = openItemTag(os, style);
if (par == pbegin && style.htmllabel() != "NONE") { if (par == pbegin && style.htmllabeltag() != "NONE") {
docstring const lbl = docstring const lbl =
pbegin->expandLabel(style, buf.params(), false); pbegin->expandLabel(style, buf.params(), false);
if (!lbl.empty()) { if (!lbl.empty()) {
@ -320,7 +320,7 @@ ParagraphList::const_iterator makeEnvironmentHtml(Buffer const & buf,
if (!labelfirst) if (!labelfirst)
item_tag_opened = openItemTag(os, style); item_tag_opened = openItemTag(os, style);
if (style.labeltype == LABEL_MANUAL if (style.labeltype == LABEL_MANUAL
&& style.htmllabel() != "NONE") { && style.htmllabeltag() != "NONE") {
madelabel = openLabelTag(os, style); madelabel = openLabelTag(os, style);
sep = par->firstWordLyXHTML(os, runparams); sep = par->firstWordLyXHTML(os, runparams);
if (madelabel) if (madelabel)
@ -328,7 +328,7 @@ ParagraphList::const_iterator makeEnvironmentHtml(Buffer const & buf,
os << '\n'; os << '\n';
} }
else if (style.labeltype != LABEL_NO_LABEL else if (style.labeltype != LABEL_NO_LABEL
&& style.htmllabel() != "NONE") { && style.htmllabeltag() != "NONE") {
madelabel = openLabelTag(os, style); madelabel = openLabelTag(os, style);
os << par->expandLabel(style, buf.params(), false); os << par->expandLabel(style, buf.params(), false);
if (madelabel) if (madelabel)