Exemplo n.º 1
0
 public void GetOpenTag()
 {
     var proc = new Processor("_ololo_", 0);
     var openTag = new Tag(0, "_");
     var tags = proc.FindFontTags();
     var res = proc.GetOpenTag(tags);
     Assert.AreEqual(res, openTag);
 }
Exemplo n.º 2
0
 public string GetMissingText(int lastIndex, Tag openTag)
 {
     return Text.Substring(lastIndex ,openTag.Index - lastIndex);
 }
Exemplo n.º 3
0
 public void NotGetInsideTag()
 {
     var proc = new Processor("ol_olo", 1);
     var openTag = new Tag(0, "_");
     var tags = proc.FindFontTags();
     var res = proc.GetOpenTag(tags);
     Assert.Null(res);
 }
Exemplo n.º 4
0
 public void DeleteUsedTags(Tag closeTag, Queue<Tag> tags)
 {
     while (tags.Count != 0 && tags.Peek().Index <= closeTag.Index)
         tags.Dequeue();
 }
Exemplo n.º 5
0
 public string JoinTagsAndText(Tag openTag, Tag closeTag, string substring)
 {
     return "<" + SignatureOfTags[openTag.Type] + ">" + substring + "</" + SignatureOfTags[closeTag.Type] + ">";
 }
Exemplo n.º 6
0
 public string GetSubstringBetweenTags(Tag openTag, Tag closeTag)
 {
     var endOfOpenTag = openTag.Index + openTag.Length;
     var substr = Text.Substring(endOfOpenTag, closeTag.Index - endOfOpenTag);
     if (closeTag.Type != "`")
         substr = new Processor(substr, 1).MarkText();
     return substr;
 }
Exemplo n.º 7
0
 public Tag GetPairTag(Tag openTag, Queue<Tag> tags)
 {
     try
     {
         return tags
             .ToList()
             .Where(x => x.Index != 0)
             .Where(x => Text[x.Index - 1] != '\\')
             .Where(x => x.Length + x.Index == Text.Length ||
                 char.IsWhiteSpace(Text[x.Index + x.Length]) || char.IsPunctuation(Text[x.Index + x.Length]))
             .First(x => x.Index > openTag.Index && string.Equals(x.Type, openTag.Type));
     }
     catch (Exception)
     {
         return null;
     }
 }
Exemplo n.º 8
0
 protected bool Equals(Tag other)
 {
     return Index == other.Index && string.Equals(Type, other.Type) && Length == other.Length;
 }