/// <summary> /// Examines the given ElementClass and modifies the internal WhitespaceBuffer state /// and output buffer accordingly. Returns true if the given ElementClass was whitespace /// and false if not; in the former case, the corresponding element should not be added /// to the output buffer. /// </summary> public static bool ProcessElementClass(ref WhitespaceBuffer whitespace, StringBuilder output, ElementClass elclass, bool isBeginTag) { switch (elclass) { case ElementClass.Paragraph: case ElementClass.Break: case ElementClass.Space: if (whitespace == null) { whitespace = new WhitespaceBuffer(); } whitespace.Promote((WhitespaceClass)elclass); return(true); case ElementClass.Block: case ElementClass.NotBlock: if (whitespace != null) { output.Append(whitespace.Render(elclass)); whitespace = null; } return(false); default: Trace.Fail("Unknown element class " + elclass.ToString()); return(false); } }
/// <summary> /// Examines the given ElementClass and modifies the internal WhitespaceBuffer state /// and output buffer accordingly. Returns true if the given ElementClass was whitespace /// and false if not; in the former case, the corresponding element should not be added /// to the output buffer. /// </summary> public static bool ProcessElementClass(ref WhitespaceBuffer whitespace, StringBuilder output, ElementClass elclass, bool isBeginTag) { switch (elclass) { case ElementClass.Paragraph: case ElementClass.Break: case ElementClass.Space: if (whitespace == null) whitespace = new WhitespaceBuffer(); whitespace.Promote((WhitespaceClass)elclass); return true; case ElementClass.Block: case ElementClass.NotBlock: if (whitespace != null) { output.Append(whitespace.Render(elclass)); whitespace = null; } return false; default: Trace.Fail("Unknown element class " + elclass.ToString()); return false; } }