WebMarkupMin.Core.GenericHtmlMinifier.EmbeddedCodeHandler C# (CSharp) Метод

EmbeddedCodeHandler() приватный Метод

Embedded code handler
private EmbeddedCodeHandler ( MarkupParsingContext context, string code ) : void
context WebMarkupMin.Core.Parsers.MarkupParsingContext Markup parsing context
code string Code
Результат void
        private void EmbeddedCodeHandler(MarkupParsingContext context, string code)
        {
            HtmlNodeType previousNodeType = _currentNodeType;
            HtmlTag tag = _currentTag ?? HtmlTag.Empty;
            string tagNameInLowercase = tag.NameInLowercase;
            IList<HtmlAttribute> attributes = tag.Attributes;

            _currentNodeType = HtmlNodeType.EmbeddedCode;

            string contentType = attributes
                .Where(a => a.NameInLowercase == "type")
                .Select(a => a.Value)
                .FirstOrDefault()
                ;

            switch (tagNameInLowercase)
            {
                case "script":
                    if (string.IsNullOrWhiteSpace(contentType))
                    {
                        string language = attributes
                            .Where(a => a.NameInLowercase == "language")
                            .Select(a => a.Value)
                            .FirstOrDefault()
                            ;

                        if (!string.IsNullOrWhiteSpace(language)
                            && language.Trim().IgnoreCaseEquals("vbscript"))
                        {
                            contentType = VBS_CONTENT_TYPE;
                        }
                    }

                    ProcessEmbeddedScriptContent(context, code, contentType);
                    break;

                case "style":
                    ProcessEmbeddedStyleContent(context, code, contentType);
                    break;

                default:
                    throw new NotSupportedException();
            }

            if (_currentText.Length == 0)
            {
                _currentNodeType = previousNodeType;
            }
        }