Permalink
Browse files

dont parse the file twice

  • Loading branch information...
zzak committed Mar 21, 2013
1 parent 4eeee52 commit f7e485796c30d572dcf2b0955b125b804239d71a
Showing with 1 addition and 1 deletion.
  1. +1 −1 app.rb
View
2 app.rb
@@ -59,7 +59,7 @@
md = File.read("#{params[:topic]}/#{params[:article]}.md")
formatter = RDoc::Markup::ToTableOfContents.new
@toc = RDoc::Markdown.parse(md).accept(formatter)
- markdown :"#{params[:topic]}/#{params[:article]}"
+ markdown md
end
get '/style.css' do

2 comments on commit f7e4857

@kgrz

This comment has been minimized.

Show comment
Hide comment
@kgrz

kgrz Mar 22, 2013

Member

Even now it is being parsed twice isn't it? Now I see the why you started the Tilt extension :)

Member

kgrz replied Mar 22, 2013

Even now it is being parsed twice isn't it? Now I see the why you started the Tilt extension :)

@zzak

This comment has been minimized.

Show comment
Hide comment
@zzak

zzak Mar 22, 2013

Member

it's parsing the markdown twice, once with TOC and second with Glorify::Renderer. but I assume that this will prevent it from reading the file twice from disk, which using the markdown from memory should be faster.

Member

zzak replied Mar 22, 2013

it's parsing the markdown twice, once with TOC and second with Glorify::Renderer. but I assume that this will prevent it from reading the file twice from disk, which using the markdown from memory should be faster.

Please sign in to comment.