Add macro tag

This commit is contained in:
2023-10-30 20:07:57 -07:00
parent 3eca240b56
commit 17906cf329
8 changed files with 238 additions and 8 deletions

View File

@@ -0,0 +1,16 @@
#macro("content"):
<section class="hero is-fullheight-with-navbar">
<div class="hero-head">
<div class="container">
<p class="title has-text-centered mt-2">About Salix</p>
<p>
Salix (pronounced <i>say-lix</i>) is a Go templating engine inspired by <a href="https://github.com/vapor/leaf">Leaf</a>.
<br><br>
Salix's syntax is similar to Leaf and (in my opinion at least), it's much more fun to write than the Go template syntax. If you like this project, please star its repo. I hope you enjoy! :)
</p>
</div>
</div>
</section>
#!macro
#include("base.html")

View File

@@ -0,0 +1,55 @@
<html>
<head>
<title>#(title)</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.9.4/css/bulma.min.css">
</head>
<body>
<nav class="navbar is-dark">
<div class="navbar-brand">
<a class="navbar-item" href="/">Salix</a>
<a class="navbar-burger" id="navbarMenuIcon" onclick="toggleNavMenu()">
<span aria-hidden="true"></span>
<span aria-hidden="true"></span>
<span aria-hidden="true"></span>
</a>
</div>
<div class="navbar-menu" id="navbarMenu">
<div class="navbar-end">
<a class='navbar-item #(title == "Home" ? "is-active" : "")' href="/">
Home
</a>
<a class='navbar-item #(title == "About" ? "is-active" : "")' href="/about">
About
</a>
</div>
</div>
</nav>
#macro("content")
<section class="hero is-small is-dark">
<div class="hero-body">
<div class="container">
<p class="has-text-centered">Copyright &copy; #(now().Year()) Salix Contributors. Licensed under the GPLv3.</p>
</div>
</div>
</section>
<script>
function toggleNavMenu() {
let navbarMenuIcon = document.getElementById("navbarMenuIcon");
let navbarMenu = document.getElementById("navbarMenu");
if (navbarMenu.classList.contains('is-active')) {
navbarMenuIcon.classList.remove('is-active')
navbarMenu.classList.remove('is-active')
} else {
navbarMenuIcon.classList.add('is-active')
navbarMenu.classList.add('is-active')
}
}
</script>
</body>
</html>

View File

@@ -0,0 +1,13 @@
#macro("content"):
<section class="hero is-fullheight-with-navbar">
<div class="hero-body">
<div class="container">
<p class="title">Hello, #(name | "World")!</p>
<p class="subtitle">This is a demo of the Salix template engine.</p>
<a class="button is-link is-rounded" href="/about">About &rarr;</a>
</div>
</div>
</section>
#!macro
#include("base.html")