From: Richard Heck Date: Tue, 27 Oct 2009 19:46:47 +0000 (+0000) Subject: We should have a default tag for InsetLayout, too, I think. So here it is. X-Git-Tag: 2.0.0~5277 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=df0fdb0d53791dac1c46df8373d76c0d6b80e05b;p=features.git 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 --- diff --git a/lib/layouts/stdinsets.inc b/lib/layouts/stdinsets.inc index 417f0f9355..bd384cdfec 100644 --- a/lib/layouts/stdinsets.inc +++ b/lib/layouts/stdinsets.inc @@ -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 diff --git a/src/insets/InsetLayout.cpp b/src/insets/InsetLayout.cpp index c8ea237be1..b48a0625f5 100644 --- a/src/insets/InsetLayout.cpp +++ b/src/insets/InsetLayout.cpp @@ -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; } diff --git a/src/insets/InsetLayout.h b/src/insets/InsetLayout.h index 6edbb331fd..3c790d99e2 100644 --- a/src/insets/InsetLayout.h +++ b/src/insets/InsetLayout.h @@ -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_;