当前位置: 首页>>代码示例>>C#>>正文


C# TidyNet.Lexer类代码示例

本文整理汇总了C#中TidyNet.Lexer的典型用法代码示例。如果您正苦于以下问题:C# Lexer类的具体用法?C# Lexer怎么用?C# Lexer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Lexer类属于TidyNet命名空间,在下文中一共展示了Lexer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Check

        public virtual void Check(Lexer lexer, Node node)
        {
            AttVal attval;
            Attribute attribute;
            bool hasAlt = false;
            bool hasHref = false;

            node.CheckUniqueAttributes(lexer);

            for (attval = node.Attributes; attval != null; attval = attval.Next)
            {
                attribute = attval.CheckAttribute(lexer, node);

                if (attribute == AttributeTable.AttrAlt)
                {
                    hasAlt = true;
                }
                else if (attribute == AttributeTable.AttrHref)
                {
                    hasHref = true;
                }
            }

            if (!hasAlt)
            {
                lexer.badAccess |= Report.MISSING_LINK_ALT;
                Report.AttrError(lexer, node, "alt", Report.MISSING_ATTRIBUTE);
            }
            if (!hasHref)
            {
                Report.AttrError(lexer, node, "href", Report.MISSING_ATTRIBUTE);
            }
        }
开发者ID:bgarrels,项目名称:betterpoeditor,代码行数:33,代码来源:AreaCheckTableCheckAttribs.cs

示例2: Check

        public virtual void Check(Lexer lexer, Node node)
        {
            node.CheckUniqueAttributes(lexer);

            AttVal lang = node.GetAttrByName("language");
            AttVal type = node.GetAttrByName("type");
            if (type == null)
            {
                Report.AttrError(lexer, node, "type", Report.MISSING_ATTRIBUTE);

                /* check for javascript */
                if (lang != null)
                {
                    string str = lang.Val;
                    if (str.Length > 10)
                    {
                        str = str.Substring(0, 10);
                    }

                    if ((String.Compare(str, "javascript") == 0) || (String.Compare(str, "jscript") == 0))
                    {
                        node.AddAttribute("type", "text/javascript");
                    }
                }
                else
                {
                    node.AddAttribute("type", "text/javascript");
                }
            }
        }
开发者ID:bgarrels,项目名称:betterpoeditor,代码行数:30,代码来源:ScriptCheckAttribs.cs

示例3: Check

        public virtual void Check(Lexer lexer, Node node)
        {
            AttVal attval;
            string val = null;

            node.CheckUniqueAttributes(lexer);

            for (attval = node.Attributes; attval != null; attval = attval.Next)
            {
                if (String.Compare(attval.Attribute, "align") == 0)
                {
                    val = attval.Val;
                    break;
                }
            }

            if (val != null)
            {
                if (String.Compare(val, "left") == 0 || String.Compare(val, "right") == 0)
                {
                    lexer.versions &= HtmlVersion.Html40Loose | HtmlVersion.Frames;
                }
                else if (String.Compare(val, "top") == 0 || String.Compare(val, "bottom") == 0)
                {
                    lexer.versions &= HtmlVersion.From32;
                }
                else
                {
                    Report.AttrError(lexer, node, val, Report.BAD_ATTRIBUTE_VALUE);
                }
            }
        }
开发者ID:AlfieJ,项目名称:TidyNet,代码行数:32,代码来源:CaptionCheckTableCheckAttribs.cs

示例4: Check

 public virtual void Check(Lexer lexer, Node node)
 {
     if (node.GetAttrByName("src") != null)
     {
         Report.AttrError(lexer, node, "src", Report.PROPRIETARY_ATTR_VALUE);
     }
 }
开发者ID:AlfieJ,项目名称:TidyNet,代码行数:7,代码来源:HrCheckTableCheckAttribs.cs

示例5: Check

        public virtual void Check(Lexer lexer, Node node, AttVal attval)
        {
            string val = attval.Val;

            if (val == null)
            {
                Report.AttrError(lexer, node, attval.Attribute, Report.MISSING_ATTR_VALUE);
            }
            else if (String.Compare(val, "top") == 0 || String.Compare(val, "middle") == 0 || String.Compare(val, "bottom") == 0 || String.Compare(val, "baseline") == 0)
            {
                /* all is fine */
            }
            else if (String.Compare(val, "left") == 0 || String.Compare(val, "right") == 0)
            {
                if (!(node.Tag != null && ((node.Tag.Model & ContentModel.Img) != 0)))
                {
                    Report.AttrError(lexer, node, val, Report.BAD_ATTRIBUTE_VALUE);
                }
            }
            else if (String.Compare(val, "texttop") == 0 || String.Compare(val, "absmiddle") == 0 || String.Compare(val, "absbottom") == 0 || String.Compare(val, "textbottom") == 0)
            {
                lexer.versions &= HtmlVersion.Proprietary;
                Report.AttrError(lexer, node, val, Report.PROPRIETARY_ATTR_VALUE);
            }
            else
            {
                Report.AttrError(lexer, node, val, Report.BAD_ATTRIBUTE_VALUE);
            }
        }
开发者ID:AlfieJ,项目名称:TidyNet,代码行数:29,代码来源:ValignAttrCheck.cs

示例6: TidyMessage

 internal TidyMessage(Lexer lexer, string message, MessageLevel level)
 {
     _filename = String.Empty;
     _line = lexer.lines;
     _column = lexer.columns;
     _message = message;
     _level = level;
 }
开发者ID:AlfieJ,项目名称:TidyNet,代码行数:8,代码来源:TidyMessage.cs

示例7: Check

 public virtual void Check(Lexer lexer, Node node, AttVal attval)
 {
     if (attval.Val == null)
     {
         Report.AttrError(lexer, node, attval.Attribute, Report.MISSING_ATTR_VALUE);
     }
     else if (lexer.Options.FixBackslash)
     {
         attval.Val = attval.Val.Replace('\\', '/');
     }
 }
开发者ID:AlfieJ,项目名称:TidyNet,代码行数:11,代码来源:UrlAttrCheck.cs

示例8: Check

        public virtual void Check(Lexer lexer, Node node)
        {
            node.CheckUniqueAttributes(lexer);

            /*
                HTML4 strict doesn't allow mixed content for
                elements with %block; as their content model
                */
            if (node.GetAttrByName("width") != null || node.GetAttrByName("height") != null)
            {
                lexer.versions &= ~ HtmlVersion.Html40Strict;
            }
        }
开发者ID:bgarrels,项目名称:betterpoeditor,代码行数:13,代码来源:TableCellCheckTableCheckAttribs.cs

示例9: Check

        public virtual void Check(Lexer lexer, Node node)
        {
            AttVal type = node.GetAttrByName("type");

            node.CheckUniqueAttributes(lexer);

            if (type == null)
            {
                Report.AttrError(lexer, node, "type", Report.MISSING_ATTRIBUTE);

                node.AddAttribute("type", "text/css");
            }
        }
开发者ID:AlfieJ,项目名称:TidyNet,代码行数:13,代码来源:StyleCheckTableCheckAttribs.cs

示例10: Check

        public virtual void Check(Lexer lexer, Node node)
        {
            AttVal attval;

            node.CheckUniqueAttributes(lexer);

            for (attval = node.Attributes; attval != null; attval = attval.Next)
            {
                Attribute attribute = attval.CheckAttribute(lexer, node);
                if (attribute == AttributeTable.AttrXmlns)
                {
                    lexer.isvoyager = true;
                }
            }
        }
开发者ID:bgarrels,项目名称:betterpoeditor,代码行数:15,代码来源:HtmlCheckAttribs.cs

示例11: Check

        public virtual void Check(Lexer lexer, Node node)
        {
            AttVal rel = node.GetAttrByName("rel");

            node.CheckUniqueAttributes(lexer);

            if (rel != null && rel.Val != null && rel.Val.Equals("stylesheet"))
            {
                AttVal type = node.GetAttrByName("type");

                if (type == null)
                {
                    Report.AttrError(lexer, node, "type", Report.MISSING_ATTRIBUTE);

                    node.AddAttribute("type", "text/css");
                }
            }
        }
开发者ID:bgarrels,项目名称:betterpoeditor,代码行数:18,代码来源:LinkCheckTableCheckAttribs.cs

示例12: Check

        public virtual void Check(Lexer lexer, Node node, AttVal attval)
        {
            string val;

            /* IMG, OBJECT, APPLET and EMBED use align for vertical position */
            if (node.Tag != null && ((node.Tag.Model & ContentModel.Img) != 0))
            {
                TidyNet.AttrCheckImpl.CheckValign.Check(lexer, node, attval);
                return;
            }

            val = attval.Val;

            if (val == null)
            {
                Report.AttrError(lexer, node, attval.Attribute, Report.MISSING_ATTR_VALUE);
            }
            else if (!(String.Compare(val, "left") == 0 || String.Compare(val, "center") == 0 || String.Compare(val, "right") == 0 || String.Compare(val, "justify") == 0))
            {
                Report.AttrError(lexer, node, attval.Val, Report.BAD_ATTRIBUTE_VALUE);
            }
        }
开发者ID:bgarrels,项目名称:betterpoeditor,代码行数:22,代码来源:AlignAttrCheck.cs

示例13: Check

        public virtual void Check(Lexer lexer, Node node)
        {
            AttVal attval;
            Attribute attribute;
            bool hasSummary = false;

            node.CheckUniqueAttributes(lexer);

            for (attval = node.Attributes; attval != null; attval = attval.Next)
            {
                attribute = attval.CheckAttribute(lexer, node);

                if (attribute == AttributeTable.AttrSummary)
                {
                    hasSummary = true;
                }
            }

            /* suppress warning for missing summary for HTML 2.0 and HTML 3.2 */
            if (!hasSummary && lexer.doctype != HtmlVersion.Html20 && lexer.doctype != HtmlVersion.Html32)
            {
                lexer.badAccess |= Report.MISSING_SUMMARY;
                Report.AttrError(lexer, node, "summary", Report.MISSING_ATTRIBUTE);
            }

            /* convert <table border> to <table border="1"> */
            if (lexer.Options.XmlOut)
            {
                attval = node.GetAttrByName("border");
                if (attval != null)
                {
                    if (attval.Val == null)
                    {
                        attval.Val = "1";
                    }
                }
            }
        }
开发者ID:bgarrels,项目名称:betterpoeditor,代码行数:38,代码来源:TableCheckAttribs.cs

示例14: MissingBody

 public static void MissingBody(Lexer lexer)
 {
     AddMessage(lexer, GetMessage("missing_body"), MessageLevel.Info);
 }
开发者ID:bgarrels,项目名称:betterpoeditor,代码行数:4,代码来源:Report.cs

示例15: ErrorSummary

        public static void ErrorSummary(Lexer lexer)
        {
            /* adjust badAccess to that its null if frames are ok */
            if ((lexer.badAccess & (USING_FRAMES | USING_NOFRAMES)) != 0)
            {
                if (!(((lexer.badAccess & USING_FRAMES) != 0) && ((lexer.badAccess & USING_NOFRAMES) == 0)))
                {
                    lexer.badAccess &= ~(USING_FRAMES | USING_NOFRAMES);
                }
            }

            if (lexer.badChars != 0)
            {
                if ((lexer.badChars & WINDOWS_CHARS) != 0)
                {
                    AddMessage(lexer, GetMessage("badchars_summary"), MessageLevel.Info);
                }
            }

            if (lexer.badForm != 0)
            {
                AddMessage(lexer, GetMessage("badform_summary"), MessageLevel.Info);
            }

            if (lexer.badAccess != 0)
            {
                if ((lexer.badAccess & MISSING_SUMMARY) != 0)
                {
                    AddMessage(lexer, GetMessage("badaccess_missing_summary"), MessageLevel.Info);
                }

                if ((lexer.badAccess & MISSING_IMAGE_ALT) != 0)
                {
                    AddMessage(lexer, GetMessage("badaccess_missing_image_alt"), MessageLevel.Info);
                }

                if ((lexer.badAccess & MISSING_IMAGE_MAP) != 0)
                {
                    AddMessage(lexer, GetMessage("badaccess_missing_image_map"), MessageLevel.Info);
                }

                if ((lexer.badAccess & MISSING_LINK_ALT) != 0)
                {
                    AddMessage(lexer, GetMessage("badaccess_missing_link_alt"), MessageLevel.Info);
                }

                if (((lexer.badAccess & USING_FRAMES) != 0) && ((lexer.badAccess & USING_NOFRAMES) == 0))
                {
                    AddMessage(lexer, GetMessage("badaccess_frames"), MessageLevel.Info);
                }

                TidyMessage msg2 = new TidyMessage(lexer, String.Format(GetMessage("badaccess_summary"), ACCESS_URL), MessageLevel.Info);
                lexer.messages.Add(msg2);
            }

            if (lexer.badLayout != 0)
            {
                if ((lexer.badLayout & USING_LAYER) != 0)
                {
                    AddMessage(lexer, GetMessage("badlayout_using_layer"), MessageLevel.Info);
                }

                if ((lexer.badLayout & USING_SPACER) != 0)
                {
                    AddMessage(lexer, GetMessage("badlayout_using_spacer"), MessageLevel.Info);
                }

                if ((lexer.badLayout & USING_FONT) != 0)
                {
                    AddMessage(lexer, GetMessage("badlayout_using_font"), MessageLevel.Info);
                }

                if ((lexer.badLayout & USING_NOBR) != 0)
                {
                    AddMessage(lexer, GetMessage("badlayout_using_nobr"), MessageLevel.Info);
                }

                if ((lexer.badLayout & USING_BODY) != 0)
                {
                    AddMessage(lexer, GetMessage("badlayout_using_body"), MessageLevel.Info);
                }
            }
        }
开发者ID:bgarrels,项目名称:betterpoeditor,代码行数:83,代码来源:Report.cs


注:本文中的TidyNet.Lexer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。