Sha256: 271ccb5bd0baf2e114d3123b38b890a3eacd9e25e09efd323c08bbd2151467dc

Contents?: true

Size: 1.13 KB

Versions: 206

Compression:

Stored size: 1.13 KB

Contents

# Disabled this for now, don't think anyone uses it.
# Problem is that the HAML gem seems to have changed in the upgrade to
# Ruby v2.1.0 and the below will need to be updated accordingly.
#
#require "haml"
#
## This adds a :code filter to allow code snippets to be embedded in HAML
## docs which are then highlighted by Coderay. Ruby is the default language, select
## another by including #!language in the code snippet.
##
## :code
##   def say(msg)
##     puts "#{msg}"
##   end
#module Haml::Filters::Code
#
#  include Haml::Filters::Base
#  lazy_require "coderay"
#
#  def render(content, options={})
#    ::CodeRay.scan(*prepare(content)).send(:div, {})
#  end
#
#  # Prepares the text for passing to `::CodeRay.scan`.
#  #
#  # @param [String] text
#  # @return [Array<String, Symbol>] code and language
#  def prepare(text)
#    if text =~ /#!(\S+)/
#      [ text.sub(/\A\s*#!(\S+)\s*\n+/, ""), $1.downcase.to_sym ]
#    else
#      [ text, :ruby ]
#    end
#  end
#
#  def compile(precompiler, text)
#    text = Haml::Helpers::find_and_preserve(render(text).rstrip, precompiler.options[:preserve])
#    precompiler.send(:push_text, text)
#  end
#
#end

Version data entries

206 entries across 206 versions & 1 rubygems

Version Path
origen-0.60.18 templates/nanoc/lib/haml_code_filter.rb
origen-0.60.17 templates/nanoc/lib/haml_code_filter.rb
origen-0.60.16 templates/nanoc/lib/haml_code_filter.rb
origen-0.60.14 templates/nanoc/lib/haml_code_filter.rb
origen-0.60.13 templates/nanoc/lib/haml_code_filter.rb
origen-0.60.12 templates/nanoc/lib/haml_code_filter.rb
origen-0.60.11 templates/nanoc/lib/haml_code_filter.rb
origen-0.60.10 templates/nanoc/lib/haml_code_filter.rb
origen-0.60.9 templates/nanoc/lib/haml_code_filter.rb
origen-0.60.8 templates/nanoc/lib/haml_code_filter.rb
origen-0.60.7 templates/nanoc/lib/haml_code_filter.rb
origen-0.60.6 templates/nanoc/lib/haml_code_filter.rb
origen-0.60.5 templates/nanoc/lib/haml_code_filter.rb
origen-0.60.4 templates/nanoc/lib/haml_code_filter.rb
origen-0.60.3 templates/nanoc/lib/haml_code_filter.rb
origen-0.60.2 templates/nanoc/lib/haml_code_filter.rb
origen-0.60.1 templates/nanoc/lib/haml_code_filter.rb
origen-0.60.0 templates/nanoc/lib/haml_code_filter.rb
origen-0.59.8 templates/nanoc/lib/haml_code_filter.rb
origen-0.59.7 templates/nanoc/lib/haml_code_filter.rb