/usr/share/tdiary/contrib/plugin/select-style.rb is in tdiary-contrib 5.0.8-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | #
# select-style.rb: select a style from installed styles
#
# add a line below, after load_cgi_conf in tdiary.conf:
# @style = @options2['style'] if @options2 && @options2['style']
#
def saveconf_style
if @mode == 'saveconf' then
@conf['style'] = @cgi.params['style'][0]
end
end
def enum_styles
TDiary::Style.constants(false).grep(/Diary$/).delete_if{|s|
s =~ /Base|Categorizable|Uncategorizable/
}.map{|s|
s.to_s.sub(/Diary$/, '').downcase
}.each{|s|
yield s
}
end
add_conf_proc( 'style', 'スタイル', 'update' ) do
saveconf_style
labels = {
'tdiary' => 'tDiary',
'wiki' => 'Wiki',
'gfm' => 'GFM',
'etdiary' => 'etDiary',
'emptdiary' => 'emptDiary',
'rd' => 'RD',
}
r = <<-HTML
<h3 class="subtitle">スタイルの指定</h3>
<p>スタイル (日記の文法) を指定します。</p>
<p>
<select name="style">
HTML
enum_styles do |style|
label = labels[style] || style
select = if (label == @conf['style']) or (!@conf['style'] && style == 'tdiary')
' selected'
else
''
end
r << %Q|<option value="#{label}"#{select}>#{labels[style] || style}</option>|
end
r << <<-HTML
</select>
</p>
<p>スタイルについての詳細は<a href="http://tdiary-users.sourceforge.jp/cgi-bin/wiki.cgi?%A5%B9%A5%BF%A5%A4%A5%EB">スタイル - tDiary の記法</a>をごらんください。</p>
HTML
end
|