Split Markdown processing into its own method

This commit is contained in:
Chris Wanstrath 2011-05-30 17:39:55 -07:00
parent 7ba75f0503
commit c4da54408a

View File

@ -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*<h5>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)