Method: Blogtext.perform

Defined in:
lib/blogtext.rb

.performObject



16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/blogtext.rb', line 16

def self.perform
  res = []
  @contents.each_with_index do |l,i|
    res.push("<h1>#{l.strip}</h1>") if (i == 0)
    res.push("<h3>#{l.strip}</h3>") if (i == 1)
    res.push(Video.add(l)) if l.start_with?("[video]")
    res.push(Image.add(l)) if l.start_with?("[image]")
    res.push(Quote.add(l)) if l.start_with?("[quote]")
    res.push(Paragraph.add(l.strip)) if ((i>1) && !l.start_with?("[quote]","[image]","[video]"))
  end
  @newcontents = new_contents(res)
end