示例#1
0
 /// <summary>
 /// Create a span model with customization options
 /// </summary>
 /// <param name="type">The type of the span, default is 'span'</param>
 /// <param name="text">The text to set in the span model</param>
 public SpanModel(string type = null, string text = null)
 {
     Type  = type ?? "span";
     Text  = text ?? string.Empty;
     Key   = BlockUtilities.GenerateKey();
     Marks = new List <string>();
 }
示例#2
0
        public void Should_generate_unique_keys()
        {
            var a = BlockUtilities.GenerateKey();
            var b = BlockUtilities.GenerateKey();

            Assert.NotEqual(a, b);
        }
示例#3
0
 /// <summary>
 /// Create a block model with customization options
 /// </summary>
 /// <param name="type">The type of the block, default is 'block'</param>
 /// <param name="style">The style of the block, default is 'normal'</param>
 /// <param name="listItem">Specifies the type of a list item</param>
 /// <param name="level">Specifies the indentation level of a list item</param>
 public BlockModel(string type = null, string style = null, string listItem = null, int?level = null)
 {
     Type     = type ?? "block";
     Style    = style ?? "normal";
     ListItem = listItem;
     Level    = level;
     Key      = BlockUtilities.GenerateKey();
     Children = new List <SpanModel>();
     MarkDefs = new List <MarkDefModel>();
 }
示例#4
0
 protected override string GetMark(HtmlNode node) => _key ?? (_key = BlockUtilities.GenerateKey());