Skip to content

Commit 5a8e706

Browse files
committed
Docs: Fix conditional syntax examples to use {{if}} not {{#if}}
The README and just-the-docs site examples both used {{#if condition}} syntax (Mustache-with-hash). The actual TokenParser implementation dispatches on span.StartsWith("if", ...) — no '#' handling — and all existing unit tests use {{if ...}}. Documentation drifted from the implementation. Affected lines: - README.md:89 and :104 — both code blocks demonstrating conditionals - docs/site/syntax/examples.md:65 and :82 — corresponding examples No code changes; tests already prove the {{if}} form works.
1 parent e442d91 commit 5a8e706

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ Console.WriteLine(result); // Output: hello Hari Seldon.
8686
You can use conditional tokens to control the flow based on conditions.
8787

8888
```csharp
89-
var template = "{{#if condition}}hello {{name}}.{{/if}}";
89+
var template = "{{if condition}}hello {{name}}.{{/if}}";
9090

9191
var result = Template.Render(template, new()
9292
{
@@ -101,7 +101,7 @@ Console.WriteLine(result); // Output: hello me.
101101
```
102102

103103
```csharp
104-
var template = "hello {{#if condition}}{{name1}}{{else}}{{name2}}{{/if}}.";
104+
var template = "hello {{if condition}}{{name1}}{{else}}{{name2}}{{/if}}.";
105105

106106
var result = Template.Render(template, new()
107107
{

docs/site/syntax/examples.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ Console.WriteLine(result); // Output: hello Hari Seldon.
6262
### If Statement
6363

6464
```csharp
65-
var template = "{{#if condition}}hello {{name}}.{{/if}}";
65+
var template = "{{if condition}}hello {{name}}.{{/if}}";
6666

6767
var result = Template.Render(template, new()
6868
{
@@ -79,7 +79,7 @@ Console.WriteLine(result); // Output: hello me.
7979
### If-Else Statement
8080

8181
```csharp
82-
var template = "hello {{#if condition}}{{name1}}{{else}}{{name2}}{{/if}}.";
82+
var template = "hello {{if condition}}{{name1}}{{else}}{{name2}}{{/if}}.";
8383

8484
var result = Template.Render(template, new()
8585
{

0 commit comments

Comments
 (0)