Permalink
Browse files

Version 0.1.1 - Fixed typos and added snippet support

  • Loading branch information...
1 parent 7f7436f commit 78410f83b1b02793db53c764efa57075c3e94aff @koostudios committed May 8, 2012
Showing with 28 additions and 12 deletions.
  1. +14 −4 main.coffee
  2. +1 −0 pages/_footer.md
  3. +3 −0 pages/_menu.md
  4. +1 −1 pages/about.md
  5. +1 −1 pages/index.md
  6. +4 −5 templates/breeze/layout.jade
  7. +4 −1 templates/breeze/public/style.css
View
@@ -1,10 +1,19 @@
+# Variables
fs = require 'fs'
exp = require 'express'
app = exp.createServer()
md = require('node-markdown').Markdown
config = require './config'
dir = __dirname + '/templates/' + config.template.name
+# Little Functions
+snippet = (id) ->
+ return md fs.readFileSync __dirname + '/pages/_' + id + '.md', 'utf-8'
+
+locals = (body) ->
+ return {body: body, config: config, snippet: snippet}
+
+# App Configuration
app.configure () ->
app.set 'view engine', config.template.engine
app.set 'view options', {layout: false}
@@ -14,19 +23,20 @@ app.configure () ->
app.listen config.port
console.log 'Server running at port ' + app.address().port
+# Routing
app.get '/', (req, res, next) ->
fs.readFile __dirname + '/pages/index.md', (err, data) ->
if err
next()
else
- res.render 'layout', {body: md(data.toString()), config: config}
+ res.render 'layout', locals md data.toString()
app.get '/:id', (req, res, next) ->
fs.readFile __dirname + '/pages/' + req.params.id + '.md', (err, data) ->
- if err
+ if err || req.params.id.charAt(0) == '_'
next()
else
- res.render 'layout', {body: md(data.toString()), config: config}
+ res.render 'layout', locals md data.toString()
app.get '/*', (req, res) ->
- res.render 'layout', {body: '<b>404</b> Oopsies, not found.'}
+ res.render 'layout', locals '<b>404</b> Oopsies, not found.'
View
@@ -0,0 +1 @@
2012 Alexander Yuen. Made with ♥ and [Kel](http://kel.nodester.com).
View
@@ -0,0 +1,3 @@
+[Download](https://github.com/koostudios/kel/zipball/master/)
+[Github](https://github.com/koostudios/kel)
+[About](/about)
View
@@ -2,7 +2,7 @@
Kel is a ridiculously simple markdown file-based website system built on Express, CoffeeScript and NodeJS. It is super easy to setup, simple as anything and as flexible as you can make it. Kel has been lovingly handcoded by Alexander Yuen of [KOO Studios](http://www.koostudios.com).
## Name and Philosophy.
-Kel is named after Kelly Johnson, the system engineer who first articulated the design principle of KISS. Kel keeps to the "keep it short and simple" guideline and avoid unnecessary complexity as much as possible.
+Kel is named after Kelly Johnson, the system engineer who first articulated the design principle of KISS. Kel keeps to the "keep it short and simple" guideline and avoids unnecessary complexity as much as possible.
## Contribute to Kel.
Kel is an open source project hosted on [Github](https://www.github.com/koostudios/kel) and licensed under the MIT License. Use a [pull request](https://www.github.com/koostudios/kel/pulls) to let us know of some cool feature or bug fix that you've made! We accept patches as long as they’re useful and conform to our standards.
View
@@ -16,7 +16,7 @@ Ever wanted to create a simple, static website but didn't want to do all the wor
</td>
<td width=33%>
<h3>You're In Control</h3>
- <p>No more struggling to make a CMS do what you want. Write your own content and your own template in your own language.</p>
+ <p>No more struggling to make a CMS do what you want. Write your own content and template in your own language.</p>
</td>
</tr>
</table>
@@ -9,10 +9,9 @@ html(lang= 'en')
header
a(href= '/')
h1= config.title
- nav
- a(href= 'https://github.com/koostudios/kel/master/')= 'Download'
- a(href= 'https://github.com/koostudios/kel')= 'Github'
- a(href= '/about')= 'About'
+ nav
+ != snippet('menu')
.content
!= body
- footer &copy; 2012 #{config.author}. Made with ♥ and Kel.
+ footer
+ !=snippet('footer')
@@ -58,6 +58,10 @@ header a:hover {
color: #333;
}
+nav p {
+ margin: 0;
+}
+
.content h1,
.content h2,
.content h3,
@@ -77,7 +81,6 @@ header a:hover {
footer {
border-top: 1px solid #CCC;
margin-top: 3em;
- padding: 5px 0;
font-size: 0.8em;
color: #AAA;
}

0 comments on commit 78410f8

Please sign in to comment.