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
\begin_layout Plain Layout
0,1
\emph on
0
\emph default
,1
\end_layout
\end_inset
@ -15830,7 +15834,11 @@ HTMLLabelFirst
status collapsed
\begin_layout Plain Layout
0,1
\emph on
0
\emph default
,1
\end_layout
\end_inset
@ -15976,6 +15984,66 @@ div
.
\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
InsetLayout XHTML
\end_layout

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -76,7 +76,7 @@ import os, re, string, sys
# Added ContentAsLabel tag.
# 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
# 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";
// FIXME Language should be set properly.
os << "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n";
// FIXME Header
os << "<head>\n";
// FIXME Presumably need to set this right
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>TBA</title>\n";
os << "<title>" << features.htmlTitle() << "</title>\n";
os << "\n<!-- Text Class Preamble -->\n"
<< features.getTClassHTMLPreamble()

View File

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

View File

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

View File

@ -130,6 +130,8 @@ public:
///
docstring const & htmlpreamble() const { return htmlpreamble_; }
///
bool htmltitle() const { return htmltitle_; }
///
bool isParagraph() const { return latextype == LATEX_PARAGRAPH; }
///
bool isCommand() const { return latextype == LATEX_COMMAND; }
@ -347,6 +349,8 @@ private:
mutable docstring htmldefaultstyle_;
/// Any other info for the HTML header.
docstring htmlpreamble_;
/// Whether this is the <title> paragraph.
bool htmltitle_;
/// calculating this is expensive, so we cache it.
mutable std::string defaultcssclass_;
/// 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));
}
if (features.runparams().flavor == OutputParams::HTML
&& layout_->htmltitle()) {
features.setHTMLTitle(owner_->asString(AS_STR_INSETS));
}
// check the params.
if (!params_.spacing().isDefault())
features.require("setspace");