/usr/lib/ruby/vendor_ruby/tilt/rdiscount.rb is in ruby-tilt 2.0.1-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | require 'tilt/template'
require 'rdiscount'
module Tilt
# 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.
class RDiscountTemplate < Template
self.default_mime_type = 'text/html'
ALIAS = {
:escape_html => :filter_html,
:smartypants => :smart
}
FLAGS = [:smart, :filter_html, :smartypants, :escape_html]
def flags
FLAGS.select { |flag| options[flag] }.map { |flag| ALIAS[flag] || flag }
end
def prepare
@engine = RDiscount.new(data, *flags)
@output = nil
end
def evaluate(scope, locals, &block)
@output ||= @engine.to_html
end
def allows_script?
false
end
end
end
|