Class: Calico

Inherits:
String
  • Object
show all
Defined in:
lib/calico.rb

Instance Method Summary collapse

Instance Method Details

#parseObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/calico.rb', line 7

def parse
  strip!
  split(/\n*^(---.*?^---)\n*|(?:\n\n+)/m).map do |block|
    case block
    when /\A\*\s/
      [:list, list(block)]
    when /\A---/
      [:verb, verb(block)]
    when /\A>\s/
      [:quote, quote(block)]
    else
      [:para, inline(block)]
    end
  end
end

#to_htmlObject



3
4
5
# File 'lib/calico.rb', line 3

def to_html
  render(parse)
end