Class: TDiary::Style::BloggfmDiary
- Inherits:
-
GfmDiary
- Object
- GfmDiary
- TDiary::Style::BloggfmDiary
- Defined in:
- lib/tdiary/style/bloggfm.rb
Instance Method Summary collapse
Instance Method Details
#append(body, author = nil) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/tdiary/style/bloggfm.rb', line 14 def append( body, = nil ) in_code_block = false section = nil body.each_line do |l| case l when /^\#[^\#]/ if in_code_block section << l else @sections << BloggfmSection.new(section, ) if section section = l end when /^```/ in_code_block = !in_code_block section << l else section = '' unless section section << l end end if section section << "\n" unless section =~ /\n\n\z/ @sections << BloggfmSection.new(section, ) end @last_modified = Time.now self end |
#style ⇒ Object
10 11 12 |
# File 'lib/tdiary/style/bloggfm.rb', line 10 def style 'BlogGfm' end |
#to_html4(opt) ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/tdiary/style/bloggfm.rb', line 42 def to_html4( opt ) r = '' idx = 1 each_section do |section| if idx > 1 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 r << section.html4( date, idx, opt ) idx += 1 end r end |