예제 #1
0
 public StringBuilder AddTextTag(StringBuilder sb, string name, TextGroupOptions options = null)
 {
     sb.AddTag("b", content: name);
     sb.Append(" ");
     sb.TextGroup(group: name, options: options);
     return(sb);
 }
예제 #2
0
        public static string LinksOrText(TextGroupOptions options = null, bool breaks = false)
        {
            var tg = SB().TextGroup(options: options);
            List <StringBuilder> list = new List <StringBuilder>();

            list.Add(SB().AddLink(content: tg.ToString(), cl: "[a-zA-Z0-9]+", classoptional: true));
            list.Add(tg.TextGroup());
            if (breaks)
            {
                list.Add(SB("<br>"));
            }


            return(((list.ToArray()).Options(min: 1, max: -1)).ToString());
        }
예제 #3
0
        public static StringBuilder TextGroup(this StringBuilder s, string group = null, TextGroupOptions options = null, int min = 1, int max = -1)
        {
            TextGroupOptions opt = (options != null) ? options : new TextGroupOptions();

            string textPattern = "";

            if (opt.dash)
            {
                textPattern += "-";
            }
            if (opt.period)
            {
                textPattern += "\\.";
            }
            textPattern += "#×A-Za-z0-9'";
            if (opt.space)
            {
                textPattern += " ";
            }
            if (opt.colon)
            {
                textPattern += ":";
            }
            if (opt.semicolon)
            {
                textPattern += ";";
            }
            if (opt.plus)
            {
                textPattern += "+";
            }
            if (opt.comma)
            {
                textPattern += ",";
            }
            if (opt.paren)
            {
                textPattern += "()";
            }
            if (opt.square)
            {
                textPattern += "\\[\\]";
            }


            return(s.Group(text: textPattern.Wrap("[]").Quantify(min, max), name: group));
        }
예제 #4
0
 public static StringBuilder LinksOrText(this StringBuilder sb, TextGroupOptions options = null, bool breaks = false)
 {
     return(sb.Append(LinksOrText(options, breaks)));
 }