class TDiary::Style::BlogDiary

Public Instance Methods

style() click to toggle source
# File lib/tdiary/style/blog.rb, line 26
def style
        'Blog'
end
to_chtml( opt ) click to toggle source
# File lib/tdiary/style/blog.rb, line 51
def to_chtml( opt )
        r = ''
        each_section do |section|
                if section.subtitle then
                        r << %Q[<H3>#{section.subtitle}</H3>]
                end
                if /^</ =~ section.body then
                        r << section.body
                else
                        r << %Q[<P>#{section.body.lines.collect{|l|l.chomp.sub( /^[  ]/u, '' )}.join( "</P>\n<P>" )}</P>]
                end
        end
        r
end
to_html4( opt ) click to toggle source
# File lib/tdiary/style/blog.rb, line 30
def to_html4( opt )
        section_id = 0
        r = %Q[<div class="section">\n]
        each_section do |section|
                if section_id > 0 and not opt['anchor'] then
                        r << %Q|<p class="readmore"><a href="#{opt['index']}<%=anchor "#{date.strftime( '%Y%m%d' )}"%>">Read more...</a></p>\n|
                        break
                end
                if section.subtitle then
                        r << %Q[<h3>#{section.subtitle}</h3>\n]
                end
                if /^</ =~ section.body then
                        r << %Q[#{section.body}\n]
                else
                        r << %Q[<p>#{section.body.lines.collect{|l|l.chomp.sub( /^[  ]/u, '' )}.join( "</p>\n<p>" )}</p>\n]
                end
                section_id += 1
        end
        r << %Q[</div>]
end