Sha256: d6c27c3d99117585e668ce8e12f4b1958fd2dec151a8ed7d5609c61786c87b95
Contents?: true
Size: 1.39 KB
Versions: 2
Compression:
Stored size: 1.39 KB
Contents
# # 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>" unless @conf.mobile_agent?} <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>" unless @conf.mobile_agent?} HTML end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
tdiary-contrib-4.1.3 | plugin/select-style.rb |
tdiary-contrib-4.1.2 | plugin/select-style.rb |