Esempio n. 1
0
        public override string DoFormating(string vhod)
        {
            string startTag = String.Format(startF, Name);
            string endTag   = String.Format(endF, Name);
            int    start    = vhod.Length;

            while ((start = vhod.IndexOf(startTag)) >= 0)
            {
                int end = vhod.IndexOf(endTag);
                if (end > vhod.Length)
                {
                    throw new Exception("No closing tag for " + startTag);
                }
                int    valueStart   = start + startTag.Length;
                int    valueEnd     = end - valueStart;
                int    elementStart = start;
                int    elementEnd   = end + endTag.Length;
                string content      = vhod.Substring(valueStart, valueEnd);

                vhod =
                    vhod.Substring(0, elementStart) +
                    StartTag.Replace("$value", content).Braces() +
                    EndTag.Replace("$value", content).Braces() +
                    vhod.Substring(elementEnd);
            }

            return(vhod);
        }
Esempio n. 2
0
 public TagClass(string tag, int start, string text, char[] t)
 {
     this.Start    = start;
     this.EndTag   = "</" + tag + ">";
     this.baseText = text;
     if (baseText != null)
     {
         int s = IndexOf(t, '>', start);
         IsSingleTag   = Check(t, '/', s - 1);
         this.StartTag = baseText.Substring(start, s + 1 - start);
         if (IsSingleTag)
         {
             this.parameter = StartTag.Replace("<" + tag, "").Replace("/>", "");
         }
         else
         {
             this.parameter = StartTag.Replace("<" + tag, "").Replace(">", "");
         }
         //ClassName = Web.GetParameter(this.parameter, "class");
         //IdName = Web.GetParameter(this.parameter, "id");
     }
 }
Esempio n. 3
0
 public TagClass(string tag, int start, string text)
 {
     this.Start = start;
     //                this.StartTag = startTag;
     this.EndTag   = "</" + tag + ">";
     this.baseText = text;
     if (baseText != null)
     {
         int s      = baseText.IndexOf('>', start);
         int single = baseText.IndexOf("/>", start);
         this.StartTag = baseText.Substring(start, s + 1 - start);
         if (single > 0 && s > single)
         {
             IsSingleTag    = true;
             this.parameter = StartTag.Replace("<" + tag, "").Replace("/>", "");
         }
         else
         {
             this.parameter = StartTag.Replace("<" + tag, "").Replace(">", "");
         }
         //ClassName = Web.GetParameter(this.parameter, "class");
         //IdName = Web.GetParameter(this.parameter, "id");
     }
 }