| author | |
| committer | |
| log | f21d52640b16b20aab891ee4e6ae5fb6bd32b9b8 |
| tree | 6ec6852a5cead4c374b8f509d1c7a0a7a292f51b |
| parent | 606c72eb48ee9678dcb222f3463e6f2acb8e66cd |
3 files changed, 13 insertions(+), 0 deletions(-)
src/lib.zig+9| ... | @@ -99,6 +99,15 @@ fn do(writer: anytype, comptime value: astgen.Value, data: anytype, ctx: anytype | ... | @@ -99,6 +99,15 @@ fn do(writer: anytype, comptime value: astgen.Value, data: anytype, ctx: anytype |
| 99 | } | 99 | } |
| 100 | } | 100 | } |
| 101 | }, | 101 | }, |
| 102 | .@"if" => { | ||
| 103 | comptime assertEqual(v.args.len, 1); | ||
| 104 | const x = comptime search(data, v.args[0]); | ||
| 105 | if (x) { | ||
| 106 | inline for (v.body) |val| { | ||
| 107 | try do(writer, val, data, ctx, indent, flag1); | ||
| 108 | } | ||
| 109 | } | ||
| 110 | }, | ||
| 102 | else => @compileError("pek: block: TODO " ++ @tagName(v.name)), | 111 | else => @compileError("pek: block: TODO " ++ @tagName(v.name)), |
| 103 | } | 112 | } |
| 104 | }, | 113 | }, |
src/main.zig+3| ... | @@ -24,6 +24,9 @@ const example_document = | ... | @@ -24,6 +24,9 @@ const example_document = |
| 24 | \\ ) | 24 | \\ ) |
| 25 | \\ p("Spooky text: "{spooky}) | 25 | \\ p("Spooky text: "{spooky}) |
| 26 | \\ | 26 | \\ |
| 27 | \\ {#if am_i_a_girl} | ||
| 28 | \\ p("#1") | ||
| 29 | \\ /if/ | ||
| 27 | \\ ) | 30 | \\ ) |
| 28 | \\) | 31 | \\) |
| 29 | ; | 32 | ; |
test.html+1| ... | @@ -22,5 +22,6 @@ | ... | @@ -22,5 +22,6 @@ |
| 22 | <li>Phoenix, AZ</li> | 22 | <li>Phoenix, AZ</li> |
| 23 | </ul> | 23 | </ul> |
| 24 | <p>Spooky text: &LT;strong&GT;I better not be in bold&period;&LT;&sol;strong&GT;</p> | 24 | <p>Spooky text: &LT;strong&GT;I better not be in bold&period;&LT;&sol;strong&GT;</p> |
| 25 | <p>#1</p> | ||
| 25 | </body> | 26 | </body> |
| 26 | </html> | 27 | </html> |