Module: RedCloth::Formatters::HTML

Defined in:
lib/pages/redcloth/formatters/html.rb

Instance Method Summary collapse

Instance Method Details

#image_with_prefix(opts) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/pages/redcloth/formatters/html.rb', line 12

def image_with_prefix(opts)
	if opts[:href] && opts[:href] =~ /^\//
		opts[:href] = ActionController::Base.relative_url_root.to_s + opts[:href]
	end
	if opts[:src] =~ /^\//
		opts[:src] = ActionController::Base.relative_url_root.to_s + opts[:src]
	end
	image_without_prefix(opts)
end


4
5
6
7
8
9
# File 'lib/pages/redcloth/formatters/html.rb', line 4

def link_with_prefix(opts)
	if opts[:href] =~ /^\//
		opts[:href] = ActionController::Base.relative_url_root.to_s + opts[:href]
	end
	link_without_prefix(opts)
end