margin: 1ex;
}
EndHTMLStyle
- HTMLAttr "class='float-caption float-caption-figcaption'"
+ HTMLClass "float-caption float-caption-figcaption"
End
margin: 1ex;
}
EndHTMLStyle
- HTMLAttr "class='float-caption float-caption-table'"
+ HTMLClass "float-caption float-caption-table"
End
margin: 1ex;
}
EndHTMLStyle
- HTMLAttr "class='float-caption float-caption-centered'"
+ HTMLClass "float-caption float-caption-centered"
End
margin: 1ex;
}
EndHTMLStyle
- HTMLAttr "class='float-caption float-caption-centered'"
+ HTMLClass "float-caption float-caption-centered"
End
margin: 1ex;
}
EndHTMLStyle
- HTMLAttr "class='float-caption float-caption-bicaption'"
+ HTMLClass "float-caption float-caption-bicaption"
End
Requires noun
InToc true
HTMLTag span
- HTMLAttr class='noun'
+ HTMLClass noun
HTMLStyle
span.noun {
font-family: sans-serif;
margin: 1ex;
}
EndHTMLStyle
- HTMLAttr "class='float-caption float-caption-above'"
+ HTMLClass "float-caption float-caption-above"
End
margin: 1ex;
}
EndHTMLStyle
- HTMLAttr "class='float-caption float-caption-below'"
+ HTMLClass "float-caption float-caption-below"
End
Font
Family sans
EndFont
- HTMLAttr "class='info menu'"
+ HTMLClass "info menu'"
HTMLStyle
span.menu { font-family: sans-serif; }
EndHTMLStyle
Font
Family sans
EndFont
- HTMLAttr "class='info shortcut'"
+ HTMLCLass "info shortcut"
HTMLStyle
span.shortcut { font-family: sans-serif; }
EndHTMLStyle
Font
Family sans
EndFont
- HTMLAttr "class='info shortcut'"
+ HTMLClass "info shortcut"
HTMLStyle
span.shortcuts { font-family: sans-serif; }
EndHTMLStyle
margin: 1ex;
}
EndHTMLStyle
- HTMLAttr "class='float-caption float-caption-standard'"
+ HTMLClass "float-caption float-caption-standard"
End
Series Bold
EndFont
HTMLTag dl
- HTMLAttr class='description'
HTMLItem dd
HTMLLabel dt
HTMLLabelFirst 1
EndFont
EndArgument
HTMLTag ol
- HTMLAttr class='lyxlist'
+ HTMLClass lyxlist
HTMLItem li
HTMLLabel span
HTMLLabelAttr class='lyxlist'
# This script will update a .layout file to current format
# The latest layout format is also defined in src/TextClass.cpp
-currentFormat = 96
+currentFormat = 97
# Incremented to format 4, 6 April 2007, lasgouttes
# Incremented to format 96, 4 December 2022 by rikiheck
# Add HTMLInToc
+# Incremented to format 97, 4 December 2022 by rikiheck
+# Add HTMLClass
+
# Do not forget to document format change in Customization
# Manual (section "Declaring a new text class").
i += 1
continue
- if 87 <= format <= 96:
+ if 87 <= format <= 97:
# nothing to do.
i += 1
continue
LT_ITEMTAG,
LT_HTMLTAG,
LT_HTMLATTR,
+ LT_HTMLCLASS,
LT_HTMLITEM,
LT_HTMLITEMATTR,
LT_HTMLLABEL,
{ "forcelocal", LT_FORCELOCAL },
{ "freespacing", LT_FREE_SPACING },
{ "htmlattr", LT_HTMLATTR },
+ { "htmlclass", LT_HTMLCLASS },
{ "htmlforcecss", LT_HTMLFORCECSS },
{ "htmlintoc", LT_HTMLINTOC },
{ "htmlitem", LT_HTMLITEM },
lex >> htmlattr_;
break;
+ case LT_HTMLCLASS:
+ lex >> htmlclass_;
+ break;
+
case LT_HTMLITEM:
lex >> htmlitemtag_;
break;
os << "\tHTMLTag " << htmltag_ << '\n';
if (!htmlattr_.empty())
os << "\tHTMLAttr " << htmlattr_ << '\n';
+ if (!htmlclass_.empty())
+ os << "\tHTMLClass " << htmlclass_ << '\n';
+ if (!htmlintoc_)
+ os << "\tHTMLInToc " << htmlintoc_ << '\n';
if (!htmlitemtag_.empty())
os << "\tHTMLItem " << htmlitemtag_ << '\n';
if (!htmlitemattr_.empty())
string const & Layout::htmlattr() const
{
- // If it's an enumeration, then we recalculate the class each time through
- // unless it has been given explicitly
- if (htmlattr_.empty() && labeltype != LABEL_ENUMERATE)
- htmlattr_ = "class=\"" + defaultCSSClass() + "\"";
return htmlattr_;
}
+string const & Layout::htmlclass() const
+{
+ // If it's an enumeration, then we recalculate the class each time through
+ // unless it has been given explicitly. So we do nothing here.
+ if (htmlclass_.empty() && labeltype != LABEL_ENUMERATE)
+ htmlclass_ = defaultCSSClass();
+ return htmlclass_;
+}
+
+
+string const & Layout::htmlGetAttrString() const {
+ if (!htmlfullattrs_.empty())
+ return htmlfullattrs_;
+ htmlfullattrs_ = htmlclass();
+ if (!htmlfullattrs_.empty())
+ htmlfullattrs_ = "class='" + htmlfullattrs_ + "'";
+ if (!htmlattr_.empty())
+ htmlfullattrs_ += " " + htmlattr_;
+ return htmlfullattrs_;
+}
+
string const & Layout::htmlitemtag() const
{
if (htmlitemtag_.empty())
///
std::string const & htmlattr() const;
///
+ std::string const & htmlclass() const;
+ /// Returns a complete attribute string, including class, etc.
+ std::string const & htmlGetAttrString() const;
+ ///
std::string const & htmlitemtag() const;
///
std::string const & htmlitemattr() const;
///
/// Defaults to "div".
mutable std::string htmltag_;
- /// Additional attributes for inclusion with the start tag. Defaults
- /// to: class="layoutname".
- mutable std::string htmlattr_;
+ /// Additional attributes for inclusion with the start tag.
+ /// Note that the CSS class is handled separately.
+ std::string htmlattr_;
+ /// The CSS class to use. Calculated from the layout name if not given.
+ mutable std::string htmlclass_;
+ /// cached
+ mutable std::string htmlfullattrs_;
/// Tag for individual paragraphs in an environment. In lists, this
/// would be something like "li". But it also needs to be set for
/// quotation, e.g., since the paragraphs in a quote need to be
// You should also run the development/tools/updatelayouts.py script,
// to update the format of all of our layout files.
//
-int const LAYOUT_FORMAT = 96; // rikiheck: HTMLInToc
+int const LAYOUT_FORMAT = 97; // rikiheck: HTMLClass
// Layout format for the current lyx file format. Controls which format is
xs << xml::StartTag("div", tocattr);
xs << xml::CR();
- xs << xml::StartTag(lay.htmltag(), lay.htmlattr());
+ xs << xml::StartTag(lay.htmltag(), lay.htmlGetAttrString());
xs << translateIfPossible(indexName, op.local_font->language()->lang());
xs << xml::EndTag(lay.htmltag());
xs << xml::CR();
inline void openParTag(XMLStream & xs, Layout const & lay,
std::string const & parlabel)
{
- string attrs = lay.htmlattr();
+ string attrs = lay.htmlGetAttrString();
if (!parlabel.empty())
attrs += " id='" + parlabel + "'";
xs << xml::ParTag(lay.htmltag(), attrs);
openParTag(xs, lay, parlabel);
return;
}
- string attrs = lay.htmlattr() + " style='text-align: " + align + ";'";
+ string attrs = lay.htmlGetAttrString() + " style='text-align: " + align + ";'";
if (!parlabel.empty())
attrs += " id='" + parlabel + "'";
xs << xml::ParTag(lay.htmltag(), attrs);
openItemTag(xs, lay);
return;
}
- string attrs = lay.htmlattr() + " style='text-align: " + align + ";'";
+ string attrs = lay.htmlGetAttrString() + " style='text-align: " + align + ";'";
xs << xml::StartTag(lay.htmlitemtag(), attrs);
}
depth_type const origdepth = pbegin->params().depth();
// open tag for this environment
- if (bstyle.labeltype == LABEL_ENUMERATE && bstyle.htmlattr().empty()) {
+ if (bstyle.labeltype == LABEL_ENUMERATE && bstyle.htmlclass().empty()) {
// In this case, we have to calculate the CSS class ourselves, each time
// through
// FIXME We assume in these cases that the standard enumeration counter