コード例 #1
0
ファイル: InlineStack.cs プロジェクト: AlfieJ/TidyNet
        private Dict _tag; /* tag's dictionary definition */

        #endregion Fields

        #region Constructors

        /*
        Mosaic handles inlines via a separate stack from other elements
        We duplicate this to recover from inline markup errors such as:

        <i>italic text
        <p>more italic text</b> normal text

        which for compatibility with Mosaic is mapped to:

        <i>italic text</i>
        <p><i>more italic text</i> normal text

        Note that any inline end tag pop's the effect of the current
        inline start tag, so that </b> pop's <i> in the above example.
        */
        public InlineStack()
        {
            _next = null;
            _tag = null;
            _element = null;
            _attributes = null;
        }
コード例 #2
0
		/*
		push a copy of an inline node onto stack
		but don't push if implicit or OBJECT or APPLET
		(implicit tags are ones generated from the istack)
		
		One issue arises with pushing inlines when
		the tag is already pushed. For instance:
		
		<p><em>text
		<p><em>more text
		
		Shouldn't be mapped to
		
		<p><em>text</em></p>
		<p><em><em>more text</em></em>
		*/
		public virtual void PushInline(Node node)
		{
			InlineStack stack;
			
			if (node.Isimplicit)
				return;
			
			if (node.Tag == null)
				return;
			
			if ((node.Tag.Model & ContentModel.Inline) == 0)
				return;
			
			if ((node.Tag.Model & ContentModel.Object) != 0)
				return;
			
			if (node.Tag != Options.tt.TagFont && IsPushed(node))
				return;
			
			// make sure there is enough space for the stack
			stack = new InlineStack();
			stack.Tag = node.Tag;
			stack.Element = node.Element;
			if (node.Attributes != null)
			{
				stack.Attributes = CloneAttributes(node.Attributes);
			}
			
			istack.Push(stack);
		}