コード例 #1
0
ファイル: TemplateEntity.cs プロジェクト: htawab/wiscms
        public TemplateEntity(string name, ElementCollection elements, TemplateEntity parent)
        {
            this.name = name;
            this.elements = elements;
            this.parent = parent;

            InitTemplates();
        }
コード例 #2
0
ファイル: TemplateEntity.cs プロジェクト: htawab/wiscms
        /// <summary>
        /// go thru all tags and see if they are template tags and add
        /// them to this.templates collection
        /// </summary>
        private void InitTemplates()
        {
            this.templates = new Hashtable();

            foreach (Element elem in elements)
            {
                if (elem is Tag)
                {
                    Tag tag = (Tag)elem;
                    if (string.Compare(tag.Name, "template", true) == 0)
                    {
                        Expression ename = tag.AttributeValue("name");
                        string tname;
                        if (ename is StringLiteral)
                            tname = ((StringLiteral)ename).Content;
                        else
                            tname = "?";

                        TemplateEntity templateEntity = new TemplateEntity(tname, tag.InnerElements, this);
                        templates[tname] = templateEntity;
                    }
                }
            }
        }