Collect the title for XHTML output, and use it.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33097 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Richard Heck 2010-01-19 19:43:15 +00:00
parent 557c705cbb
commit 1832a388c5
27 changed files with 116 additions and 8 deletions

View File

@ -15600,7 +15600,11 @@ HTMLForceCSS
status collapsed status collapsed
\begin_layout Plain Layout \begin_layout Plain Layout
0,1
\emph on
0
\emph default
,1
\end_layout \end_layout
\end_inset \end_inset
@ -15830,7 +15834,11 @@ HTMLLabelFirst
status collapsed status collapsed
\begin_layout Plain Layout \begin_layout Plain Layout
0,1
\emph on
0
\emph default
,1
\end_layout \end_layout
\end_inset \end_inset
@ -15976,6 +15984,66 @@ div
. .
\end_layout \end_layout
\begin_layout Description
\begin_inset Flex CharStyle:Code
status collapsed
\begin_layout Plain Layout
HTMLTitle
\end_layout
\end_inset
[
\begin_inset Flex CharStyle:Code
status collapsed
\begin_layout Plain Layout
\emph on
0
\emph default
,1
\end_layout
\end_inset
] Marks this style as the one to be used to generate the
\begin_inset Flex CharStyle:Code
status collapsed
\begin_layout Plain Layout
<title>
\end_layout
\end_inset
tag for the XHTML file.
By default, it is false.
The
\begin_inset Flex CharStyle:Code
status collapsed
\begin_layout Plain Layout
stdtitle.inc
\end_layout
\end_inset
file sets it to true for the
\begin_inset Flex CharStyle:Code
status collapsed
\begin_layout Plain Layout
title
\end_layout
\end_inset
environment.
\end_layout
\begin_layout Subsection \begin_layout Subsection
InsetLayout XHTML InsetLayout XHTML
\end_layout \end_layout

View File

@ -46,6 +46,7 @@ Style Title
Series Bold Series Bold
Size Larger Size Larger
EndFont EndFont
HTMLTitle true
End End

View File

@ -44,6 +44,7 @@ Style Title
Size Huge Size Huge
EndFont EndFont
Align Center Align Center
HTMLTitle true
End End

View File

@ -192,6 +192,7 @@ Style Title
ParSep 1.5 ParSep 1.5
Align Center Align Center
AlignPossible Left, Right, Center AlignPossible Left, Right, Center
HTMLTitle true
End End

View File

@ -51,6 +51,7 @@ Style Title
Size Largest Size Largest
Series Bold Series Bold
EndFont EndFont
HTMLTitle true
End End

View File

@ -266,6 +266,7 @@ Style Title
Series Bold Series Bold
Size Largest Size Largest
EndFont EndFont
HTMLTitle true
End End
@ -286,6 +287,7 @@ Style LaTeX_Title
Series Bold Series Bold
Size Largest Size Largest
EndFont EndFont
HTMLTitle true
End End

View File

@ -105,6 +105,7 @@ Style Title
Series Bold Series Bold
Size Largest Size Largest
EndFont EndFont
HTMLTitle true
End End

View File

@ -67,6 +67,7 @@ Style Title
Font Font
Size Largest Size Largest
EndFont EndFont
HTMLTitle true
End End

View File

@ -43,6 +43,7 @@ Style Title
Preamble Preamble
\newcommand{\settitle}[1]{\def\theTitle{#1}} \newcommand{\settitle}[1]{\def\theTitle{#1}}
EndPreamble EndPreamble
HTMLTitle true
End End

View File

@ -69,6 +69,7 @@ Style Title
Font Font
Size Largest Size Largest
EndFont EndFont
HTMLTitle true
End End

View File

@ -107,7 +107,7 @@ Style Title
Series Bold Series Bold
Size LARGE Size LARGE
EndFont EndFont
HTMLTitle true
End End
Style Address Style Address

View File

@ -120,6 +120,7 @@ Style Title
Font Font
Size Largest Size Largest
EndFont EndFont
HTMLTitle true
End End

View File

@ -123,6 +123,7 @@ Style Title
Series Bold Series Bold
Size Largest Size Largest
EndFont EndFont
HTMLTitle true
End End

View File

@ -150,6 +150,7 @@ Style SubTitle
Series Medium Series Medium
Size Large Size Large
EndFont EndFont
HTMLTitle false
End End
@ -161,6 +162,7 @@ Style Institution
Series Medium Series Medium
Size Normal Size Normal
EndFont EndFont
HTMLTitle false
End End

View File

@ -56,6 +56,7 @@ Style Title
Size Largest Size Largest
Color Blue Color Blue
EndFont EndFont
HTMLTitle true
End End
### ###

View File

@ -189,6 +189,7 @@ Style Title
CopyStyle Name CopyStyle Name
LatexName title LatexName title
LabelString "Title:" LabelString "Title:"
HTMLTitle true
End End

View File

@ -271,6 +271,7 @@ Style Title
LatexName setkomavar LatexName setkomavar
LatexParam {title} LatexParam {title}
LabelString "Title:" LabelString "Title:"
HTMLTitle true
End End

View File

@ -198,6 +198,7 @@ Style Title
Series Bold Series Bold
Size Larger Size Larger
EndFont EndFont
HTMLTitle true
End End

View File

@ -135,6 +135,7 @@ Style Title
Series Bold Series Bold
Size Largest Size Largest
EndFont EndFont
HTMLTitle true
End End

View File

@ -61,6 +61,7 @@ Style Title
Size Largest Size Largest
EndFont EndFont
HTMLTag h1 HTMLTag h1
HTMLTitle true
End End

View File

@ -28,6 +28,7 @@ End
Style Title* Style Title*
CopyStyle Title CopyStyle Title
LatexName title* LatexName title*
HTMLTitle true
End End
Style TOC_Title Style TOC_Title

View File

@ -76,7 +76,7 @@ import os, re, string, sys
# Added ContentAsLabel tag. # Added ContentAsLabel tag.
# Incremented to format 21, 12 January 2010 by rgh # Incremented to format 21, 12 January 2010 by rgh
# Added HTMLTocLayout tag. # Added HTMLTocLayout and HTMLTitle tags.
# Do not forget to document format change in Customization # Do not forget to document format change in Customization
# Manual (section "Declaring a new text class"). # Manual (section "Declaring a new text class").

View File

@ -1506,12 +1506,10 @@ void Buffer::writeLyXHTMLSource(odocstream & os,
os << "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN\" \"http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd\">\n"; os << "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN\" \"http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd\">\n";
// FIXME Language should be set properly. // FIXME Language should be set properly.
os << "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n"; os << "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n";
// FIXME Header
os << "<head>\n"; os << "<head>\n";
// FIXME Presumably need to set this right // FIXME Presumably need to set this right
os << "<meta http-equiv=\"Content-type\" content=\"text/html;charset=UTF-8\" />\n"; os << "<meta http-equiv=\"Content-type\" content=\"text/html;charset=UTF-8\" />\n";
// FIXME Get this during validation? What about other meta-data? os << "<title>" << features.htmlTitle() << "</title>\n";
os << "<title>TBA</title>\n";
os << "\n<!-- Text Class Preamble -->\n" os << "\n<!-- Text Class Preamble -->\n"
<< features.getTClassHTMLPreamble() << features.getTClassHTMLPreamble()

View File

@ -119,6 +119,10 @@ public:
void inFloat(bool const b) { in_float_ = b; } void inFloat(bool const b) { in_float_ = b; }
/// Runparams that will be used for exporting this file. /// Runparams that will be used for exporting this file.
OutputParams const & runparams() const { return runparams_; } OutputParams const & runparams() const { return runparams_; }
///
void setHTMLTitle(docstring const & t) { htmltitle_ = t; }
///
docstring const & htmlTitle() const { return htmltitle_; }
private: private:
/// ///
@ -163,6 +167,8 @@ private:
OutputParams const & runparams_; OutputParams const & runparams_;
/// ///
bool in_float_; bool in_float_;
///
docstring htmltitle_;
}; };

View File

@ -103,6 +103,7 @@ enum LayoutTags {
LT_HTMLSTYLE, LT_HTMLSTYLE,
LT_HTMLFORCECSS, LT_HTMLFORCECSS,
LT_INPREAMBLE, LT_INPREAMBLE,
LT_HTMLTITLE,
LT_INTITLE // keep this last! LT_INTITLE // keep this last!
}; };
@ -144,6 +145,7 @@ Layout::Layout()
commanddepth = 0; commanddepth = 0;
htmllabelfirst_ = false; htmllabelfirst_ = false;
htmlforcecss_ = false; htmlforcecss_ = false;
htmltitle_ = false;
} }
@ -176,6 +178,7 @@ bool Layout::read(Lexer & lex, TextClass const & tclass)
{ "htmlpremable", LT_HTMLPREAMBLE }, { "htmlpremable", LT_HTMLPREAMBLE },
{ "htmlstyle", LT_HTMLSTYLE }, { "htmlstyle", LT_HTMLSTYLE },
{ "htmltag", LT_HTMLTAG }, { "htmltag", LT_HTMLTAG },
{ "htmltitle", LT_HTMLTITLE },
{ "innertag", LT_INNERTAG }, { "innertag", LT_INNERTAG },
{ "inpreamble", LT_INPREAMBLE }, { "inpreamble", LT_INPREAMBLE },
{ "intitle", LT_INTITLE }, { "intitle", LT_INTITLE },
@ -530,7 +533,10 @@ bool Layout::read(Lexer & lex, TextClass const & tclass)
case LT_HTMLPREAMBLE: case LT_HTMLPREAMBLE:
htmlpreamble_ = from_utf8(lex.getLongString("EndPreamble")); htmlpreamble_ = from_utf8(lex.getLongString("EndPreamble"));
break; break;
case LT_HTMLTITLE:
lex >> htmltitle_;
break;
} }
} }
lex.popTable(); lex.popTable();

View File

@ -130,6 +130,8 @@ public:
/// ///
docstring const & htmlpreamble() const { return htmlpreamble_; } docstring const & htmlpreamble() const { return htmlpreamble_; }
/// ///
bool htmltitle() const { return htmltitle_; }
///
bool isParagraph() const { return latextype == LATEX_PARAGRAPH; } bool isParagraph() const { return latextype == LATEX_PARAGRAPH; }
/// ///
bool isCommand() const { return latextype == LATEX_COMMAND; } bool isCommand() const { return latextype == LATEX_COMMAND; }
@ -347,6 +349,8 @@ private:
mutable docstring htmldefaultstyle_; mutable docstring htmldefaultstyle_;
/// Any other info for the HTML header. /// Any other info for the HTML header.
docstring htmlpreamble_; docstring htmlpreamble_;
/// Whether this is the <title> paragraph.
bool htmltitle_;
/// calculating this is expensive, so we cache it. /// calculating this is expensive, so we cache it.
mutable std::string defaultcssclass_; mutable std::string defaultcssclass_;
/// This is the `category' for this layout. The following are /// This is the `category' for this layout. The following are

View File

@ -1086,6 +1086,11 @@ void Paragraph::Private::validate(LaTeXFeatures & features) const
features.addPreambleSnippet(to_utf8(d)); features.addPreambleSnippet(to_utf8(d));
} }
if (features.runparams().flavor == OutputParams::HTML
&& layout_->htmltitle()) {
features.setHTMLTitle(owner_->asString(AS_STR_INSETS));
}
// check the params. // check the params.
if (!params_.spacing().isDefault()) if (!params_.spacing().isDefault())
features.require("setspace"); features.require("setspace");