srctree

Gregory Mullen parent b4e604f4 51dc476a
document (and test) With namespacing

examples/template.zig added: 21, removed: 6, total 15
@@ -52,6 +52,9 @@ fn index(verse: *Verse) Router.Error!void {
// A default isn't provided for .optional, because With statements, require
// an explicit decision.
.optional_with = null,
.namespaced_with = .{
.simple_variable = "This is a different variable from above",
},
});
 
try verse.sendPage(&page);
 
examples/templates/example.html added: 21, removed: 6, total 15
@@ -39,10 +39,22 @@
-->
 
<!-- Some logic is also supported -->
<!-- TODO Write and Document-->
<With OptionalWith>
<p>These internal tags are only seen if optional is defined</p>
<p>These internal tags are only seen if optional is defined.</p>
<p>Because there are no variables within this With block,
the generated struct is empty. Inspecting the generated types
will look similar to <pre>pub const OptionalWith = struct{};</pre>.
`null` or `.{}` are acceptable values.</p>
</With>
 
<!-- With also allows you to create a pseudo-namespace -->
<With NamespacedWith>
<!-- Be careful when using blocks in this way. Preventing variable -->
<!-- name shadowing equal to zig is a still a planned future goal -->
<p>Namespaced Variable : <SimpleVariable /></p>
</With>
 
<!-- TODO Write and Document-->
<!--
< For Loop></For>
< Split Slices></For>
 
src/template/page.zig added: 21, removed: 6, total 15
@@ -102,7 +102,7 @@ pub fn commentTag(blob: []const u8) ?usize {
}
 
pub fn validateBlock(comptime html: []const u8, PageDataType: type) []const Offset {
@setEvalBranchQuota(6000);
@setEvalBranchQuota(10000);
var found_offsets: []const Offset = &[0]Offset{};
var pblob = html;
var index: usize = 0;