Internal representation of named JBST placholder inline content
Inheritance: JbstCommandBase
示例#1
0
        private void PopTag(string tagName)
        {
            if (tagName == null)
            {
                tagName = String.Empty;
            }

            if (this.current == null)
            {
                throw new InvalidOperationException("Push/Pop mismatch? (current tag is null)");
            }

            if (!String.IsNullOrEmpty(tagName) &&
                !tagName.Equals(this.current.RawName, StringComparison.OrdinalIgnoreCase))
            {
                //throw new InvalidOperationException("Push/Pop mismatch? (tag names do not match)");
                return;
            }

            if (JbstWriter.ScriptTagName.Equals(this.current.RawName, StringComparison.OrdinalIgnoreCase))
            {
                // script tags get converted once fully parsed
                this.Declarations.Append(this.current);
            }

            JbstInline inline = this.current as JbstInline;

            this.current = this.current.Parent;

            if (inline != null && inline.IsAnonymous)
            {
                // consolidate anonymous inline templates directly into body
                this.current.ChildControls.Remove(inline);
                if (inline.ChildControlsSpecified)
                {
                    this.current.ChildControls.AddRange(inline.ChildControls);
                }
            }
        }
示例#2
0
        private void PushTag(string rawName)
        {
            string tagName;
            string prefix = JbstWriter.SplitPrefix(rawName, out tagName);

            JbstContainerControl control;

            if (JbstCommandBase.JbstPrefix.Equals(prefix, StringComparison.OrdinalIgnoreCase))
            {
                if (StringComparer.OrdinalIgnoreCase.Equals(JbstControlReference.ControlCommand, tagName))
                {
                    control = new JbstControlReference();
                }
                else if (StringComparer.OrdinalIgnoreCase.Equals(JbstPlaceholder.PlaceholderCommand, tagName))
                {
                    control = new JbstPlaceholder();
                }
                else if (StringComparer.OrdinalIgnoreCase.Equals(JbstInline.InlineCommand, tagName))
                {
                    control = new JbstInline();
                }
                else
                {
                    throw new InvalidOperationException("Unknown JBST command ('" + rawName + "')");
                }
            }
            else
            {
                control = new JbstContainerControl(prefix, tagName);
            }

            if (this.current == null)
            {
                this.current = this.document;
            }

            this.current.ChildControls.Add(control);
            this.current = control;
        }
示例#3
0
        private void PushTag(string rawName)
        {
            string tagName;
            string prefix = JbstWriter.SplitPrefix(rawName, out tagName);

            JbstContainerControl control;
            if (JbstCommandBase.JbstPrefix.Equals(prefix, StringComparison.OrdinalIgnoreCase))
            {
                if (StringComparer.OrdinalIgnoreCase.Equals(JbstControlReference.ControlCommand, tagName))
                {
                    control = new JbstControlReference();
                }
                else if (StringComparer.OrdinalIgnoreCase.Equals(JbstPlaceholder.PlaceholderCommand, tagName))
                {
                    control = new JbstPlaceholder();
                }
                else if (StringComparer.OrdinalIgnoreCase.Equals(JbstInline.InlineCommand, tagName))
                {
                    control = new JbstInline();
                }
                else
                {
                    throw new InvalidOperationException("Unknown JBST command ('"+rawName+"')");
                }
            }
            else
            {
                control = new JbstContainerControl(prefix, tagName);
            }

            if (this.current == null)
            {
                this.current = this.document;
            }

            this.current.ChildControls.Add(control);
            this.current = control;
        }