mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-26 11:16:55 +00:00
Separate HTML preamble information. This could be used for javascript,
or anything else one would like to add to the header. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@29967 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
397ebabfa4
commit
70899f0c15
@ -1377,7 +1377,11 @@ void Buffer::writeLyXHTMLSource(odocstream & os,
|
||||
// FIXME Get this during validation? What about other meta-data?
|
||||
os << "<title>TBA</title>\n";
|
||||
|
||||
docstring styleinfo = features.getTClassHTMLStyles();
|
||||
os << features.getTClassHTMLPreamble();
|
||||
|
||||
os << '\n';
|
||||
|
||||
docstring const styleinfo = features.getTClassHTMLStyles();
|
||||
if (!styleinfo.empty()) {
|
||||
os << "<style type='text/css'>\n";
|
||||
os << styleinfo;
|
||||
|
@ -931,12 +931,35 @@ docstring const LaTeXFeatures::getTClassPreamble() const
|
||||
}
|
||||
|
||||
|
||||
docstring const LaTeXFeatures::getTClassHTMLStyles() const {
|
||||
docstring const LaTeXFeatures::getTClassHTMLPreamble() const {
|
||||
DocumentClass const & tclass = params_.documentClass();
|
||||
odocstringstream tcpreamble;
|
||||
|
||||
tcpreamble << tclass.htmlpreamble();
|
||||
|
||||
list<docstring>::const_iterator cit = usedLayouts_.begin();
|
||||
list<docstring>::const_iterator end = usedLayouts_.end();
|
||||
for (; cit != end; ++cit)
|
||||
tcpreamble << tclass[*cit].htmlpreamble();
|
||||
|
||||
cit = usedInsetLayouts_.begin();
|
||||
end = usedInsetLayouts_.end();
|
||||
TextClass::InsetLayouts const & ils = tclass.insetLayouts();
|
||||
for (; cit != end; ++cit) {
|
||||
TextClass::InsetLayouts::const_iterator it = ils.find(*cit);
|
||||
if (it == ils.end())
|
||||
continue;
|
||||
tcpreamble << it->second.htmlpreamble();
|
||||
}
|
||||
|
||||
return tcpreamble.str();
|
||||
}
|
||||
|
||||
|
||||
docstring const LaTeXFeatures::getTClassHTMLStyles() const {
|
||||
DocumentClass const & tclass = params_.documentClass();
|
||||
odocstringstream tcpreamble;
|
||||
|
||||
list<docstring>::const_iterator cit = usedLayouts_.begin();
|
||||
list<docstring>::const_iterator end = usedLayouts_.end();
|
||||
for (; cit != end; ++cit)
|
||||
|
@ -61,6 +61,8 @@ public:
|
||||
docstring const getTClassI18nPreamble(bool use_babel) const;
|
||||
///
|
||||
docstring const getTClassHTMLStyles() const;
|
||||
///
|
||||
docstring const getTClassHTMLPreamble() const;
|
||||
/// The sgml definitions needed by the document (docbook)
|
||||
docstring const getLyXSGMLEntities() const;
|
||||
/// The SGML Required to include the files added with includeFile();
|
||||
|
@ -98,6 +98,7 @@ enum LayoutTags {
|
||||
LT_HTMLITEMATTR,
|
||||
LT_HTMLLABEL,
|
||||
LT_HTMLLABELATTR,
|
||||
LT_HTMLPREAMBLE,
|
||||
LT_HTMLSTYLE,
|
||||
LT_INTITLE // keep this last!
|
||||
};
|
||||
@ -164,7 +165,8 @@ bool Layout::read(Lexer & lex, TextClass const & tclass)
|
||||
{ "htmlitemattr", LT_HTMLITEMATTR },
|
||||
{ "htmllabel", LT_HTMLLABEL },
|
||||
{ "htmllabelattr", LT_HTMLLABELATTR },
|
||||
{ "htmlstyle", LT_HTMLSTYLE },
|
||||
{ "htmlpremable", LT_HTMLPREAMBLE },
|
||||
{ "htmlstyle", LT_HTMLSTYLE },
|
||||
{ "htmltag", LT_HTMLTAG },
|
||||
{ "innertag", LT_INNERTAG },
|
||||
{ "intitle", LT_INTITLE },
|
||||
@ -505,6 +507,10 @@ bool Layout::read(Lexer & lex, TextClass const & tclass)
|
||||
htmlstyle_ = from_utf8(lex.getLongString("EndHTMLStyle"));
|
||||
break;
|
||||
|
||||
case LT_HTMLPREAMBLE:
|
||||
htmlpreamble_ = from_utf8(lex.getLongString("EndPreamble"));
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
lex.popTable();
|
||||
|
@ -122,6 +122,8 @@ public:
|
||||
std::string const & htmllabelattr() const { return htmllabelattr_; }
|
||||
///
|
||||
docstring const & htmlstyle() const { return htmlstyle_; }
|
||||
///
|
||||
docstring const & htmlpreamble() const { return htmlpreamble_; }
|
||||
///
|
||||
docstring const & labelstring_appendix() const {
|
||||
return labelstring_appendix_;
|
||||
@ -306,6 +308,8 @@ private:
|
||||
std::string htmllabelattr_;
|
||||
/// CSS information needed by this layout.
|
||||
docstring htmlstyle_;
|
||||
/// Any other info for the HTML header.
|
||||
docstring htmlpreamble_;
|
||||
/// This is the `category' for this layout. The following are
|
||||
/// recommended basic categories: FrontMatter, BackMatter, MainText,
|
||||
/// Section, Starred, List, Theorem.
|
||||
|
@ -255,6 +255,7 @@ protected:
|
||||
/// preamble text to support layout styles
|
||||
docstring preamble_;
|
||||
/// same, but for HTML output
|
||||
/// this is output as is to the header
|
||||
docstring htmlpreamble_;
|
||||
/// latex packages loaded by document class.
|
||||
std::set<std::string> provides_;
|
||||
|
@ -84,6 +84,7 @@ bool InsetLayout::read(Lexer & lex, TextClass const & tclass)
|
||||
IL_HTMLTAG,
|
||||
IL_HTMLATTR,
|
||||
IL_HTMLSTYLE,
|
||||
IL_HTMLPREAMBLE,
|
||||
IL_INTOC,
|
||||
IL_LABELFONT,
|
||||
IL_LABELSTRING,
|
||||
@ -112,6 +113,7 @@ bool InsetLayout::read(Lexer & lex, TextClass const & tclass)
|
||||
{ "forceplain", IL_FORCEPLAIN },
|
||||
{ "freespacing", IL_FREESPACING },
|
||||
{ "htmlattr", IL_HTMLATTR },
|
||||
{ "htmlpreamble", IL_HTMLPREAMBLE },
|
||||
{ "htmlstyle", IL_HTMLSTYLE },
|
||||
{ "htmltag", IL_HTMLTAG },
|
||||
{ "intoc", IL_INTOC },
|
||||
@ -273,6 +275,9 @@ bool InsetLayout::read(Lexer & lex, TextClass const & tclass)
|
||||
case IL_HTMLSTYLE:
|
||||
htmlstyle_ = from_utf8(lex.getLongString("EndHTMLStyle"));
|
||||
break;
|
||||
case IL_HTMLPREAMBLE:
|
||||
htmlpreamble_ = from_utf8(lex.getLongString("EndPreamble"));
|
||||
break;
|
||||
case IL_REQUIRES: {
|
||||
lex.eatLine();
|
||||
vector<string> const req
|
||||
|
@ -84,6 +84,8 @@ public:
|
||||
std::string const & htmlattr() const { return htmlattr_; }
|
||||
///
|
||||
docstring htmlstyle() const { return htmlstyle_; }
|
||||
///
|
||||
docstring htmlpreamble() const { return htmlpreamble_; }
|
||||
///
|
||||
std::set<std::string> requires() const { return requires_; };
|
||||
///
|
||||
@ -137,6 +139,8 @@ private:
|
||||
std::string htmlattr_;
|
||||
///
|
||||
docstring htmlstyle_;
|
||||
///
|
||||
docstring htmlpreamble_;
|
||||
///
|
||||
std::set<std::string> requires_;
|
||||
///
|
||||
|
Loading…
Reference in New Issue
Block a user