Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
tree: 332f59c0e8
Fetching contributors…

Cannot retrieve contributors at this time

36 lines (30 sloc) 0.753 kb
require 'rubygems'
require 'sinatra'
require 'haml'
require 'sass'
require 'json'
set :public, 'client'
set :haml, :format => :html5
helpers do
def get_page name
File.open("data/pages/#{name}", 'r') { |file| JSON.parse(file.read)}
end
def resolve_links string
string.
gsub(/\[\[([a-z-]+)\]\]/, '<a href="/\1">\1</a>').
gsub(/\[(http.*?) (.*?)\]/, '<a href="\1">\2</a>')
end
end
configure do
$identity = File.open("data/status/local-identity", 'r') { |file| JSON.parse(file.read) }
end
get '/style.css' do
content_type 'text/css'
sass :style
end
get '/' do
haml :page, :locals => { :page => get_page($identity['root']) }
end
get %r{/([a-z-]+)} do |name|
haml :page, :locals => { :page => get_page(name) }
end
Jump to Line
Something went wrong with that request. Please try again.