Class: TDiary::Style::EtCHtmlFactory
- Inherits:
-
Object
- Object
- TDiary::Style::EtCHtmlFactory
- Defined in:
- lib/tdiary/style/etdiary.rb
Instance Method Summary collapse
- #block_title?(fragment) ⇒ Boolean
-
#initialize(opt, idx = 1) ⇒ EtCHtmlFactory
constructor
A new instance of EtCHtmlFactory.
- #p_end ⇒ Object
- #p_start ⇒ Object
- #pre_end ⇒ Object
- #pre_start ⇒ Object
- #section_end(date) ⇒ Object
- #section_start(date) ⇒ Object
- #title(date, fragment) ⇒ Object
Constructor Details
#initialize(opt, idx = 1) ⇒ EtCHtmlFactory
Returns a new instance of EtCHtmlFactory.
222 223 224 225 |
# File 'lib/tdiary/style/etdiary.rb', line 222 def initialize( opt, idx = 1 ) @opt = opt @idx = idx end |
Instance Method Details
#block_title?(fragment) ⇒ Boolean
252 253 254 255 256 257 258 259 |
# File 'lib/tdiary/style/etdiary.rb', line 252 def block_title?( fragment ) case fragment.anchor_type when :H3 true else false end end |
#p_end ⇒ Object
263 264 265 |
# File 'lib/tdiary/style/etdiary.rb', line 263 def p_end "</P>" end |
#p_start ⇒ Object
260 261 262 |
# File 'lib/tdiary/style/etdiary.rb', line 260 def p_start "<P>" end |
#pre_end ⇒ Object
269 270 271 |
# File 'lib/tdiary/style/etdiary.rb', line 269 def pre_end "</PRE>" end |
#pre_start ⇒ Object
266 267 268 |
# File 'lib/tdiary/style/etdiary.rb', line 266 def pre_start "<PRE>" end |
#section_end(date) ⇒ Object
249 250 251 |
# File 'lib/tdiary/style/etdiary.rb', line 249 def section_end( date ) "<%=section_leave_proc( Time::at( #{date.to_i} ) )%>\n" end |
#section_start(date) ⇒ Object
246 247 248 |
# File 'lib/tdiary/style/etdiary.rb', line 246 def section_start( date ) "<%=section_enter_proc( Time::at( #{date.to_i} ) )%>\n" end |
#title(date, fragment) ⇒ Object
226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 |
# File 'lib/tdiary/style/etdiary.rb', line 226 def title( date, fragment ) return nil if nil == fragment.anchor_type name = 'p%02d' % @idx return "<A NAME=\"#{name}\"></A>" if :A == fragment.anchor_type r = "" 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 @idx += 1 case fragment.anchor_type when :P r when :H4 r + ": " when :H3 "<H3>" + r + "</H3>\n" end end |