protected override void OnStyleLiteral(StyleLiteral literal)
 {
     if (FlagNotSet(Flag.RemoveStyles))
     {
         base.OnStyleLiteral(literal);
     }
 }
Пример #2
0
        protected override void OnStyleLiteral(StyleLiteral literal)
        {
            if (literal == null || _scriptDepth > 0)
            {
                return;
            }

            literal.LiteralText = ReplaceValue(literal.LiteralText);
            Emit(literal.ToString());
            base.OnStyleLiteral(literal);
        }
        public void Parse()
        {
            CssParser parser = new CssParser(_css);

            OnDocumentBegin();
            while (true)
            {
                StyleElement element = parser.Next();

                if (element == null)
                {
                    OnDocumentEnd();
                    return;
                }

                StyleText styleText = element as StyleText;
                if (styleText != null)
                {
                    OnStyleText(styleText);
                }

                StyleLiteral styleLiteral = element as StyleLiteral;
                if (styleLiteral != null)
                {
                    OnStyleLiteral(styleLiteral);
                }

                StyleUrl styleUrl = element as StyleUrl;
                if (styleUrl != null)
                {
                    OnStyleUrl(styleUrl);
                }

                StyleImport styleImport = element as StyleImport;
                if (styleImport != null)
                {
                    OnStyleImport(styleImport);
                }

                StyleComment styleComment = element as StyleComment;
                if (styleComment != null)
                {
                    OnStyleComment(styleComment);
                }
            }
        }
 protected virtual void OnStyleLiteral(StyleLiteral styleLiteral)
 {
 }
Пример #5
0
 protected override void OnStyleLiteral(StyleLiteral literal)
 {
 }
 protected override void OnStyleLiteral(StyleLiteral styleLiteral)
 {
     Emit(styleLiteral);
     base.OnStyleLiteral(styleLiteral);
 }
        public void Parse()
        {
            SimpleHtmlParser parser = new SimpleHtmlParser(_html);

            OnDocumentBegin();
            while (true)
            {
                Element currentElement = parser.Next();

                BeginTag beginTag = currentElement as BeginTag;
                if (beginTag != null)
                {
                    OnBeginTag(beginTag);
                    continue;
                }

                EndTag endTag = currentElement as EndTag;
                if (endTag != null)
                {
                    OnEndTag(endTag);
                    continue;
                }

                ScriptLiteral literal = currentElement as ScriptLiteral;
                if (literal != null)
                {
                    OnScriptLiteral(literal);
                    continue;
                }

                Comment comment = currentElement as Comment;
                if (comment != null)
                {
                    OnComment(comment);
                    continue;
                }

                MarkupDirective markupDirective = currentElement as MarkupDirective;
                if (markupDirective != null)
                {
                    OnMarkupDirective(markupDirective);
                    continue;
                }

                ScriptText scriptText = currentElement as ScriptText;
                if (scriptText != null)
                {
                    OnScriptText(scriptText);
                    continue;
                }

                ScriptComment scriptComment = currentElement as ScriptComment;
                if (scriptComment != null)
                {
                    OnScriptComment(scriptComment);
                    continue;
                }

                StyleText styleText = currentElement as StyleText;
                if (styleText != null)
                {
                    OnStyleText(styleText);
                    continue;
                }

                StyleUrl styleUrl = currentElement as StyleUrl;
                if (styleUrl != null)
                {
                    OnStyleUrl(styleUrl);
                    continue;
                }

                StyleImport styleImport = currentElement as StyleImport;
                if (styleImport != null)
                {
                    OnStyleImport(styleImport);
                    continue;
                }

                StyleComment styleComment = currentElement as StyleComment;
                if (styleComment != null)
                {
                    OnStyleComment(styleComment);
                    continue;
                }

                StyleLiteral styleLiteral = currentElement as StyleLiteral;
                if (styleLiteral != null)
                {
                    OnStyleLiteral(styleLiteral);
                    continue;
                }

                Text text = currentElement as Text;
                if (text != null)
                {
                    OnText(text);
                    continue;
                }


                if (currentElement == null)
                {
                    OnDocumentEnd();
                    return;
                }

                Debug.Fail("Unrecognized element in LightWeightHTMLDocumentIterator");
            }
        }
 protected virtual void OnStyleLiteral(StyleLiteral literal)
 {
     DefaultAction(literal);
 }