class Voom::Presenters::WebClient::CustomRender

Constants

BR

include Redcarpet::Render::SmartyPants

Public Class Methods

new(extensions = {}) click to toggle source
Calls superclass method
# File lib/voom/presenters/web_client/custom_render.rb, line 8
def initialize(extensions = {})
  super(extensions)
end

Public Instance Methods

paragraph(text) click to toggle source
# File lib/voom/presenters/web_client/custom_render.rb, line 12
def paragraph(text)
  text + BR
end
postprocess(full_document) click to toggle source
# File lib/voom/presenters/web_client/custom_render.rb, line 16
def postprocess(full_document)
  strip_trailing_br(colorize(full_document))
end

Private Instance Methods

colorize(doc) click to toggle source
# File lib/voom/presenters/web_client/custom_render.rb, line 22
def colorize(doc)
  doc.gsub(/{c:([#\w]\w+)}([^{]+){\/c}/) {|m| "<span style=\"color:#{$1};\">#{$2}</span>"}
end
strip_trailing_br(doc) click to toggle source
# File lib/voom/presenters/web_client/custom_render.rb, line 26
def strip_trailing_br(doc)
  return doc unless doc[-BR.length..-1] == BR
  doc[0...doc.length-BR.length]
end