Ejemplo n.º 1
0
        public override void ExitStyle(HTMLParser.StyleContext ctx)
        {
            const string SHORT_BODY = "</>";
            const string BODY = "</style>";
            var styleBody = ctx.STYLE_BODY() ?? ctx.STYLE_SHORT_BODY();
            var styleBodyText = styleBody?.GetText();
            if (string.IsNullOrWhiteSpace(styleBodyText))
                return;
            if (styleBodyText.EndsWith(SHORT_BODY))
                styleBodyText = styleBodyText.Substring(0, styleBodyText.Length - SHORT_BODY.Length);
            if (styleBodyText.EndsWith(BODY))
                styleBodyText = styleBodyText.Substring(0, styleBodyText.Length - BODY.Length);

            styleBodyText = styleBodyText.Trim();
            _results.StyleBodies.Add(styleBodyText);
        }