Beispiel #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>();
 }
Beispiel #2
0
        public void Should_generate_unique_keys()
        {
            var a = BlockUtilities.GenerateKey();
            var b = BlockUtilities.GenerateKey();

            Assert.NotEqual(a, b);
        }
Beispiel #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>();
 }
Beispiel #4
0
 protected override string GetMark(HtmlNode node) => _key ?? (_key = BlockUtilities.GenerateKey());