Skip to content

Commit

Permalink
dont parse the file twice
Browse files Browse the repository at this point in the history
  • Loading branch information
Zachary Scott committed Mar 21, 2013
1 parent 4eeee52 commit f7e4857
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app.rb
Expand Up @@ -59,7 +59,7 @@
md = File.read("#{params[:topic]}/#{params[:article]}.md") md = File.read("#{params[:topic]}/#{params[:article]}.md")
formatter = RDoc::Markup::ToTableOfContents.new formatter = RDoc::Markup::ToTableOfContents.new
@toc = RDoc::Markdown.parse(md).accept(formatter) @toc = RDoc::Markdown.parse(md).accept(formatter)
markdown :"#{params[:topic]}/#{params[:article]}" markdown md
end end


get '/style.css' do get '/style.css' do
Expand Down

2 comments on commit f7e4857

@kgrz
Copy link
Member

@kgrz kgrz commented on f7e4857 Mar 22, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@zzak
Copy link
Member

@zzak zzak commented on f7e4857 Mar 22, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.