public static CodeRenderingContext CreateRuntime( string newLineString = null, string suppressUniqueIds = "test", RazorSourceDocument source = null, IntermediateNodeWriter nodeWriter = null) { var codeWriter = new CodeWriter(); var documentNode = new DocumentIntermediateNode(); var options = RazorCodeGenerationOptions.CreateDefault(); if (source is null) { source = TestRazorSourceDocument.Create(); } var codeDocument = RazorCodeDocument.Create(source); if (newLineString != null) { codeDocument.Items[CodeRenderingContext.NewLineString] = newLineString; } if (suppressUniqueIds != null) { codeDocument.Items[CodeRenderingContext.SuppressUniqueIds] = suppressUniqueIds; } if (nodeWriter is null) { nodeWriter = new RuntimeNodeWriter(); } var context = new DefaultCodeRenderingContext(codeWriter, nodeWriter, codeDocument, documentNode, options); context.Visitor = new RenderChildrenVisitor(context); return(context); }
public Visitor(CodeTarget target, DefaultCodeRenderingContext context) { _target = target; _context = context; }