From f1d7725108891a6a64cd9debecb1919bf1272a53 Mon Sep 17 00:00:00 2001 From: John-John Tedro Date: Tue, 10 Oct 2023 10:59:25 +0200 Subject: [PATCH] Include code sample --- site/content/posts/2023-10-10-rune-0.13.0.md | 13 ++++++++++++- site/templates/shortcodes/rune.html | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/site/content/posts/2023-10-10-rune-0.13.0.md b/site/content/posts/2023-10-10-rune-0.13.0.md index 1552af7cf..97d597096 100644 --- a/site/content/posts/2023-10-10-rune-0.13.0.md +++ b/site/content/posts/2023-10-10-rune-0.13.0.md @@ -18,8 +18,19 @@ the way rust works and is structured. A common way to describe it is "Rust without types". {% rune(footnote = "Hello World!") %} +fn fizzbuzz(up) { + for n in 1..=up { + match (n % 3, n % 5) { + (0, 0) => yield "FizzBuzz", + (0, _) => yield "Fizz", + (_, 0) => yield "Buzz", + _ => yield n, + } + } +} + pub fn main() { - println!("Hello World!"); + fizzbuzz(15).iter().collect::() } {% end %} diff --git a/site/templates/shortcodes/rune.html b/site/templates/shortcodes/rune.html index a5cd204eb..a454ce426 100644 --- a/site/templates/shortcodes/rune.html +++ b/site/templates/shortcodes/rune.html @@ -7,7 +7,7 @@ rune-instructions="{% if instructions %}{{instructions}}{% endif %}"" rune-config="{% if rune_config %}{{rune_config}}{% endif %}"" > -
{{body | safe}}
+
{{body}}