Class: TDiary::Style::BlogDiary
- Inherits:
-
TdiaryDiary
- Object
- TdiaryDiary
- TDiary::Style::BlogDiary
- Defined in:
- lib/tdiary/style/blog.rb
Instance Method Summary collapse
Instance Method Details
#style ⇒ Object
27 28 29 |
# File 'lib/tdiary/style/blog.rb', line 27 def style 'Blog' end |
#to_chtml(opt) ⇒ Object
52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/tdiary/style/blog.rb', line 52 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) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/tdiary/style/blog.rb', line 31 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 |