From 157319b3f65419fa604d29f0741180f0247e8f15 Mon Sep 17 00:00:00 2001 From: Richard Heck Date: Tue, 6 Dec 2011 22:38:46 +0000 Subject: [PATCH 1/1] New layout tags specifically for CSS information. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@40411 a592a061-630c-0410-9148-cb99ea01b6c8 --- lib/scripts/layout2layout.py | 6 +++++- src/LaTeXFeatures.cpp | 5 ++++- src/TextClass.cpp | 14 +++++++++++++- src/TextClass.h | 4 ++++ 4 files changed, 26 insertions(+), 3 deletions(-) diff --git a/lib/scripts/layout2layout.py b/lib/scripts/layout2layout.py index 66caa57ece..fe7c4e175c 100644 --- a/lib/scripts/layout2layout.py +++ b/lib/scripts/layout2layout.py @@ -129,7 +129,7 @@ import os, re, string, sys # development/tools/updatelayouts.sh script to update all # layout files to the new format. -currentFormat = 35 +currentFormat = 36 def usage(prog_name): @@ -314,6 +314,10 @@ def convert(lines): i += 1 continue + if format == 35: + i += 1 + continue + if format == 34: match = re_InsetLayout2.match(lines[i]) if not match: diff --git a/src/LaTeXFeatures.cpp b/src/LaTeXFeatures.cpp index 4caa066688..b72054d9ff 100644 --- a/src/LaTeXFeatures.cpp +++ b/src/LaTeXFeatures.cpp @@ -1121,10 +1121,13 @@ docstring const LaTeXFeatures::getTClassHTMLPreamble() const } -docstring const LaTeXFeatures::getTClassHTMLStyles() const { +docstring const LaTeXFeatures::getTClassHTMLStyles() const +{ DocumentClass const & tclass = params_.documentClass(); odocstringstream tcpreamble; + tcpreamble << tclass.htmlstyles(); + list::const_iterator cit = usedLayouts_.begin(); list::const_iterator end = usedLayouts_.end(); for (; cit != end; ++cit) diff --git a/src/TextClass.cpp b/src/TextClass.cpp index 70390da289..92adfdc750 100644 --- a/src/TextClass.cpp +++ b/src/TextClass.cpp @@ -60,7 +60,7 @@ namespace lyx { // development/updatelayouts.sh script, to update the format of // all of our layout files. // -int const LAYOUT_FORMAT = 35; +int const LAYOUT_FORMAT = 36; namespace { @@ -190,6 +190,7 @@ enum TextClassTags { TC_CLASSOPTIONS, TC_PREAMBLE, TC_HTMLPREAMBLE, + TC_HTMLSTYLES, TC_PROVIDES, TC_REQUIRES, TC_LEFTMARGIN, @@ -204,6 +205,7 @@ enum TextClassTags { TC_FORMAT, TC_ADDTOPREAMBLE, TC_ADDTOHTMLPREAMBLE, + TC_ADDTOHTMLSTYLES, TC_DEFAULTMODULE, TC_PROVIDESMODULE, TC_EXCLUDESMODULE, @@ -216,6 +218,7 @@ namespace { LexerKeyword textClassTags[] = { { "addtohtmlpreamble", TC_ADDTOHTMLPREAMBLE }, + { "addtohtmlstyles", TC_ADDTOHTMLSTYLES }, { "addtopreamble", TC_ADDTOPREAMBLE }, { "citeformat", TC_CITEFORMAT }, { "classoptions", TC_CLASSOPTIONS }, @@ -228,6 +231,7 @@ namespace { { "float", TC_FLOAT }, { "format", TC_FORMAT }, { "htmlpreamble", TC_HTMLPREAMBLE }, + { "htmlstyles", TC_HTMLSTYLES }, { "htmltocsection", TC_HTMLTOCSECTION }, { "ifcounter", TC_IFCOUNTER }, { "ifstyle", TC_IFSTYLE }, @@ -568,6 +572,10 @@ TextClass::ReturnValues TextClass::read(Lexer & lexrc, ReadType rt) htmlpreamble_ = from_utf8(lexrc.getLongString("EndPreamble")); break; + case TC_HTMLSTYLES: + htmlstyles_ = from_utf8(lexrc.getLongString("EndStyles")); + break; + case TC_HTMLTOCSECTION: html_toc_section_ = from_utf8(trim(lexrc.getString())); break; @@ -580,6 +588,10 @@ TextClass::ReturnValues TextClass::read(Lexer & lexrc, ReadType rt) htmlpreamble_ += from_utf8(lexrc.getLongString("EndPreamble")); break; + case TC_ADDTOHTMLSTYLES: + htmlstyles_ += from_utf8(lexrc.getLongString("EndStyles")); + break; + case TC_PROVIDES: { lexrc.next(); string const feature = lexrc.getString(); diff --git a/src/TextClass.h b/src/TextClass.h index b3354898d5..a25338f111 100644 --- a/src/TextClass.h +++ b/src/TextClass.h @@ -264,6 +264,8 @@ protected: /// same, but for HTML output /// this is output as is to the header docstring htmlpreamble_; + /// same, but specifically for CSS information + docstring htmlstyles_; /// the paragraph style to use for TOCs, Bibliography, etc mutable docstring html_toc_section_; /// latex packages loaded by document class. @@ -401,6 +403,8 @@ public: docstring const & preamble() const { return preamble_; } /// docstring const & htmlpreamble() const { return htmlpreamble_; } + /// + docstring const & htmlstyles() const { return htmlstyles_; } /// the paragraph style to use for TOCs, Bibliography, etc /// we will attempt to calculate this if it was not given Layout const & htmlTOCLayout() const; -- 2.39.2