diff options
| author | frosty <frosty@illegalfirearms.store> | 2025-12-28 03:26:05 -0500 |
|---|---|---|
| committer | frosty <frosty@illegalfirearms.store> | 2025-12-28 03:26:05 -0500 |
| commit | 4af132cf6adeeeeb5d6764c378bec2d05cad042f (patch) | |
| tree | e422cff2831424775ba5c20196064f94cbe1e5c3 /examples/template-demo/templates | |
Migrated from GitHub
Diffstat (limited to 'examples/template-demo/templates')
| -rw-r--r-- | examples/template-demo/templates/header.html | 8 | ||||
| -rw-r--r-- | examples/template-demo/templates/index.html | 48 |
2 files changed, 56 insertions, 0 deletions
diff --git a/examples/template-demo/templates/header.html b/examples/template-demo/templates/header.html new file mode 100644 index 0000000..746cee3 --- /dev/null +++ b/examples/template-demo/templates/header.html @@ -0,0 +1,8 @@ +<header style="text-align: center; padding-bottom: 20px; margin-bottom: 20px; border-bottom: 1px dashed #ccc;"> + <h2 style="color: #34495e;">Beaker Templating Demonstration</h2> + <nav> + <a href="/" style="margin: 0 15px; text-decoration: none; color: #2980b9; font-weight: bold;">Home</a> + <a href="#" style="margin: 0 15px; text-decoration: none; color: #2980b9; font-weight: bold;">Nothing</a> + + </nav> +</header> diff --git a/examples/template-demo/templates/index.html b/examples/template-demo/templates/index.html new file mode 100644 index 0000000..837688f --- /dev/null +++ b/examples/template-demo/templates/index.html @@ -0,0 +1,48 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="UTF-8"> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + <title>{{title}}</title> + <link rel="stylesheet" href="/static/style.css"> +</head> +<body> + <div class="container"> + {{include "header.html"}} + + <h1>{{page_heading}}</h1> + + <p>Welcome, <span class="highlight">{{username}}</span>! This page demonstrates the templating capabilities of the Beaker web framework.</p> + + <h2>Simple Variable Substitution</h2> + <p>Your favourite colour is: <span class="highlight">{{favourite_colour}}</span></p> + <p>The current year is: <span class="highlight">{{current_year}}</span></p> + <p>This is a safe string: <span class="code-block">{{safe_html|safe}}</span></p> + <p>This is an unsafe string (will be escaped): <span class="code-block">{{unsafe_html}}</span></p> + + <h2>List of Features (String Array)</h2> + <p>Here are some features:</p> + <ul> + {{for feature in features}} + <li>{{feature}}</li> + {{endfor}} + </ul> + + <h2>User Data (Array of Arrays)</h2> + <p>Here's some user information:</p> + <ul> + {{for user_row in users}} + <li> + Name: <span class="highlight">{{user_row[0]}}</span>, + Age: <span class="highlight">{{user_row[1]}}</span>, + City: <span class="highlight">{{user_row[2]}}</span> + </li> + {{endfor}} + </ul> + + <div class="footer"> + <p>Rendered at: {{timestamp}}</p> + </div> + </div> +</body> +</html> |
