diff --git a/examples/seed_dev_db.rs b/examples/seed_dev_db.rs index 42f778c..9772314 100644 --- a/examples/seed_dev_db.rs +++ b/examples/seed_dev_db.rs @@ -131,9 +131,25 @@ fn body_html(title: &str, words: i64) -> String { html.push_str("

A pull quote that the author would rather you remembered than the rest.

"); } if index == 7 { - html.push_str( - "
fn main() {\n    println!(\"hello, reader\");\n}
", - ); + // One block the source marked as Rust, one it left for detection. + html.push_str(concat!( + "
/// Greets whoever is reading.\n",
+                "fn main() {\n",
+                "    let reader: &str = \"reader\";\n",
+                "    for n in 0..3 {\n",
+                "        println!(\"hello, {reader} #{n}\"); // three times\n",
+                "    }\n",
+                "}
", + "
import json\n\n",
+                "def load(path: str) -> dict:\n",
+                "    \"\"\"Read a JSON config, or an empty one.\"\"\"\n",
+                "    try:\n",
+                "        with open(path) as f:\n",
+                "            return json.load(f)\n",
+                "    except FileNotFoundError:\n",
+                "        return {}  # first run\n",
+                "
", + )); } html.push_str("

Paragraph "); html.push_str(&(index + 1).to_string());