Class: TDiary::Style::EtHtml4Factory

Inherits:
Object
  • Object
show all
Defined in:
lib/tdiary/style/etdiary.rb

Instance Method Summary collapse

Constructor Details

#initialize(opt, idx = 1) ⇒ EtHtml4Factory

Returns a new instance of EtHtml4Factory.



159
160
161
162
# File 'lib/tdiary/style/etdiary.rb', line 159

def initialize( opt, idx = 1 )
	@opt = opt
	@idx = idx
end

Instance Method Details

#block_title?(fragment) ⇒ Boolean

Returns:

  • (Boolean)


199
200
201
202
203
204
205
206
# File 'lib/tdiary/style/etdiary.rb', line 199

def block_title?( fragment )
	case fragment.anchor_type
	when :H3, :H4
		true
	else
		false
	end
end

#p_endObject



210
211
212
# File 'lib/tdiary/style/etdiary.rb', line 210

def p_end
	"</p>"
end

#p_startObject



207
208
209
# File 'lib/tdiary/style/etdiary.rb', line 207

def p_start
	"<p>"
end

#pre_endObject



216
217
218
# File 'lib/tdiary/style/etdiary.rb', line 216

def pre_end
	"</pre>"
end

#pre_startObject



213
214
215
# File 'lib/tdiary/style/etdiary.rb', line 213

def pre_start
	"<pre>"
end

#section_end(date) ⇒ Object



196
197
198
# File 'lib/tdiary/style/etdiary.rb', line 196

def section_end( date )
	"<%=section_leave_proc( Time::at( #{date.to_i} ) )%>\n</div>\n"
end

#section_start(date) ⇒ Object



193
194
195
# File 'lib/tdiary/style/etdiary.rb', line 193

def section_start( date )
	%Q[<div class="section">\n<%=section_enter_proc( Time::at( #{date.to_i} ) )%>\n]
end

#title(date, fragment) ⇒ Object



163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
# File 'lib/tdiary/style/etdiary.rb', line 163

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