public override bool Process(Token t, TreeBuilder tb) { if (t.IsStartTag()) { Token.StartTag startTag = t.AsStartTag(); String name = startTag.Name(); if (StringUtil.In(name, "th", "td")) { tb.ClearStackToTableRowContext(); tb.Insert(startTag); tb.Transition(InCell); tb.InsertMarkerToFormattingElements(); } else if (StringUtil.In(name, "caption", "col", "colgroup", "tbody", "tfoot", "thead", "tr")) { return HandleMissingTr(t, tb); } else { return AnythingElse(t, tb); } } else if (t.IsEndTag()) { Token.EndTag endTag = t.AsEndTag(); string name = endTag.Name(); if (name.Equals("tr")) { if (!tb.InTableScope(name)) { tb.Error(this); // frag return false; } tb.ClearStackToTableRowContext(); tb.Pop(); // tr tb.Transition(InTableBody); } else if (name.Equals("table")) { return HandleMissingTr(t, tb); } else if (StringUtil.In(name, "tbody", "tfoot", "thead")) { if (!tb.InTableScope(name)) { tb.Error(this); return false; } tb.Process(new Token.EndTag("tr")); return tb.Process(t); } else if (StringUtil.In(name, "body", "caption", "col", "colgroup", "html", "td", "th")) { tb.Error(this); return false; } else { return AnythingElse(t, tb); } } else { return AnythingElse(t, tb); } return true; }