private static void WriteTruncated(MarkupStreamWriter writer, StructuredText text, int maxLength) { if (text.TruncatedWriteTo(writer, maxLength)) { writer.WriteEllipsis(); } }
private static void WriteContext(MarkupStreamWriter writer, Substring context, int maxContextLength) { if (context.Length < maxContextLength) { writer.Write(context.ToString()); } else { int split = maxContextLength / 2; if (split > 0) { writer.Write(context.Extract(0, split).ToString()); writer.WriteEllipsis(); writer.Write(context.Extract(context.Length - split)); } } }