public Method

BlueCloth.transform_code_blocks( str, rs )

Transform Markdown-style codeblocks in a copy of the specified str and return it.

Source Code

# File bluecloth.rb, line 555
def transform_code_blocks( str, rs )
        @log.debug " Transforming code blocks"

        str.gsub( CodeBlockRegexp ) {|block|
                codeblock = $1
                remainder = $2

                # Generate the codeblock
                %{\n\n<pre><code>%s\n</code></pre>\n\n%s} %
                        [ encode_code( outdent(codeblock), rs ).rstrip, remainder ]
        }
end
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.