We should have a default tag for InsetLayout, too, I think. So here it is.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31777 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Richard Heck 2009-10-27 19:46:47 +00:00
parent 001b0d529d
commit df0fdb0d53
3 changed files with 22 additions and 16 deletions

View File

@ -327,6 +327,7 @@ InsetLayout URL
Color urllabel
Size Small
EndFont
HTMLIsBlock false
End
InsetLayout OptArg
@ -340,8 +341,6 @@ End
InsetLayout Info
Decoration conglomerate
HTMLTag span
HTMLAttr class='info'
HTMLStyle
span.info { font-family: sans-serif; }
EndHTMLStyle

View File

@ -351,6 +351,14 @@ InsetLayout::InsetLyXType translateLyXType(std::string const & str)
}
string const & InsetLayout::htmltag() const
{
if (htmltag_.empty())
htmltag_ = "span";
return htmltag_;
}
string const & InsetLayout::htmlattr() const
{
if (htmlattr_.empty())
@ -393,13 +401,11 @@ void InsetLayout::makeDefaultCSS() const
{
if (!htmldefaultstyle_.empty())
return;
if (!htmltag_.empty()) {
docstring const mainfontCSS = font_.asCSS();
if (!mainfontCSS.empty())
htmldefaultstyle_ =
from_ascii(htmltag() + "." + defaultCSSClass() + " {\n") +
mainfontCSS + from_ascii("\n}\n");
}
docstring const mainfontCSS = font_.asCSS();
if (!mainfontCSS.empty())
htmldefaultstyle_ =
from_ascii(htmltag() + "." + defaultCSSClass() + " {\n") +
mainfontCSS + from_ascii("\n}\n");
/*
At present, we do not have default tags, etc, for the label.
if (labelfont_ == font_)
@ -407,20 +413,21 @@ void InsetLayout::makeDefaultCSS() const
docstring const labelfontCSS = labelfont_.asCSS();
if (!labelfontCSS.empty())
htmldefaultstyle_ +=
. from_ascii(htmllabeltag() + "." + defaultCSSLabelClass() + " {\n") +
labelfontCSS + from_ascii("\n}\n");
from_ascii(htmllabeltag() + "." + defaultCSSLabelClass() + " {\n") +
labelfontCSS + from_ascii("\n}\n");
*/
}
docstring InsetLayout::htmlstyle() const
{
if (!htmlstyle_.empty() && !htmlforcecss_)
return htmlstyle_;
if (htmldefaultstyle_.empty())
if (htmldefaultstyle_.empty())
makeDefaultCSS();
docstring retval = htmldefaultstyle_;
if (!htmlstyle_.empty())
retval += '\n' + htmlstyle_;
retval += '\n' + htmlstyle_ + '\n';
return retval;
}

View File

@ -84,7 +84,7 @@ public:
///
docstring counter() const { return counter_; }
///
std::string const & htmltag() const { return htmltag_; }
std::string const & htmltag() const;
///
std::string const & htmlattr() const;
///
@ -160,8 +160,8 @@ private:
docstring counter_;
///
docstring preamble_;
/// The tag enclosing all the material in this inset. Default is none.
std::string htmltag_;
/// The tag enclosing all the material in this inset. Default is "span".
mutable std::string htmltag_;
/// Additional attributes for inclusion with the start tag. Default (if
/// a tag is provided) is: class="name".
mutable std::string htmlattr_;