private void PushElement(HtmlDtd.TagDefinition tagDef) { switch (tagDef.tagIndex) { case HtmlTagIndex.Title: case HtmlTagIndex.Comment: case HtmlTagIndex.Script: case HtmlTagIndex.Style: case HtmlTagIndex.NoEmbed: case HtmlTagIndex.NoFrames: insideComment = true; break; case HtmlTagIndex.A: if (insideAnchor) { EndAnchor(); } break; case HtmlTagIndex.Image: case HtmlTagIndex.Img: break; case HtmlTagIndex.TD: case HtmlTagIndex.TH: if (lineStarted) { output.OutputTabulation(1); } break; case HtmlTagIndex.P: if (!ignoreNextP) { EndParagraph(true); } nextParagraphCloseWideGap = true; break; case HtmlTagIndex.BR: case HtmlTagIndex.Option: EndLine(); break; case HtmlTagIndex.HR: EndParagraph(false); OutputText("________________________________"); EndParagraph(false); break; case HtmlTagIndex.OL: case HtmlTagIndex.UL: case HtmlTagIndex.Dir: case HtmlTagIndex.Menu: EndParagraph(listLevel == 0); if (listLevel < 10) { listLevel++; if (listLevel == 1) { listIndex = 1; listOrdered = (token.TagIndex == HtmlTagIndex.OL); } } nextParagraphCloseWideGap = false; break; case HtmlTagIndex.LI: EndParagraph(false); OutputText(" "); for (var i = 0; i < listLevel - 1; i++) { OutputText(" "); } if (listLevel > 1 || !listOrdered) { OutputText("*"); output.OutputSpace(3); } else { var num = listIndex.ToString(); OutputText(num); OutputText("."); output.OutputSpace(num.Length == 1 ? 2 : 1); listIndex++; } break; case HtmlTagIndex.DL: EndParagraph(true); break; case HtmlTagIndex.DT: if (lineStarted) { EndLine(); } break; case HtmlTagIndex.DD: if (lineStarted) { EndLine(); } break; case HtmlTagIndex.Pre: case HtmlTagIndex.PlainText: case HtmlTagIndex.Listing: case HtmlTagIndex.Xmp: EndParagraph(true); insidePre = true; break; case HtmlTagIndex.Font: case HtmlTagIndex.Span: break; default: if (tagDef.blockElement) { EndParagraph(false); } break; } ignoreNextP = false; if (tagDef.tagIndex == HtmlTagIndex.LI) { ignoreNextP = true; } }
private void PushElement(HtmlDtd.TagDefinition tagDef) { HtmlTagIndex tagIndex = tagDef.tagIndex; if (tagIndex <= HtmlTagIndex.Listing) { if (tagIndex <= HtmlTagIndex.DT) { if (tagIndex != HtmlTagIndex.A) { if (tagIndex == HtmlTagIndex.BR) { goto IL_193; } switch (tagIndex) { case HtmlTagIndex.Comment: break; case HtmlTagIndex.DD: if (lineStarted) { EndLine(); goto IL_2FF; } goto IL_2FF; case HtmlTagIndex.Del: case HtmlTagIndex.Dfn: case HtmlTagIndex.Div: goto IL_2F0; case HtmlTagIndex.Dir: goto IL_1BC; case HtmlTagIndex.DL: EndParagraph(true); goto IL_2FF; case HtmlTagIndex.DT: if (lineStarted) { EndLine(); goto IL_2FF; } goto IL_2FF; default: goto IL_2F0; } } else { if (insideAnchor) { EndAnchor(); goto IL_2FF; } goto IL_2FF; } } else if (tagIndex <= HtmlTagIndex.HR) { if (tagIndex == HtmlTagIndex.Font) { goto IL_2FF; } if (tagIndex != HtmlTagIndex.HR) { goto IL_2F0; } EndParagraph(false); OutputText("________________________________"); EndParagraph(false); goto IL_2FF; } else { switch (tagIndex) { case HtmlTagIndex.Image: case HtmlTagIndex.Img: goto IL_2FF; default: switch (tagIndex) { case HtmlTagIndex.LI: { EndParagraph(false); OutputText(" "); for (int i = 0; i < listLevel - 1; i++) { OutputText(" "); } if (listLevel > 1 || !listOrdered) { OutputText("*"); output.OutputSpace(3); goto IL_2FF; } string text = listIndex.ToString(); OutputText(text); OutputText("."); output.OutputSpace((text.Length == 1) ? 2 : 1); listIndex++; goto IL_2FF; } case HtmlTagIndex.Link: goto IL_2F0; case HtmlTagIndex.Listing: goto IL_2E0; default: goto IL_2F0; } //break; } } } else if (tagIndex <= HtmlTagIndex.Style) { if (tagIndex <= HtmlTagIndex.Script) { switch (tagIndex) { case HtmlTagIndex.Menu: case HtmlTagIndex.OL: goto IL_1BC; case HtmlTagIndex.Meta: case HtmlTagIndex.NextId: case HtmlTagIndex.NoBR: case HtmlTagIndex.NoScript: case HtmlTagIndex.Object: case HtmlTagIndex.OptGroup: case HtmlTagIndex.Param: goto IL_2F0; case HtmlTagIndex.NoEmbed: case HtmlTagIndex.NoFrames: break; case HtmlTagIndex.Option: goto IL_193; case HtmlTagIndex.P: if (!ignoreNextP) { EndParagraph(true); } nextParagraphCloseWideGap = true; goto IL_2FF; case HtmlTagIndex.PlainText: case HtmlTagIndex.Pre: goto IL_2E0; default: if (tagIndex != HtmlTagIndex.Script) { goto IL_2F0; } break; } } else { if (tagIndex == HtmlTagIndex.Span) { goto IL_2FF; } if (tagIndex != HtmlTagIndex.Style) { goto IL_2F0; } } } else if (tagIndex <= HtmlTagIndex.Title) { if (tagIndex != HtmlTagIndex.TD) { switch (tagIndex) { case HtmlTagIndex.TH: break; case HtmlTagIndex.Thead: goto IL_2F0; case HtmlTagIndex.Title: goto IL_13A; default: goto IL_2F0; } } if (lineStarted) { output.OutputTabulation(1); goto IL_2FF; } goto IL_2FF; } else { if (tagIndex == HtmlTagIndex.UL) { goto IL_1BC; } if (tagIndex != HtmlTagIndex.Xmp) { goto IL_2F0; } goto IL_2E0; } IL_13A: insideComment = true; goto IL_2FF; IL_193: EndLine(); goto IL_2FF; IL_1BC: EndParagraph(listLevel == 0); if (listLevel < 10) { listLevel++; if (listLevel == 1) { listIndex = 1; listOrdered = (token.TagIndex == HtmlTagIndex.OL); } } nextParagraphCloseWideGap = false; goto IL_2FF; IL_2E0: EndParagraph(true); insidePre = true; goto IL_2FF; IL_2F0: if (tagDef.blockElement) { EndParagraph(false); } IL_2FF: ignoreNextP = false; if (tagDef.tagIndex == HtmlTagIndex.LI) { ignoreNextP = true; } }