module Quby::Compiler::Services::TextTransformation
Constants
- LINK_URL_REGEX
Modal pop up window link: ~~url~~link_body~~
- TEXT_VAR_REGEX
Textvars: Replace {{var_name}} with <span class='textvar' textvar='var_name'></span>
Public Instance Methods
link_html(url, link_content)
click to toggle source
# File lib/quby/compiler/services/text_transformation.rb, line 20 def link_html(url, link_content) "<a href='#' onclick='modalFrame(\"#{url}\");'>#{link_content}</a>" end
textvar_html(var_name)
click to toggle source
# File lib/quby/compiler/services/text_transformation.rb, line 24 def textvar_html(var_name) "<span class='textvar' textvar='#{var_name}'>{{#{var_name}}}</span>" end
transform_special_text(text)
click to toggle source
to eventually replace maruku_extensions.rb this helper transforms ~~ links and {{text vars}} into html
# File lib/quby/compiler/services/text_transformation.rb, line 15 def transform_special_text(text) text.gsub(LINK_URL_REGEX) { link_html($~[:url], $~[:link_content]) } .gsub(TEXT_VAR_REGEX) { textvar_html($~[:text_var]) } end