From 80cc7e99f224b99a7e79ae26812f2d35e3b2e597 Mon Sep 17 00:00:00 2001 From: Richard Heck Date: Tue, 27 Oct 2009 13:30:53 +0000 Subject: [PATCH] Add routine to create default CSS for layouts. JMarc (or others), please check the #ifdef here. If you'd prefer to do this some other way, let me know. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31766 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/Layout.cpp | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/src/Layout.cpp b/src/Layout.cpp index bb90723848..d72d53fe74 100644 --- a/src/Layout.cpp +++ b/src/Layout.cpp @@ -929,9 +929,32 @@ docstring Layout::htmlstyle() const { } +// NOTE There is a whole ton of stuff that could go into this. +// Things like bottomsep, topsep, and parsep could become various +// sorts of margins or padding, for example. But for now we are +// going to keep it simple. void Layout::makeDefaultCSS() const { -// FIXME just an empty hook for now. -// i'll get to this shortly. +#ifdef TEX2LYX + // tex2lyx does not have FontInfo::asCSS() + return; +#else + // this never needs to be redone, since reloading layouts will + // wipe out what we did before. + if (!htmldefaultstyle_.empty()) + return; + docstring const mainfontCSS = font.asCSS(); + if (!mainfontCSS.empty()) + htmldefaultstyle_ = + from_ascii(htmltag() + "." + defaultCSSClass() + " {\n") + + mainfontCSS + from_ascii("\n}\n"); + if (labelfont == font || htmllabeltag() == "NONE") + return; + docstring const labelfontCSS = labelfont.asCSS(); + if (!labelfontCSS.empty()) + htmldefaultstyle_ += + from_ascii(htmllabeltag() + "." + defaultCSSLabelClass() + " {\n") + + labelfontCSS + from_ascii("\n}\n"); +#endif } -- 2.39.2