Class: Todo

Inherits:
Chunk::Abstract show all
Defined in:
app/models/chunks/todo.rb

Overview

ToDo items.

Instance Attribute Summary

Attributes inherited from Chunk::Abstract

#revision, #text

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Chunk::Abstract

#mask, #post_mask, #pre_mask, #revert

Constructor Details

#initialize(match_data, revision) ⇒ Todo

Returns a new instance of Todo.



9
10
11
# File 'app/models/chunks/todo.rb', line 9

def initialize(match_data, revision)
  super(match_data, revision)
end

Class Method Details

.patternObject



7
# File 'app/models/chunks/todo.rb', line 7

def self.pattern() /todo: ([^\n]+)/i end

Instance Method Details

#escaped_textObject



13
# File 'app/models/chunks/todo.rb', line 13

def escaped_text() nil end

#unmask(content) ⇒ Object



15
16
17
18
19
20
21
# File 'app/models/chunks/todo.rb', line 15

def unmask(content) 
  return self if content.gsub!( Regexp.new(mask(content)),
    # the style 'todo' is bright-red to be eye catching. It is not expected that
    # there will be too many items on one page, but each is supposed to stand out.
    # The ToDo special page differentiates between the 'todo' and 'todoFuture' styles.
    "<span class=\"todo\"><strong>TODO:</strong> #{@text.gsub(/todo:\s*/, '')}</span>" )
end