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


C# Lexer.PushInline方法代碼示例

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


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

示例1: Parse

			public virtual void Parse(Lexer lexer, Node element, short mode)
			{
				Node node, parent;
				TagTable tt = lexer.Options.tt;
				
				if ((element.Tag.Model & ContentModel.Empty) != 0)
				{
					return;
				}
				
				if (element.Tag == tt.TagA)
				{
					if (element.Attributes == null)
					{
						Report.Warning(lexer, element.Parent, element, Report.DISCARDING_UNEXPECTED);
						Node.DiscardElement(element);
						return;
					}
				}
				
				/*
				ParseInline is used for some block level elements like H1 to H6
				For such elements we need to insert inline emphasis tags currently
				on the inline stack. For Inline elements, we normally push them
				onto the inline stack provided they aren't implicit or OBJECT/APPLET.
				This test is carried out in PushInline and PopInline, see istack.c
				We don't push A or SPAN to replicate current browser behavior
				*/
				if (((element.Tag.Model & ContentModel.Block) != 0) || (element.Tag == tt.TagDt))
				{
					lexer.InlineDup(null);
				}
				else if ((element.Tag.Model & ContentModel.Inline) != 0 && element.Tag != tt.TagA && element.Tag != tt.TagSpan)
				{
					lexer.PushInline(element);
				}
				
				if (element.Tag == tt.TagNobr)
				{
					lexer.badLayout |= Report.USING_NOBR;
				}
				else if (element.Tag == tt.TagFont)
				{
					lexer.badLayout |= Report.USING_FONT;
				}
				
				/* Inline elements may or may not be within a preformatted element */
				if (mode != Lexer.Preformatted)
				{
					mode = Lexer.MixedContent;
				}
				
				while (true)
				{
					node = lexer.GetToken(mode);
					if (node == null)
					{
						break;
					}
					/* end tag for current element */
					if (node.Tag == element.Tag && node.Type == Node.EndTag)
					{
						if ((element.Tag.Model & ContentModel.Inline) != 0 && element.Tag != tt.TagA)
						{
							lexer.PopInline(node);
						}
						
						if (!((mode & Lexer.Preformatted) != 0))
						{
							Node.TrimSpaces(lexer, element);
						}
						/*
						if a font element wraps an anchor and nothing else
						then move the font element inside the anchor since
						otherwise it won't alter the anchor text color
						*/
						if (element.Tag == tt.TagFont && element.Content != null && element.Content == element.Last)
						{
							Node child = element.Content;
							
							if (child.Tag == tt.TagA)
							{
								child.Parent = element.Parent;
								child.Next = element.Next;
								child.Prev = element.Prev;
								
								if (child.Prev != null)
								{
									child.Prev.Next = child;
								}
								else
								{
									child.Parent.Content = child;
								}
								
								if (child.Next != null)
								{
									child.Next.Prev = child;
								}
								else
//.........這裏部分代碼省略.........
開發者ID:erikzaadi,項目名稱:atomsitethemes.erikzaadi.com,代碼行數:101,代碼來源:ParserImpl.cs


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