Sha256: faf6773bf9e51804753d5be4ff2bc736bddcc791e0353bff077a709591a45059

Contents?: true

Size: 700 Bytes

Versions: 14

Compression:

Stored size: 700 Bytes

Contents

# frozen_string_literal: true
require_relative 'template'
require 'rdiscount'

aliases = {
  :escape_html => :filter_html,
  :smartypants => :smart
}.freeze

_flags = [:smart, :filter_html, :smartypants, :escape_html].freeze

# Discount Markdown implementation. See:
# http://github.com/rtomayko/rdiscount
#
# RDiscount is a simple text filter. It does not support +scope+ or
# +locals+. The +:smart+ and +:filter_html+ options may be set true
# to enable those flags on the underlying RDiscount object.
Tilt::RDiscountTemplate = Tilt::StaticTemplate.subclass do
  flags = _flags.select { |flag| @options[flag] }.
    map! { |flag| aliases[flag] || flag }

  RDiscount.new(@data, *flags).to_html
end

Version data entries

14 entries across 13 versions & 5 rubygems

Version Path
trusty-cms-7.0.9.1 vendor/bundle/ruby/3.1.0/gems/tilt-2.4.0/lib/tilt/rdiscount.rb
trusty-cms-7.0.9.1 vendor/bundle/ruby/3.3.0/gems/tilt-2.4.0/lib/tilt/rdiscount.rb
tilt-2.6.0 lib/tilt/rdiscount.rb
brakeman-7.0.0 bundle/ruby/3.1.0/gems/tilt-2.5.0/lib/tilt/rdiscount.rb
tilt-2.5.0 lib/tilt/rdiscount.rb
brakeman-6.2.2 bundle/ruby/3.1.0/gems/tilt-2.4.0/lib/tilt/rdiscount.rb
brakeman-6.2.2.rc1 bundle/ruby/3.3.0/gems/tilt-2.4.0/lib/tilt/rdiscount.rb
brakeman-6.2.1 bundle/ruby/3.1.0/gems/tilt-2.4.0/lib/tilt/rdiscount.rb
brakeman-6.2.0 bundle/ruby/3.1.0/gems/tilt-2.4.0/lib/tilt/rdiscount.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/tilt-2.4.0/lib/tilt/rdiscount.rb
tilt-2.4.0 lib/tilt/rdiscount.rb
getargv-0.3.3-universal-darwin vendor/bundle/ruby/3.3.0/gems/tilt-2.3.0/lib/tilt/rdiscount.rb
tilt-2.3.0 lib/tilt/rdiscount.rb
tilt-2.2.0 lib/tilt/rdiscount.rb