예제 #1
0
        protected override async Task HandleSubmitCode(
            SubmitCode command,
            KernelInvocationContext context)
        {
            var scriptContent = new ScriptContent(command.Code);

            await context.DisplayAsync(scriptContent);
        }
예제 #2
0
        public async Task HandleAsync(
            SubmitCode command,
            KernelInvocationContext context)
        {
            var scriptContent = new ScriptContent(command.Code);

            await context.DisplayAsync(scriptContent);
        }
예제 #3
0
        protected override async Task HandleSubmitCode(
            SubmitCode command,
            KernelInvocationContext context)
        {
            var scriptContent = command.Code;

            string value = PocketViewTags.script[type : "text/javascript"](Kernel.HTML(
                                                                               scriptContent))
                           .ToString();

            await context.DisplayAsync(value, "text/html");
        }
예제 #4
0
        public async Task HandleAsync(SubmitCode command, KernelInvocationContext context)
        {
            if (command.KernelNameDirectiveNode is null)
            {
                context.Fail(message: $"Missing required #!{Name} details.");

                return;
            }

            var parseResult = command.KernelNameDirectiveNode.GetDirectiveParseResult();

            var name = parseResult.ValueForOption <string>("--name");

            var value = command.LanguageNode.Text.Trim();

            await SetVariableAsync(name, value);

            if (parseResult.ValueForOption("--mime-type") is string mimeType)
            {
                await context.DisplayAsync(value, mimeType);
            }
        }
예제 #5
0
 public async Task HandleAsync(SubmitCode command, KernelInvocationContext context)
 {
     await context.DisplayAsync(
         new HtmlString(command.Code),
         HtmlFormatter.MimeType);
 }
예제 #6
0
 protected override async Task HandleSubmitCode(SubmitCode command, KernelInvocationContext context)
 {
     await context.DisplayAsync(
         command.Code,
         HtmlFormatter.MimeType);
 }
예제 #7
0
 internal static Task DisplayAnsi(KernelInvocationContext context, TextSpan span) =>
 context.DisplayAsync(span, PlainTextFormatter.MimeType);