/// <summary>
 /// Initializes a new instance of the <see cref="RenderedScopeEventArgs"/> class.
 /// </summary>
 /// <param name="scope">The scope name.</param>
 /// <param name="content">The content.</param>
 /// <param name="renderedContent">The rendered content.</param>
 public RenderedScopeEventArgs(Scope scope, string content, string renderedContent)
 {
     Scope = scope;
     Content = content;
     RenderedContent = renderedContent;
 }
Example #2
0
        private void RenderScope(StringBuilder writer, Scope scope, string content)
        {
            IRenderer renderer = renderers.FirstOrDefault(r => r.CanExpand(scope.Name));
            string renderedContent;

            try
            {
                renderedContent = renderer == null
                                    ? string.Format("<span class=\"unresolved\">Cannot resolve macro, as no renderers were found.</span>[{0}]", EncodeContent(content))
                                    : renderer.Expand(scope.Name, content, EncodeContent, EncodeAttributeContent);
            }
            catch
            {
                renderedContent = string.Format("<span class=\"unresolved\">Cannot resolve macro, as an unhandled exception occurred.</span>[{0}]", EncodeContent(content));
            }

            writer.Append(renderedContent);
            OnScopeRendered(new RenderedScopeEventArgs(scope, content, renderedContent));
        }