Exemplo n.º 1
0
        public bool Process(WikiDocument doc, TagObj obj)
        {
            WikiHeader summary;
            object     summaryText = obj[SUMMARY];

            if (summaryText != null)
            {
                obj[SUMMARY]  = null;
                summary       = new WikiHeader();
                summary.level = 1;
                summary.name  = PAGENAME;
                string sum = summaryText.ToString();
                if (String.IsNullOrEmpty(sum))
                {
                    sum = PAGENAME;
                }
                summary.text.Add(sum);
                doc.headers.Insert(0, summary);
            }
            WikiHeader head0 = doc.headers.Count > 0 ? doc.headers[0] : null;

            if ((head0 == null) || (!head0.name.Equals(PAGENAME)))
            {
                summary       = new WikiHeader();
                summary.level = 1;
                summary.name  = PAGENAME;
                summary.text.Add(PAGENAME);
                doc.headers.Insert(0, summary);
            }
            return(true);
        }
Exemplo n.º 2
0
        public bool Process(WikiDocument doc, TagObj obj)
        {
            WikiHeader contact;

            contact = doc.FindHeader("Contact Information");
            if (contact != null)
            {
                int i = 0;
                while (i < contact.text.Count)
                {
                    string line = contact.text[i];
                    if (!String.IsNullOrEmpty(line))
                    {
                        if (line.StartsWith(":"))
                        {
                            line = line.Trim().Substring(1);
                            if (String.IsNullOrEmpty(line))
                            {
                                contact.text.RemoveAt(i);
                                continue;
                            }
                            if (line.StartsWith("Tel:"))
                            {
                                string tel = line.Substring("Tel:".Length).Trim();
                                if (String.IsNullOrEmpty(tel))
                                {
                                    contact.text.RemoveAt(i);
                                    continue;
                                }
                            }
                            else if (line.StartsWith("Fax:"))
                            {
                                string tel = line.Substring("Fax:".Length).Trim();
                                if (String.IsNullOrEmpty(tel))
                                {
                                    contact.text.RemoveAt(i);
                                    continue;
                                }
                            }
                            else if (line.StartsWith("Info:"))
                            {
                                string tel = line.Substring("Info:".Length).Trim();
                                if (String.IsNullOrEmpty(tel))
                                {
                                    contact.text.RemoveAt(i);
                                    continue;
                                }
                            }
                        }
                        else if (line.EndsWith("http://"))
                        {
                            contact.text[i] = line.Substring(0, line.Length - "http://".Length);
                        }
                    }
                    i++;
                }
            }
            return(true);
        }
Exemplo n.º 3
0
        public bool Process(WikiDocument doc)
        {
            TagObj obj = new TagObj(doc);

            for (int i = 0; i < fixes.Length; i++)
            {
                fixes[i].Process(doc, obj);
            }
            obj.Update();
            return(true);
        }
Exemplo n.º 4
0
        public bool Process(WikiDocument doc, TagObj obj)
        {
            string str = obj[STATUS_STR];
            Status status;

            try {
                status = (Status)Enum.Parse(typeof(Status), str.ToString().ToUpper());
            }
            catch {
                status = Status.UNKNOWN;
            }
            obj[STATUS_STR] = status.ToString().ToUpper();
            return(true);
        }
Exemplo n.º 5
0
        public bool Process(WikiDocument doc, TagObj obj)
        {
            string val = obj[field];

            if (!String.IsNullOrEmpty(val))
            {
                string newVal = null;
                mapping.TryGetValue(val, out newVal);
                if (String.IsNullOrEmpty(newVal))
                {
                    newVal = val;
                }
                obj[field] = newVal;
            }
            return(true);
        }