當前位置: 首頁>>代碼示例>>C#>>正文


C# Node.FindHead方法代碼示例

本文整理匯總了C#中TidyNet.Node.FindHead方法的典型用法代碼示例。如果您正苦於以下問題:C# Node.FindHead方法的具體用法?C# Node.FindHead怎麽用?C# Node.FindHead使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在TidyNet.Node的用法示例。


在下文中一共展示了Node.FindHead方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: AddTransitionEffect

        /*
        Add meta element for page transition effect, this works on IE but not NS
        */
        public virtual void AddTransitionEffect(Lexer lexer, Node root, short effect, double duration)
        {
            Node head = root.FindHead(lexer.Options.tt);
            string transition;

            if (0 <= effect && effect <= 23)
            {
                transition = "revealTrans(Duration=" + (duration).ToString() + ",Transition=" + effect + ")";
            }
            else
            {
                transition = "blendTrans(Duration=" + (duration).ToString() + ")";
            }

            if (head != null)
            {
                Node meta = lexer.InferredTag("meta");
                meta.AddAttribute("http-equiv", "Page-Enter");
                meta.AddAttribute("content", transition);
                Node.InsertNodeAtStart(head, meta);
            }
        }
開發者ID:bgarrels,項目名稱:betterpoeditor,代碼行數:25,代碼來源:PPrint.cs

示例2: CreateStyleElement

        /* create style element using rules from dictionary */
        private void CreateStyleElement(Lexer lexer, Node doc)
        {
            Node node, head, body;
            Style style;
            AttVal av;

            if (lexer.styles == null && NiceBody(lexer, doc))
            {
                return;
            }

            node = lexer.NewNode(Node.StartTag, null, 0, 0, "style");
            node.Isimplicit = true;

            /* insert type attribute */
            av = new AttVal(null, null, '"', "type", "text/css");
            av.Dict = AttributeTable.DefaultAttributeTable.FindAttribute(av);
            node.Attributes = av;

            body = doc.FindBody(lexer.Options.tt);

            lexer.txtstart = lexer.lexsize;

            if (body != null)
            {
                CleanBodyAttrs(lexer, body);
            }

            for (style = lexer.styles; style != null; style = style.Next)
            {
                lexer.AddCharToLexer(' ');
                lexer.AddStringLiteral(style.Tag);
                lexer.AddCharToLexer('.');
                lexer.AddStringLiteral(style.TagClass);
                lexer.AddCharToLexer(' ');
                lexer.AddCharToLexer('{');
                lexer.AddStringLiteral(style.Properties);
                lexer.AddCharToLexer('}');
                lexer.AddCharToLexer('\n');
            }

            lexer.txtend = lexer.lexsize;

            Node.InsertNodeAtEnd(node, lexer.NewNode(Node.TextNode, lexer.lexbuf, lexer.txtstart, lexer.txtend));

            /*
            now insert style element into document head

            doc is root node. search its children for html node
            the head node should be first child of html node
            */

            head = doc.FindHead(lexer.Options.tt);

            if (head != null)
            {
                Node.InsertNodeAtEnd(head, node);
            }
        }
開發者ID:AlfieJ,項目名稱:TidyNet,代碼行數:60,代碼來源:Clean.cs

示例3: AddGenerator

		/* add meta element for Tidy */
		public virtual bool AddGenerator(Node root)
		{
			AttVal attval;
			Node node;
			Node head = root.FindHead(Options.tt);
			
			if (head != null)
			{
				for (node = head.Content; node != null; node = node.Next)
				{
					if (node.Tag == Options.tt.TagMeta)
					{
						attval = node.GetAttrByName("name");
						
						if (attval != null && attval.Val != null && String.Compare(attval.Val, "generator") == 0)
						{
							attval = node.GetAttrByName("content");
							
							if (attval != null && attval.Val != null && attval.Val.Length >= 9 && String.Compare(attval.Val.Substring(0, 9), "HTML Tidy") == 0)
							{
								return false;
							}
						}
					}
				}
				
				node = this.InferredTag("meta");
				node.AddAttribute("content", "HTML Tidy, see www.w3.org");
				node.AddAttribute("name", "generator");
				Node.InsertNodeAtStart(head, node);
				return true;
			}
			
			return false;
		}
開發者ID:erikzaadi,項目名稱:atomsitethemes.erikzaadi.com,代碼行數:36,代碼來源:Lexer.cs


注:本文中的TidyNet.Node.FindHead方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。