Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Extension providing Maruku templates for Sinatra applications.
Ruby
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
examples
lib/sinatra
test
.gitignore
LICENSE
README.markdown
Rakefile
VERSION.yml
sinatra-maruku.gemspec

README.markdown

Sinatra Maruku Extension

The sinatra-maruku extension provides maruku helper method for rendering Maruku templates.

To install it, run:

sudo gem install wbzyl-sinatra-maruku -s http://gems.github.com

To test it, create a simple Sinatra application:

# app.rb
require 'rubygems'
require 'sinatra'

gem 'wbzyl-sinatra-maruku'
require 'sinatra/maruku'

get "/" do
  maruku "# Hello Maruku"
end

and run it with:

ruby app.rb

The result could be seen at http://localhost:4567.

Another example could be find in the examples directory. Run it with:

rackup -p 4567 config.ru

and visit http://localhost:4567 to contemplate the sheer beauty of rendered text written in Maruku notation.

Two links to Maruku related material

Template Languages (update to The Sinatra Book)

Maruku Templates

This helper method:

get '/' do
  maruku :index
end

renders template ./views/index.maruku.

If a layout named layout.maruku exists, it will be used each time a template is rendered.

You can disable layouts by passing :layout => false to maruku helper. For example

get '/' do
  maruku :index, :layout => false
end

You can set a different layout from the default one with:

get '/' do
  maruku :index, :layout => :application
end

This renders ./views/index.maruku template within ./views/application.maruku layout.

Sample layout for Maruku templates

CSS: /stylesheets/application.css /stylesheets/print.css
Lang: pl
Title: Hello Maruku 
LaTeX preamble: preamble.tex

# Hello Maruku  {.header}

<%= yield %>
Something went wrong with that request. Please try again.