예제 #1
0
            /// <summary>
            /// Renders a script block to the specified 
            /// <paramref name="writer"/>.
            /// </summary>
            /// <param name="writer">A <see cref="System.IO.TextWriter"/> 
            /// to render the script block to.</param>
            internal void Render(TextWriter writer)
            {
                HtmlHelper helper = new HtmlHelper(_manager._context);
                StringBuilder builder = new StringBuilder(Environment.NewLine);

                foreach (string code in _scripts.Where(a => a != null)
                    .Select(a => helper.Block(a)))
                    builder.AppendLine(code);

                if (builder.Length > Environment.NewLine.Length)
                    writer.WriteLine((_wrapper == null) ?
                        builder.ToString() :
                        helper.Block(_wrapper, builder.ToString()));
            }