forked from cloudhead/dorothy
/
config.ru
65 lines (50 loc) · 2.14 KB
/
config.ru
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
require 'toto'
require 'haml'
# Rack config
use Rack::Static, :urls => ['/css', '/js', '/images', '/fonts', '/favicon.ico'], :root => 'public'
use Rack::CommonLogger
# Set up Compass/Sass
require 'sass/plugin/rack'
use Sass::Plugin::Rack
require 'compass'
Compass.configuration.parse('compass.config')
Compass.configuration do |config|
config.project_path = File.dirname(__FILE__)
config.sass_dir = "sass"
config.css_dir = "public/css"
config.output_style = :compact
end
Compass.configure_sass_plugin!
# syntax highlighting
gem 'coderay' # get one of supported highlighters
require 'coderay'
gem 'hyperbolist-rack-codehighlighter'
require 'rack/codehighlighter'
use Rack::Codehighlighter, :coderay, :element => "pre", :pattern => /\A:::(\w+)\s*\n/
use Rack::Codehighlighter, :coderay, :markdown => true, :element => "pre>code", :pattern => /\A:::(\w+)\s*(\n|
)/i, :logging => false
if ENV['RACK_ENV'] == 'development'
use Rack::ShowExceptions
else
Sass::Plugin.options[:never_update] = true
end
#
# Create and configure a toto instance
#
toto = Toto::Server.new do
#
# Add your settings here
# set [:setting], [value]
#
# set :author, ENV['USER'] # blog author
set :title, Dir.pwd.split('/').last # site title
# set :root, "index" # page to load on /
# set :date, lambda {|now| now.strftime("%d/%m/%Y") } # date format for articles
set :markdown, :smart # use markdown + smart-mode
# set :disqus, false # disqus id, or false
# set :summary, :max => 150, :delim => /~/ # length of article summary and delimiter
# set :ext, 'txt' # file extension for articles
# set :cache, 28800 # cache duration, in seconds
set :to_html, lambda {|path, page, binding| Haml::Engine.new(File.read("#{path}/#{page}.haml"), :format => :html5, :attr_wrapper => '"').render(binding) }
set :date, lambda {|now| now.strftime("%B #{now.day.ordinal} %Y") }
end
run toto