private void RenderReport(Report report, IRenderingContext context) { using (var childCtx = context.CreateChildContext(report.Name + ".html")) { childCtx.Render(report); context.Document.WriteLine("<a href=\"{0}\">{1}</a>", childCtx.RelativeDocumentUrl(context), report.Name); } }
private void Render(ValueWithDetails valueWithDetails) { if (valueWithDetails.Details == null) { myContext.Document.WriteLine(HtmlRenderingUtils.GetDisplayText(valueWithDetails.Value)); } else { using (var childCtx = myContext.CreateChildContext(valueWithDetails.Details.Reference, valueWithDetails.Details.Name + ".html")) { childCtx.Render(valueWithDetails.Details); myContext.Document.WriteLine("<a href=\"{0}\">{1}</a>", childCtx.RelativeDocumentUrl(myContext), HtmlRenderingUtils.GetDisplayText(valueWithDetails.Value)); } } }
public static IRenderingContext CreateChildContext(this IRenderingContext self, params string[] relativeDocumentPath) { var childCtx = self.CreateChildContext(); var directory = self.DocumentUrlRoot != null ? self.DocumentUrlRoot : self.DocumentRoot; childCtx.DocumentUrl = OS.CombinePaths(new[] { directory }, relativeDocumentPath); if (!Directory.Exists(childCtx.DocumentUrlRoot)) { Directory.CreateDirectory(childCtx.DocumentUrlRoot); } childCtx.Document = new StreamWriter(childCtx.DocumentUrl); return(childCtx); }
private void RenderSignal(IndicatorResult result, IRenderingContext context) { if (result.Report == null) { context.Document.WriteLine("<td>{0}</td>", HtmlRenderingUtils.GetDisplayText(result.Signal)); } else { using (var childCtx = context.CreateChildContext(result.Indicator, result.Report.Name + ".html")) { childCtx.Render(result.Report); context.Document.WriteLine("<td><a href=\"{0}\">{1}</a></td>", childCtx.RelativeDocumentUrl(context), HtmlRenderingUtils.GetDisplayText(result.Signal)); } } }
public static IRenderingContext CreateUniqChildContext(this IRenderingContext self) { return(self.CreateChildContext(Guid.NewGuid().ToString() + ".html")); }