Skip to content
This repository has been archived by the owner on Jun 9, 2020. It is now read-only.

Added date to the articles #19

Merged
merged 1 commit into from
Mar 20, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion blog.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ def title
"#{title}Literate Programming"
end

def formatted_date
@date && Date.parse(@date).strftime("%-d %B %Y")
end

def format_outline(outline)
prev_level = 2

Expand Down Expand Up @@ -77,10 +81,11 @@ def format_outline(outline)
@title_hidden = source.metadata['title-hidden']
@content = source.content
@outline = source.outline
@date = source.metadata['date']

haml :post
rescue Errno::ENOENT # we couldn't find the file on disk.
pass
pass
end
end

Expand Down
3 changes: 3 additions & 0 deletions public/stylesheets/layout.css
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ div.container {
pre.prettyprint {
margin-bottom: 2em;
}
div.date {
text-align: right;
}


/* #Page Styles
Expand Down
1 change: 1 addition & 0 deletions views/post.haml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
- unless @title_hidden
%h1= @title
.date= formatted_date
:preserve
#{@content}
- content_for :sidebar do
Expand Down