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.HasLeading()) styleAttributes[Markup.CSS_KEY_LINEHEIGHT] = section.Title.TotalLeading.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);
}
WriteMarkupAttributes(markup);
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);
}
}