Skip to content

Commit

Permalink
feed tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
jashkenas committed Feb 1, 2013
1 parent 7a704fe commit 818c6b5
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 13 deletions.
29 changes: 17 additions & 12 deletions journo.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion journo.litcoffee
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ as `content`.
catchErrors ->
source or= fs.readFileSync postPath post
shared.layout or= _.template(fs.readFileSync('layout.html').toString())
variables = {_, fs, path, folderContents, mapLink, postName, post: path.basename(post), posts: sortedPosts(), manifest: shared.manifest}
variables = renderVariables post
markdown = _.template(source.toString()) variables
title = postTitle markdown
content = marked.parser marked.lexer markdown
Expand Down Expand Up @@ -242,6 +242,7 @@ Publish a Feed
lexed = marked.lexer content
title = postTitle content
description = _.find(lexed, (token) -> token.type is 'paragraph')?.text
description = marked.parser marked.lexer _.template(description)(renderVariables(post))
feed.item
title: title
Expand Down Expand Up @@ -356,6 +357,11 @@ and the URL for a post on the server.
_.sortBy _.without(_.keys(shared.manifest), 'index.md'), (post) ->
shared.manifest[post].pubtime
The shared variables we want to allow our templates to use in their evaluations.

renderVariables = (post) ->
{_, fs, path, folderContents, mapLink, postName, post: path.basename(post), posts: sortedPosts(), manifest: shared.manifest}
Quick function to creating a link to a Google Map.

mapLink = (place, additional = '', zoom = 15) ->
Expand Down

0 comments on commit 818c6b5

Please sign in to comment.