Esempio n. 1
0
        private void ExecuteCustomTag(Tag tag)
        {
            ITmplHandler tagHandler = customTags[tag.Name];

            bool processInnerElements = true;
            bool captureInnerContent  = false;

            tagHandler.BeforeProcess(this, tag, ref processInnerElements, ref captureInnerContent);

            string innerContent = null;

            if (processInnerElements)
            {
                TextWriter saveWriter = writer;

                if (captureInnerContent)
                {
                    writer = new StringWriter();
                }

                try {
                    ProcessElements(tag.InnerElements);

                    innerContent = writer.ToString();
                } finally {
                    writer = saveWriter;
                }
            }

            tagHandler.AfterProcess(this, tag, innerContent);
        }
Esempio n. 2
0
        public void Process(TextWriter writer)
        {
            this.writer       = writer;
            this._currentTmpl = _mainTmpl;

            if (_handler != null)
            {
                SetValue("this", _handler);
                _handler.BeforeProcess(this);
            }

            ProcessElements(_mainTmpl.Elements);

            if (_handler != null)
            {
                _handler.AfterProcess(this);
            }
        }