Created
September 12, 2014 04:21
-
-
Save CampingScorpion/9dff767ad2ab2d56d99f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require '[stencil.core :as s]) | |
(def nav-links [{:url "a.html" | |
:text "Resume"} | |
{:url "b.html" | |
:text "Blog"} | |
{:url "c.html" | |
:text "About"}]) | |
(defn nav [links] | |
(s/render-string | |
"<div id='nav'> | |
<ul> | |
{{#links}} | |
<li><a href=\"{{{url}}}\">{{{text}}}</a></li> | |
{{/links}} | |
</ul> | |
</div>" | |
{:links links})) | |
(defn page [content] | |
(s/render-string | |
"<header></header> | |
<body> | |
{{{nav}}} | |
{{{content}}} | |
</body> | |
<footer></footer>" | |
{:content content | |
:nav (nav nav-links)})) | |
(defn homepage [] | |
(page "Welcome to my website!")) | |
(print (homepage)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment