protected override void Render(TagHelperContext context, TagHelperOutput output)
        {
            output.SetTagName("button");
            output.AddCssClass("btn");

            if (TagName.Equals("button", StringComparison.OrdinalIgnoreCase))
            {
                output.AddCssClass(ButtonColor.Default);
            }
            else
            {
                output.AddCssClass(context.TagName);
            }

            if (IsBlock)
            {
                output.AddCssClass("btn-block");
            }

            // Type
            RenderType(context, output);

            // Disabled & ReadOnly
            RenderVisability(context, output);
        }
示例#2
0
        public virtual void RenderBeginTag(HtmlTextWriter writer)
        {
            TagBuilder _tag = new TagBuilder(TagName);

            if (!string.IsNullOrEmpty(Name))
            {
                _tag.GenerateId(Name);
                if (!_tag.Attributes.ContainsKey("id"))
                {
                    _tag.MergeAttribute("id", Name);
                }

                Id = _tag.Attributes["id"];

                if (TagName.Equals("input", StringComparison.OrdinalIgnoreCase) || TagName.Equals("textarea", StringComparison.OrdinalIgnoreCase))
                {
                    _tag.MergeAttribute("name", Name);
                }
            }

            if (!string.IsNullOrEmpty(CssClass))
            {
                _tag.AddCssClass(CssClass);
            }

            if (this.HtmlAttributes != null)
            {
                foreach (var key in this.HtmlAttributes.Keys)
                {
                    if (this.HtmlAttributes[key] != null)
                    {
                        if (key.Contains("_"))
                        {
                            _tag.MergeAttribute(key.Replace("_", "-"), this.HtmlAttributes[key].ToString());
                        }
                        else
                        {
                            _tag.MergeAttribute(key, this.HtmlAttributes[key].ToString());
                        }
                    }
                }
            }

            if (this.DataAttributes != null)
            {
                foreach (var key in this.DataAttributes.Keys)
                {
                    if (this.DataAttributes[key] != null)
                    {
                        _tag.MergeAttribute("data-" + key, this.DataAttributes[key].ToString());
                    }
                }
            }

            writer.Write(_tag.ToString(TagRenderMode.StartTag));
        }
示例#3
0
        /// <summary>
        /// Determine if two tags a are equal
        /// </summary>
        /// <param name="obj">the other tag for equality test</param>
        /// <returns>true if both tags are equal; false otherwise</returns>
        public override bool Equals(object obj)
        {
            TagPageSet other = obj as TagPageSet;

            if (other != null)
            {
                return(TagName.Equals(other.TagName));
            }
            return(false);
        }
示例#4
0
        public override bool Equals(object obj)
        {
            var other = obj as MdTag;

            if (other == null)
            {
                return(false);
            }
            return(TagName.Equals(other.TagName));
        }
示例#5
0
        public HtmlElement(string html)
        {
            HtmlElement element = HtmlParser.Parse(html);

            this.TagName    = element.TagName;
            this.Properties = element.Properties;
            this.InnerHTML  = element.InnerHTML;
            this.IsDisable  = element.IsDisable;
            this.IsChecked  = element.IsChecked;

            this.IsTypeable = ((TagName.Equals("input") && (Properties["type"].Equals("text") || Properties["type"].Equals("tel") || Properties["type"].Equals("email") || Properties["type"].Equals("password")))) || TagName.Equals("textarea");
            //this.IsTypeable = true;
        }
示例#6
0
文件: Tags.cs 项目: Usurer/WPDict
        public bool Equals(Tag tag)
        {
            var result = tag != null &&
                         TagName.Equals(tag.TagName) &&
                         TagContent.Count == tag.TagContent.Count;

            if (!result)
            {
                return(false);
            }
            var contentAsArray      = TagContent.ToArray();
            var otherContentAsArray = tag.TagContent.ToArray();

            return(!contentAsArray.Where((t, i) => !t.Equals(otherContentAsArray[i])).Any());
        }
示例#7
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }
            var tag = obj as TagSegment;

            if (tag == null)
            {
                return(false);
            }
            return(TagName.Equals(tag.TagName) &&
                   OpenIndex.Equals(tag.OpenIndex) &&
                   CloseIndex.Equals(tag.CloseIndex));
        }
示例#8
0
		void CheckSpecialTag()
		{
			if( TagName.Equals( Constants.RenderTypeHelperStr ) )
			{
				m_specialTag = TemplateSpecialTags.RenderType:
				m_renderType = TemplateHelperFunctions.StringToRenderType[ TagValue ]:
			}
			else if( TagName.Equals( Constants.RenderQueueHelperStr ) )
			{
				m_specialTag = TemplateSpecialTags.Queue:
				SetTagValue( TagValue ):
			}
			else
			{
				m_specialTag = TemplateSpecialTags.None:
			}
		}
示例#9
0
        public override void Render(Context context, TextWriter result)
        {
            if (string.IsNullOrEmpty(_resourceReferenceParameter))
            {
                return;
            }

            var evaluatedResourceReferenceParameter = _resourceReferenceParameter.EvaluateAsStringProducingParameter(context);

            // _resourceReference can be a resource name or an URL.
            if (TagName.Equals("stylerequire", StringComparison.InvariantCultureIgnoreCase))
            {
                RequireResource("stylesheet", evaluatedResourceReferenceParameter, context);
            }
            else
            {
                IncludeResource("stylesheet", evaluatedResourceReferenceParameter, context);
            }
        }
        public override void Render(Context context, TextWriter result)
        {
            if (string.IsNullOrEmpty(_resourceReferenceParameter))
            {
                return;
            }

            var resourceManager = context.GetWorkContext().Resolve <IResourceManager>();

            var             evaluatedResourceReferenceParameter = _resourceReferenceParameter.EvaluateAsStringProducingParameter(context);
            RequireSettings script;

            // _resourceReference can be a resource name or an URL.
            if (TagName.Equals("scriptrequire", StringComparison.InvariantCultureIgnoreCase))
            {
                script = RequireResource("script", evaluatedResourceReferenceParameter, context);
            }
            else
            {
                script = IncludeResource("script", evaluatedResourceReferenceParameter, context);
            }

            script.Location = _location;
        }
 private static Entity GetPageTagByName(this OrganizationServiceContext context, string tagName)
 {
     return(context.CreateQuery("adx_pagetag").ToList().Where(pt => TagName.Equals(pt.GetAttributeValue <string>("adx_name"), tagName)).FirstOrDefault());
 }
 private static Entity GetForumThreadTagByName(this OrganizationServiceContext context, string tagName)
 {
     return(context.CreateQuery("adx_communityforumthreadtag").ToList().Where(ftt => TagName.Equals(ftt.GetAttributeValue <string>("adx_name"), tagName)).FirstOrDefault());
 }