class TDiary::Style::EtHtml4Factory

Public Class Methods

new( opt, idx = 1 ) click to toggle source
# File lib/tdiary/style/etdiary.rb, line 158
def initialize( opt, idx = 1 )
        @opt = opt
        @idx = idx
end

Public Instance Methods

block_title?( fragment ) click to toggle source
# File lib/tdiary/style/etdiary.rb, line 198
def block_title?( fragment )
        case fragment.anchor_type
        when :H3, :H4
                true
        else
                false
        end
end
p_end() click to toggle source
# File lib/tdiary/style/etdiary.rb, line 209
def p_end
        "</p>"
end
p_start() click to toggle source
# File lib/tdiary/style/etdiary.rb, line 206
def p_start
        "<p>"
end
pre_end() click to toggle source
# File lib/tdiary/style/etdiary.rb, line 215
def pre_end
        "</pre>"
end
pre_start() click to toggle source
# File lib/tdiary/style/etdiary.rb, line 212
def pre_start
        "<pre>"
end
section_end( date ) click to toggle source
# File lib/tdiary/style/etdiary.rb, line 195
def section_end( date )
        "<%=section_leave_proc( Time::at( #{date.to_i} ) )%>\n</div>\n"
end
section_start( date ) click to toggle source
# File lib/tdiary/style/etdiary.rb, line 192
def section_start( date )
        %Q[<div class="section">\n<%=section_enter_proc( Time::at( #{date.to_i} ) )%>\n]
end
title( date, fragment ) click to toggle source
# File lib/tdiary/style/etdiary.rb, line 162
def title( date, fragment )
        return nil if nil == fragment.anchor_type
        name = 'p%02d' % @idx
        @idx += 1
        if :A == fragment.anchor_type then
                if @opt['anchor'] then
                        return "<a name=\"#{name}\"></a>"
                else
                        return nil
                end
        end

        r = ''
        if @opt['index']
                if fragment.subtitle
                        r << %Q[<%= subtitle_proc( Time::at( #{date.to_i} ), #{fragment.subtitle.dump.gsub( /%/, '\\\\045' )} ) %>]
                else
                        r << %Q[<%= subtitle_proc( Time::at( #{date.to_i} ), nil ) %>]
                end
        end

        case fragment.anchor_type
        when :P
                r
        when :H4
                "<h4>" + r + ":</h4>\n"
        when :H3
                "<h3>" + r + "</h3>\n"
        end
end