Top Level Namespace

Defined Under Namespace

Classes: ColorConfig, TodoRb

Constant Summary collapse

COLORS =
ColorConfig.new
COLORIZER =
File.join(File.dirname(__FILE__), 'colorizer.rb')
HTML =
File.join(File.dirname(__FILE__), 'html.rb')

Instance Method Summary collapse

Instance Method Details

#color_span(s, color) ⇒ Object



5
6
7
# File 'lib/html.rb', line 5

def color_span s, color
  "<span style='color:#{color}'>#{s}</span>"
end

#colorize(s) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/html.rb', line 11

def colorize s
  s.gsub(/@\S+/) {|m| 
      if COLORS.html(m)
        color_span(m, COLORS.html(m)) 
      else 
        color_span(m, COLORS.html('context'))
      end
    }. gsub(/\+[\S]+/) {|m| 
      if COLORS.html(m)
        color_span(m, COLORS.html(m)) 
      else
        color_span(m, COLORS.html('project'))
      end
    }
end

#mark_priority(s) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/html.rb', line 27

def mark_priority s
  return s if $no_color
  return s unless  s =~ /!/ 
  s.chomp!
  span =  Regexp.new "<span.*span>"
  s.split(span).map {|a|
    [a, color_span(a, COLORS.html('priority'))]
  }.each {|(old, new)|
    s.sub!(old, new)
  }
  s
end