class TDiary::Style::RdDiary
Public Class Methods
new( date, title, body, modified = Time::now )
click to toggle source
# File lib/tdiary/style/rd.rb, line 290 def initialize( date, title, body, modified = Time::now ) init_diary replace( date, title, body ) @last_modified = modified end
Public Instance Methods
add_section(subtitle, body)
click to toggle source
# File lib/tdiary/style/rd.rb, line 319 def add_section(subtitle, body) sec = RDSection::new("\n") sec.subtitle = subtitle sec.body = body @sections << sec @sections.size end
append( body, author = nil )
click to toggle source
# File lib/tdiary/style/rd.rb, line 300 def append( body, author = nil ) section = nil body.lines.each do |l| case l when /^=(begin|end)\b/ # do nothing when /^=[^=]/ @sections << RDSection::new( section, author ) if section section = l else section = '' unless section section << l end end @sections << RDSection::new( section, author ) if section @last_modified = Time::now self end
style()
click to toggle source
# File lib/tdiary/style/rd.rb, line 296 def style 'RD' end
to_html( opt = {}, mode = :HTML )
click to toggle source
# File lib/tdiary/style/rd.rb, line 327 def to_html( opt = {}, mode = :HTML ) r = '' idx = 1 each_section do |section| r << section.html( date, idx, opt, mode ) idx += 1 end return r end