Last active
December 17, 2015 21:39
-
-
Save Buildstarted/5676078 to your computer and use it in GitHub Desktop.
If renderer sample for parrot
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class IfRenderer : HtmlRenderer | |
{ | |
public IfRenderer(IHost host) : base(host) { } | |
public override IEnumerable<string> Elements | |
{ | |
get { yield return "if"; } | |
} | |
public override void Render(Parrot.Infrastructure.IParrotWriter writer, IRendererFactory rendererFactory, Nodes.Statement statement, IDictionary<string, object> documentHost, object model) | |
{ | |
var localModel = GetLocalModel(documentHost, statement, model); | |
if (localModel is bool && (bool) localModel) | |
{ | |
RenderChildren(writer, statement.Children, rendererFactory, documentHost, base.DefaultChildTag, model); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment