public static CSharpKernel UseWho(this CSharpKernel kernel) { kernel.AddDirective(who_and_whos()); Formatter <CurrentVariables> .Register((variables, writer) => { PocketView output = null; if (variables.Detailed) { output = table( thead( tr( th("Variable"), th("Type"), th("Value"))), tbody( variables.Select(v => tr( td(v.Name), td(v.Type), td(v.Value.ToDisplayString()) )))); } else { output = div(variables.Select(v => v.Name + "\t ")); } output.WriteTo(writer, HtmlEncoder.Default); }, "text/html"); return(kernel); }
private static bool FormatCurrentVariables( KernelValues instance, FormatContext context) { PocketView output = null; if (instance.Detailed) { output = table( thead( tr( th("Variable"), th("Type"), th("Value"))), tbody( instance.Select(v => tr( td(v.Name), td(v.Type), td(div[@class: "dni-plaintext"](v.Value.ToDisplayString())) )))); } else { output = div(instance.Select(v => v.Name + "\t ")); } output.WriteTo(context); return(true); }
public void Format(CurrentVariables instance, TextWriter writer) { PocketView output = null; if (instance.Detailed) { output = table( thead( tr( th("Variable"), th("Type"), th("Value"))), tbody( instance.Select(v => tr( // Note, embeds these as objects into the HTML content, ultimately rendered by PocketView td(v.Name), td(arbitrary(v.Type)), td(arbitrary(v.Value)) )))); } else { output = div(instance.Select(v => v.Name + "\t ")); } output.WriteTo(writer, HtmlEncoder.Default); }
public bool Format(FormatContext context, CurrentVariables instance, TextWriter writer) { PocketView output = null; /// <summary> /// Renders the tag to the specified <see cref = "TextWriter" />. /// </summary> /// <param name = "writer">The writer.</param> if (instance.Detailed) { var innerContext = context.ReduceContent(FormatContext.NestedInTable); output = table( thead( tr( th("Variable"), th("Type"), th("Value"))), tbody( instance.Select(v => tr( // Note, embeds these as objects into the HTML content, ultimately rendered by PocketView td(v.Name), td(embed(v.Type, innerContext)), td(embed(v.Value, innerContext)) )))); } else { output = div(instance.Select(v => v.Name + "\t ")); } output.WriteTo(writer, HtmlEncoder.Default); return(true); }
public void Format(CurrentVariables instance, TextWriter writer) { PocketView output = null; if (instance.Detailed) { output = table( thead( tr( th("Variable"), th("Type"), th("Value"))), tbody( instance.Select(v => tr( td(v.Name), td(v.Type), td(v.Value.ToDisplayString()) )))); } else { output = div(instance.Select(v => v.Name + "\t ")); } output.WriteTo(writer, HtmlEncoder.Default); }