Class: MarkdownFeature

Inherits:
Object
  • Object
show all
Defined in:
lib/jay_flavored_markdown/markdown_converter.rb

Direct Known Subclasses

ListItemFeature, SectionFeature

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.create(type) ⇒ Object



142
143
144
145
146
147
148
149
# File 'lib/jay_flavored_markdown/markdown_converter.rb', line 142

def self.create(type)
  case type
  when :item
    ListItemFeature.new
  when :section
    SectionFeature.new
  end
end

Instance Method Details

#create_counterObject



159
160
161
# File 'lib/jay_flavored_markdown/markdown_converter.rb', line 159

def create_counter
  LeveledCounter.create(type).next_level
end

#indent_length(line) ⇒ Object



155
156
157
# File 'lib/jay_flavored_markdown/markdown_converter.rb', line 155

def indent_length(line)
  indent =~ line ? $1.length : 0
end

#match_start_regexp?(string) ⇒ Boolean

Returns:

  • (Boolean)


151
152
153
# File 'lib/jay_flavored_markdown/markdown_converter.rb', line 151

def match_start_regexp?(string)
  start_regexp =~ string
end

#select_counter(counters) ⇒ Object



163
164
165
# File 'lib/jay_flavored_markdown/markdown_converter.rb', line 163

def select_counter(counters)
  counters.find {|item| item.type == type}
end