| author | |
| committer | |
| log | 5ff076490192e777e8f2dd3bdb712622abb30faa |
| tree | 64a443fab5bbdd2910444b5f146a36ba07869047 |
| parent | aa52db981ada69dcebc9fec54956fe2cd17e58a4 |
3 files changed, 15 insertions(+), 1 deletions(-)
src/lib.zig+10-1| ... | @@ -127,7 +127,16 @@ fn do(writer: anytype, comptime value: astgen.Value, data: anytype, ctx: anytype | ... | @@ -127,7 +127,16 @@ fn do(writer: anytype, comptime value: astgen.Value, data: anytype, ctx: anytype |
| 127 | } | 127 | } |
| 128 | } | 128 | } |
| 129 | }, | 129 | }, |
| 130 | else => @compileError("pek: block: TODO " ++ @tagName(v.name)), | 130 | .ifnotequal => { |
| 131 | comptime assertEqual(v.args.len, 2); | ||
| 132 | const x = comptime search(data, v.args[0]); | ||
| 133 | const y = comptime search(data, v.args[1]); | ||
| 134 | if (x != y) { | ||
| 135 | inline for (v.body) |val| { | ||
| 136 | try do(writer, val, data, ctx, indent, flag1); | ||
| 137 | } | ||
| 138 | } | ||
| 139 | }, | ||
| 131 | } | 140 | } |
| 132 | }, | 141 | }, |
| 133 | else => unreachable, | 142 | else => unreachable, |
src/main.zig+4| ... | @@ -35,6 +35,10 @@ const example_document = | ... | @@ -35,6 +35,10 @@ const example_document = |
| 35 | \\ {#ifequal top_cities.len best_rating} | 35 | \\ {#ifequal top_cities.len best_rating} |
| 36 | \\ p("#3") | 36 | \\ p("#3") |
| 37 | \\ /ifequal/ | 37 | \\ /ifequal/ |
| 38 | \\ | ||
| 39 | \\ {#ifnotequal favorite.color sky} | ||
| 40 | \\ p("#4") | ||
| 41 | \\ /ifnotequal/ | ||
| 38 | \\ ) | 42 | \\ ) |
| 39 | \\) | 43 | \\) |
| 40 | ; | 44 | ; |
test.html+1| ... | @@ -25,5 +25,6 @@ | ... | @@ -25,5 +25,6 @@ |
| 25 | <p>#1</p> | 25 | <p>#1</p> |
| 26 | <p>#2</p> | 26 | <p>#2</p> |
| 27 | <p>#3</p> | 27 | <p>#3</p> |
| 28 | <p>#4</p> | ||
| 28 | </body> | 29 | </body> |
| 29 | </html> | 30 | </html> |