diff --git a/src/lib.zig b/src/lib.zig index 0ec266f6366f93e019e8f9cbbc5e068e48fb6782..386766734e92803b72ccb94b7b11e1f9572df7c5 100644 --- a/src/lib.zig +++ b/src/lib.zig @@ -99,6 +99,15 @@ fn do(writer: anytype, comptime value: astgen.Value, data: anytype, ctx: anytype } } }, + .@"if" => { + comptime assertEqual(v.args.len, 1); + const x = comptime search(data, v.args[0]); + if (x) { + inline for (v.body) |val| { + try do(writer, val, data, ctx, indent, flag1); + } + } + }, else => @compileError("pek: block: TODO " ++ @tagName(v.name)), } }, diff --git a/src/main.zig b/src/main.zig index d66a8a1572715ebd5dca298146c0ec9b1fcb7ce7..3b5d746aa2d7fcf326083ee33c6163aa7587042d 100644 --- a/src/main.zig +++ b/src/main.zig @@ -24,6 +24,9 @@ const example_document = \\ ) \\ p("Spooky text: "{spooky}) \\ + \\ {#if am_i_a_girl} + \\ p("#1") + \\ /if/ \\ ) \\) ; diff --git a/test.html b/test.html index fb33a24f0fe1b67aa6bfd0fb09105bb257d12aa5..f68012d434473fb1e140d7a28bcd258fc461e1ae 100644 --- a/test.html +++ b/test.html @@ -22,5 +22,6 @@
  • Phoenix, AZ
  • Spooky text: <strong>I better not be in bold.</strong>

    +

    #1