aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Andreas Benkard <code@mail.matthias.benkard.de>2009-02-18 20:00:54 +0100
committerMatthias Andreas Benkard <code@mail.matthias.benkard.de>2009-02-18 20:00:54 +0100
commit1e7decfcda6029d3dfe8032e85d9e20f728d3dbd (patch)
tree7201e4a54996b24700184b67342b1fcefd47c032
parent54c04f85adb6938ef9ef27b5d7a1ab592fb30461 (diff)
Use StringTemplate for web page generation.
-rw-r--r--cljssss-g.clj15
-rw-r--r--index.st21
2 files changed, 28 insertions, 8 deletions
diff --git a/cljssss-g.clj b/cljssss-g.clj
index 6987a56..f5c4775 100644
--- a/cljssss-g.clj
+++ b/cljssss-g.clj
@@ -1,17 +1,16 @@
(ns cljssss-g
- (require [net.cgrand.enlive-html :as enlive]
- [clojure.xml :as xml]
+ (require [clojure.xml :as xml]
compojure)
+ (import (org.antlr.stringtemplate StringTemplateGroup))
(use compojure))
+(def tgroup (new StringTemplateGroup ""))
+
(defservlet cljssss-g
(GET "/"
- (html [:html
- [:head
- [:title "G&ouml;del-Gentzen Clojure Syndication Services Super System"]]
- [:body
- [:h1 "G&ouml;del-Gentzen Clojure Syndication Services Super System"]
- [:p "Fnord."]]]))
+ (.toString
+ (doto (.getInstanceOf tgroup "index")
+ (.setAttributes {"title" "Subscriptions"}))))
(ANY "*"
(page-not-found)))
diff --git a/index.st b/index.st
new file mode 100644
index 0000000..e41e9b5
--- /dev/null
+++ b/index.st
@@ -0,0 +1,21 @@
+<?xml version="1.0" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+ <title>$title$ &mdash; G&ouml;del-Gentzen Clojure Syndication Services Super System</title>
+</head>
+
+<body>
+ <h1 class="title">$title$</h1>
+ <p>$mainParagraph$</p>
+</body>
+</html>
+
+<!--
+Local Variables:
+ mode: html
+ coding: utf-8
+End:
+-->