/
bilborc.default
64 lines (57 loc) · 1.75 KB
/
bilborc.default
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
57
58
59
60
61
62
63
64
# -*- encoding: UTF-8 -*-
def root_path
File.dirname(File.expand_path(__FILE__)).untaint
end
# 各種パラメータ設定
def config
{
# ブログのURLに書き換えてください
:base_url => 'http://dgames.jp/bilbo', # for bilborss
:title => 'The Bilbo Diary',
:description => 'Please set config[:description] in bilborc',
:dir => {
:entries => '__BILBO_ROOT__/data_sample',
:views => '__BILBO_ROOT__/views',
:plugins => "#{root_path}/config/plugins",
},
:limit => 5,
# 複数のcssを使用する場合は配列で指定してください
# CGIで起動する場合はcssへのパスを環境に合わせてください
:css => '/stylesheets/bilbo.css',
#:css => '/stylesheets/nobunaga/nobunaga.css',
#:environment => :production,
}
end
# 記事のコンパイラを設定
def add_compilers
# HikiDocを登録(拡張「.txt」に関連付ける)
require 'misc/hikidoc.rb'
Entry.add_compiler('.txt') {|entry|
HikiDoc.to_html(entry.body, :level => 2)
# 記事にpluginを埋め込むなら以下を使う
# 記事に書く例: {{amazon '4777512924'}}
#eval_hiki_plugin(HikiDoc.to_html(entry.body, :level => 2))
}
# mixiスタイルを登録
require 'misc/mixistyle.rb'
Entry.add_compiler('.mixi') {|entry|
MixiStyle.to_html(entry.body)
}
# 拡張子「.src」のソースをそのまま表示する例
Entry.add_compiler('.src') {|entry|
"<h2>#{h entry.filename}</h2><pre>#{h entry.body}</pre>"
}
end
def redirect_to_new_path
false
end
def setup_environment
if defined? Encoding
Encoding.default_external = 'UTF-8' # 1.9
else
$KCODE = 'UTF-8' # 1.8
end
load 'bilbo.rb'
add_compilers
Entry.entries_dir = config[:dir][:entries]
end