From c4da54408af4c6106674ce289c0857ec6a936293 Mon Sep 17 00:00:00 2001 From: Chris Wanstrath Date: Mon, 30 May 2011 17:39:55 -0700 Subject: [PATCH] Split Markdown processing into its own method --- lib/rocco.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/rocco.rb b/lib/rocco.rb index 035f944..c278202 100644 --- a/lib/rocco.rb +++ b/lib/rocco.rb @@ -437,8 +437,7 @@ class Rocco # dividers and run through the Markdown processor. Then split it back out # into separate sections. markdown = docs_blocks.join("\n\n##### DIVIDER\n\n") - docs_html = Markdown.new(markdown, :smart). - to_html. + docs_html = process_markdown(markdown). split(/\n*
DIVIDER<\/h5>\n*/m) # Combine all code blocks into a single big stream with section dividers and @@ -492,6 +491,11 @@ class Rocco docs_html.zip(code_html) end + # Convert Markdown to classy HTML. + def process_markdown(text) + Markdown.new(text, :smart).to_html + end + # We `popen` a read/write pygmentize process in the parent and # then fork off a child process to write the input. def highlight_pygmentize(code)