示例#1
0
 private static void WriteTruncated(MarkupStreamWriter writer, StructuredText text, int maxLength)
 {
     if (text.TruncatedWriteTo(writer, maxLength))
     {
         writer.WriteEllipsis();
     }
 }
示例#2
0
 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));
         }
     }
 }