1 module RedClothArvadosLinkExtension
3 class RedClothViewBase < ActionView::Base
4 include ApplicationHelper
5 include ActionView::Helpers::UrlHelper
6 include Rails.application.routes.url_helpers
8 def helper_link_to_if_arvados_object(link, opts)
9 link_to_if_arvados_object(link, opts)
13 def refs_arvados(text)
14 text.gsub!(/"(?!\s)([^"]*\S)":(\S+)/) do
16 arvados_link = RedClothViewBase.new.helper_link_to_if_arvados_object(link, { :link_text => text })
17 # if it's not an arvados_link the helper will return the link unprocessed and so we will reconstruct the textile link string so it can be processed normally
18 (arvados_link == link) ? "\"#{text}\":#{link}" : arvados_link
23 RedCloth.send(:include, RedClothArvadosLinkExtension)