示例#1
0
 public static bool IsBaseTag(HtmlTagId tagId, HtmlTagContextAttribute attribute)
 {
     return(tagId == HtmlTagId.Base && attribute.Id == HtmlAttributeId.Href);
 }
示例#2
0
			public FlowedToHtmlTagContext (HtmlTagId tag, HtmlAttribute attr) : base (tag)
			{
				attrs = new HtmlAttributeCollection (new [] { attr });
			}
示例#3
0
 protected static bool IsUrlTag(HtmlTagId tagId, HtmlTagContextAttribute attribute)
 {
     return((tagId == HtmlTagId.A && attribute.Id == HtmlAttributeId.Href) || (tagId == HtmlTagId.Area && attribute.Id == HtmlAttributeId.Href));
 }
示例#4
0
 protected static bool IsImageTag(HtmlTagId tagId, HtmlTagContextAttribute attribute)
 {
     return((tagId == HtmlTagId.Img && attribute.Id == HtmlAttributeId.Src) || (tagId == HtmlTagId.Img && attribute.Id == HtmlAttributeId.DynSrc) || (tagId == HtmlTagId.Img && attribute.Id == HtmlAttributeId.LowSrc));
 }
示例#5
0
 public TextToHtmlTagContext(HtmlTagId tag, HtmlAttribute attr) : base(tag)
 {
     attributes = new HtmlAttributeCollection(new [] { attr });
 }
示例#6
0
 public TextToHtmlTagContext(HtmlTagId tag) : base(tag)
 {
     attributes = HtmlAttributeCollection.Empty;
 }
示例#7
0
		/// <summary>
		/// Write a start tag.
		/// </summary>
		/// <remarks>
		/// Writes a start tag.
		/// </remarks>
		/// <param name="id">The HTML tag identifier.</param>
		/// <exception cref="System.ArgumentException">
		/// <paramref name="id"/> is not a valid HTML tag identifier.
		/// </exception>
		/// <exception cref="System.ObjectDisposedException">
		/// The <see cref="HtmlWriter"/> has been disposed.
		/// </exception>
		public void WriteStartTag (HtmlTagId id)
		{
			if (id == HtmlTagId.Unknown)
				throw new ArgumentException ("Invalid tag.", "id");

			CheckDisposed ();

			if (WriterState != HtmlWriterState.Default) {
				html.Write (empty ? "/>" : ">");
				empty = false;
			}

			html.Write (string.Format ("<{0}", id.ToHtmlTagName ()));
			WriterState = HtmlWriterState.Tag;
		}
示例#8
0
 internal int FindEndTag(int from, HtmlTagId tagId)
 {
     return(FindEndTag(this.nodes, from, tagId));
 }
 protected static bool IsTargetTagInAnchor(HtmlTagId tagId, HtmlTagContextAttribute attr)
 {
     return((tagId == HtmlTagId.A && attr.Id == HtmlAttributeId.Target) || (tagId == HtmlTagId.Area && attr.Id == HtmlAttributeId.Target));
 }
 protected static bool IsFormElementTag(HtmlTagId tagId)
 {
     return(tagId == HtmlTagId.Input || tagId == HtmlTagId.Button || tagId == HtmlTagId.Select || tagId == HtmlTagId.OptGroup || tagId == HtmlTagId.Option || tagId == HtmlTagId.FieldSet || tagId == HtmlTagId.TextArea || tagId == HtmlTagId.IsIndex || tagId == HtmlTagId.Label || tagId == HtmlTagId.Legend);
 }
示例#11
0
 public bool IsEndTag(HtmlTagId id)
 {
     return(NodeType == HtmlNodeType.EndTag && TagId == id);
 }
示例#12
0
 public bool IsStartTag(HtmlTagId id)
 {
     return(NodeType == HtmlNodeType.Element && TagId == id);
 }
示例#13
0
		/// <summary>
		/// Initializes a new instance of the <see cref="MimeKit.Text.HtmlTagContext"/> class.
		/// </summary>
		/// <remarks>
		/// Creates a new <see cref="HtmlTagContext"/>.
		/// </remarks>
		/// <param name="tagId">The HTML tag identifier.</param>
		/// <exception cref="System.ArgumentOutOfRangeException">
		/// <paramref name="tagId"/> is invalid.
		/// </exception>
		protected HtmlTagContext (HtmlTagId tagId)
		{
			TagId = tagId;
		}
示例#14
0
			public FlowedToHtmlTagContext (HtmlTagId tag) : base (tag)
			{
				attrs = HtmlAttributeCollection.Empty;
			}
示例#15
0
 public HtmlTagContext(HtmlTagId id)
 {
     TagId = id;
 }
示例#16
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MimeKit.Text.HtmlTagContext"/> class.
 /// </summary>
 /// <remarks>
 /// Creates a new <see cref="HtmlTagContext"/>.
 /// </remarks>
 /// <param name="tagId">The HTML tag identifier.</param>
 /// <exception cref="System.ArgumentOutOfRangeException">
 /// <paramref name="tagId"/> is invalid.
 /// </exception>
 protected HtmlTagContext(HtmlTagId tagId)
 {
     TagId = tagId;
 }
示例#17
0
 /// <summary>
 /// Converts the enum value into the equivalent tag name.
 /// </summary>
 /// <remarks>
 /// Converts the enum value into the equivalent tag name.
 /// </remarks>
 /// <returns>The tag name.</returns>
 /// <param name="value">The enum value.</param>
 public static string ToHtmlTagName(this HtmlTagId value)
 {
     return(tagsToNames[value]);
 }