/**
* Writes the HTML representation of a section.
*
* @param section the section to write
* @param indent the indentation
*/
protected void WriteSection(Section section, int indent)
{
if (section.Title != null)
{
int depth = section.Depth - 1;
if (depth > 5)
{
depth = 5;
}
Properties styleAttributes = new Properties();
if (section.Title.LeadingDefined)
{
styleAttributes[MarkupTags.CSS_KEY_LINEHEIGHT] = section.Title.Leading.ToString() + "pt";
}
// start tag
AddTabs(indent);
WriteStart(HtmlTags.H[depth]);
Write(section.Title.Font, styleAttributes);
String alignment = HtmlEncoder.GetAlignment(section.Title.Alignment);
if (!"".Equals(alignment))
{
Write(HtmlTags.ALIGN, alignment);
}
if (HasMarkupAttributes(section.Title))
{
WriteMarkupAttributes(section.Title);
}
os.WriteByte(GT);
currentfont.Push(section.Title.Font);
// contents
foreach (IElement i in section.Title)
{
Write(i, indent + 1);
}
// end tag
AddTabs(indent);
WriteEnd(HtmlTags.H[depth]);
currentfont.Pop();
}
foreach (IElement i in section)
{
Write(i, indent);
}
}