Sha256: 477488cdd093015f51bdde7a009d807060088530df6be22748685bf6c3af05d5

Contents?: true

Size: 580 Bytes

Versions: 11

Compression:

Stored size: 580 Bytes

Contents

class BlueCloth

	def transform_code_blocks( str, rs )
		@log.debug " Transforming code blocks"

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

      # Generate the codeblock
      if codeblock =~ /^(?:[ ]{4}|\t)@@(.*?)\n\n(.*)\n\n/m
         "\n\n<pre class='highlight'>%s</pre>\n\n%s" %
          [CodeRay.scan(outdent($2), $1).html(:css => :style, :line_numbers => :list).delete("\n"), remainder]
      else
         "\n\n<pre><code>%s\n</code></pre>\n\n%s" %
          [encode_code(outdent(codeblock), rs).rstrip, remainder]
      end
		}
	end

end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
georgi-shinmun-0.3.10 lib/shinmun/bluecloth_coderay.rb
georgi-shinmun-0.4.1 lib/shinmun/bluecloth_coderay.rb
georgi-shinmun-0.4 lib/shinmun/bluecloth_coderay.rb
georgi-shinmun-0.5 lib/shinmun/bluecloth_coderay.rb
shinmun-1.0.1 lib/shinmun/bluecloth_coderay.rb
shinmun-1.0 lib/shinmun/bluecloth_coderay.rb
shinmun-0.9.2 lib/shinmun/bluecloth_coderay.rb
shinmun-0.9.1 lib/shinmun/bluecloth_coderay.rb
shinmun-0.9 lib/shinmun/bluecloth_coderay.rb
shinmun-0.5.2 lib/shinmun/bluecloth_coderay.rb
shinmun-0.5 lib/shinmun/bluecloth_coderay.rb