Thursday, June 23, 2011

Removing the Whitespaces while rendering the webpage

Removing the Whitespaces while rendering the webpage



//Overrides the Render method
        //protected override void Render(HtmlTextWriter writer)
        //{
        //    using (HtmlTextWriter htmlwriter = new HtmlTextWriter(new System.IO.StringWriter()))
        //    {
        //        base.Render(htmlwriter);
        //        string html = htmlwriter.InnerWriter.ToString();

        //        if ((ConfigurationManager.AppSettings.Get("RemoveWhitespace") + string.Empty).Equals("true", StringComparison.OrdinalIgnoreCase))
        //        {
        //            html = REGEX_BETWEEN_TAGS.Replace(html, "> <");
        //            html = REGEX_LINE_BREAKS.Replace(html, string.Empty);


        //            html = Regex.Replace(html, @"(?<=[^])\t{2,}|(?<=[>])\s{2,}(?=[<])|(?<=[>])\s{2,11}(?=[<])|(?=[\n])\s{2,}", string.Empty);
        //            html = Regex.Replace(html, @"[ \f\r\t\v]?([\n\xFE\xFF/{}[\];,<>*%&|^!~?:=])[\f\r\t\v]?", "$1");
        //            html = html.Replace(";\n", ";");
        //        }
               

        //        writer.Write(html.Trim());
        //    }
        //}

No comments:

Post a Comment