aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Kavon <me+git@alexkavon.com>2025-07-03 04:35:21 -0400
committerAlexander Kavon <me+git@alexkavon.com>2025-07-03 04:35:21 -0400
commita9608134cf2402fb0e6d9405e96db9dc92ed4849 (patch)
tree796745ad0113d92a0c8675623d25a4a21738614b
parent6dc6550c8828724712f58a7ec5874827ffbc9f56 (diff)
page template
-rw-r--r--static/contact.xsl52
-rw-r--r--static/head.xsl13
-rw-r--r--static/templates.xsl34
3 files changed, 62 insertions, 37 deletions
diff --git a/static/contact.xsl b/static/contact.xsl
index ab9eeea..505d534 100644
--- a/static/contact.xsl
+++ b/static/contact.xsl
@@ -1,32 +1,36 @@
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" indent="yes" />
- <xsl:include href="head.xsl" />
+ <xsl:include href="templates.xsl" />
+
+ <xsl:param name="icon">
+ <xsl:text>mail</xsl:text>
+ </xsl:param>
<xsl:param name="title">
<xsl:text>Contact</xsl:text>
</xsl:param>
- <xsl:template match="/">
- <html>
- <xsl:call-template name="head">
- <xsl:with-param name="title" select="$title" />
- </xsl:call-template>
+ <xsl:param name="content">
+ <form id="contact-form" method="POST" action="/contact">
+ <label>
+ Name
+ <input id="name_in" type="text" name="name" placeholder="Name" />
+ </label>
+ <label>
+ Email
+ <input id="email_in" type="email" name="email" placeholder="you@ema.il" />
+ </label>
+ <label>
+ Message
+ <textarea id="message_in" name="message" placeholder="What's up bud?"></textarea>
+ </label>
+ <button type="submit">Transmit</button>
+ </form>
+ </xsl:param>
- <body>
- <h1><xsl:value-of select="$title" /></h1>
- <form id="contact-form" class="pure-form pure-form-stacked">
- <label for="name_in">
- Name
- <input id="name_in" type="text" name="name" />
- </label>
- <label for="email_in">
- Email
- <input id="email_in" type="email" name="email" />
- </label>
- <label for="message_in">
- Message
- <textarea id="message_in" name="message"></textarea>
- </label>
- </form>
- </body>
- </html>
+ <xsl:template match="/">
+ <xsl:call-template name="page">
+ <xsl:with-param name="icon" select="$icon" />
+ <xsl:with-param name="title" select="$title" />
+ <xsl:with-param name="content" select="$content" />
+ </xsl:call-template>
</xsl:template>
</xsl:stylesheet>
diff --git a/static/head.xsl b/static/head.xsl
deleted file mode 100644
index ef90ace..0000000
--- a/static/head.xsl
+++ /dev/null
@@ -1,13 +0,0 @@
-<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
- <xsl:template name="head">
- <xsl:param name="title" />
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
- <meta name="viewport" content="width=device-width, initial-scale=1" />
- <title>
- <xsl:value-of select="$title" />
- </title>
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/purecss@3.0.0/build/pure-min.css" integrity="sha384-X38yfunGUhNzHpBaEBsWLO+A0HDYOQi8ufWDkZ0k9e0eXz/tH3II7uKZ9msv++Ls" crossorigin="anonymous" />
- </head>
- </xsl:template>
-</xsl:stylesheet>
diff --git a/static/templates.xsl b/static/templates.xsl
new file mode 100644
index 0000000..204485a
--- /dev/null
+++ b/static/templates.xsl
@@ -0,0 +1,34 @@
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+ <xsl:param name="title" />
+ <xsl:param name="icon" />
+
+ <xsl:template name="head">
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
+ <title>
+ <xsl:value-of select="$title" />
+ </title>
+ <link
+ rel="stylesheet"
+ href="https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.min.css"
+ />
+ </head>
+ </xsl:template>
+
+ <xsl:template name="page">
+ <xsl:param name="content" />
+
+ <html>
+ <xsl:call-template name="head">
+ <xsl:with-param name="title" select="$title"/>
+ </xsl:call-template>
+
+ <body>
+ <h1><img class="icon" src="/icons/{$icon}.svg#${icon}" /><xsl:text> </xsl:text><xsl:value-of select="$title" /></h1>
+ <hr />
+ <xsl:copy-of select="$content" />
+ </body>
+ </html>
+ </xsl:template>
+</xsl:stylesheet>