File: title_list.rb

package info (click to toggle)
tdiary 2.2.1%2Bdfsg1-1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 14,044 kB
  • ctags: 2,796
  • sloc: ruby: 32,562; lisp: 514; makefile: 83; sh: 72; sql: 40
file content (34 lines) | stat: -rw-r--r-- 1,217 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# titile_list.rb $Revision: 1.21 $
#
# title_list: ɽƤΥȥꥹȤɽ
#   ѥ᥿(å̤):
#     rev:       սɽ(false)
#
# : ȥꥹȤˤϡ쥤Ȥפʤ
# ʤޤ󡣥إåեåtableȤäꡢCSS񤭴ɬ
# פǤ礦
#
# Copyright (c) 2005 TADA Tadashi <sho@spc.gr.jp>
# You can distribute this file under the GPL2.
#
def title_list( rev = false )
	result = %Q|<ul class="title-list">\n|
	keys = @diaries.keys.sort
	keys = keys.reverse if rev
	keys.each do |date|
		next unless @diaries[date].visible?
		result << %Q[<li><a href="#{h( @index )}#{h anchor( date )}">#{h( @diaries[date].date.strftime( @date_format ) )}</a>\n\t<ul class="title-list-item">\n]
		if !@plugin_files.grep(/\/category.rb$/).empty? and @diaries[date].categorizable?
			@diaries[date].each_section do |section|
				result << %Q[\t<li>#{section.stripped_subtitle_to_html}</li>\n] if section.stripped_subtitle
			end
		else
			@diaries[date].each_section do |section|
				result << %Q[<li>#{section.subtitle_to_html}</li>\n] if section.subtitle
			end
		end
		result << "\t</ul>\n</li>\n"
	end
	apply_plugin( result << "</ul>\n" )
end