Module: PublicContentsHelper

Defined in:
app/helpers/public_contents_helper.rb

Constant Summary collapse

Regexp.new('\[(.*)\]\(\/(otus|sources|taxon_names)\/(\d+)\)')

Instance Method Summary collapse

Instance Method Details

#public_content_renderer(public_content, style = :default) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'app/helpers/public_contents_helper.rb', line 5

def public_content_renderer(public_content, style = :default)

  t  = public_content.text

  if style
    case style.to_sym
    when :linked_otu # only link OTU
      r = Regexp.new('\[(.*)\]\(\/(sources|taxon_names)\/(\d+)\)')
      t.gsub!(r, '\1')
    when :none
      t.gsub!(LINK_REGEX, '\1')
    else
      # do nothing
    end
  end

  MARKDOWN_HTML.render(t).html_safe
end