forked from sbfaulkner/sinatra-markaby
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
151 additions
and
133 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +0,0 @@ | ||
= 0.9.2.2 | ||
|
||
* layout support is tested | ||
|
||
= 0.9.2.1 | ||
|
||
* use Rack::Test instead of Sinatra::Test | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
= TODO | ||
|
||
* refactor render/views in sinatra | ||
* set :erector |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
--- | ||
:major: 0 | ||
:minor: 9 | ||
:patch: 2.2 | ||
:minor: 1 | ||
:patch: 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
require 'sinatra/base' | ||
require 'erector' | ||
require 'activesupport' | ||
|
||
module Sinatra | ||
module Erector | ||
|
||
include ActiveSupport::CoreExtensions::String::Inflections | ||
|
||
# Generate html file using Erector. | ||
# Takes the name of a template to render as a Symbol and returns a String | ||
# with the rendered output. | ||
def erector(template=nil, options={}, locals = {}, &block) | ||
options, template = template, nil if template.is_a?(Hash) | ||
template = lambda { block } if template.nil? | ||
render :erector, template, options, locals | ||
end | ||
|
||
protected | ||
def render_erector(template, data, options, locals, &block) | ||
# puts "---" | ||
# puts "template=#{template}" | ||
# puts "data='#{data}'" | ||
# puts "options.inspect='#{options.inspect}'" | ||
# puts "locals='#{locals.inspect}'" | ||
# puts "block='#{block}'" | ||
|
||
filename = options.delete(:filename) || '<ERECTOR>' | ||
line = options.delete(:line) || 1 | ||
|
||
if data.respond_to?(:to_str) | ||
widget = ::Erector::Widget.new(locals) do | ||
eval(data.to_str, binding, filename, line) | ||
end | ||
# end | ||
elsif data.kind_of?(Proc) | ||
widget = ::Erector::Widget.new(locals, &data) | ||
end | ||
widget.to_s | ||
end | ||
end | ||
|
||
helpers Erector | ||
end |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# -*- encoding: utf-8 -*- | ||
|
||
Gem::Specification.new do |s| | ||
s.name = %q{sinatra-erector} | ||
s.version = "0.1.0" | ||
|
||
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= | ||
s.authors = ["Alex Chaffee"] | ||
s.date = %q{2009-05-20} | ||
s.description = %q{Sinatra plugin to enable erector (.erector) template rendering.} | ||
s.email = %q{alex@stinky.com} | ||
s.extra_rdoc_files = [ | ||
"LICENSE", | ||
"README.rdoc" | ||
] | ||
s.files = [ | ||
"LICENSE", | ||
"README.rdoc", | ||
"Rakefile", | ||
"VERSION.yml", | ||
"lib/sinatra/erector.rb", | ||
"test/sinatra_erector_test.rb", | ||
"test/test_helper.rb", | ||
"test/views/hello.erector", | ||
"test/views/html.erector" | ||
] | ||
s.homepage = %q{http://github.com/alexch/sinatra-erector} | ||
s.rdoc_options = ["--charset=UTF-8"] | ||
s.require_paths = ["lib"] | ||
s.rubygems_version = %q{1.3.3} | ||
s.summary = %q{Sinatra plugin to enable erector (.erector) template rendering.} | ||
s.test_files = [ | ||
"test/sinatra_erector_test.rb", | ||
"test/test_helper.rb" | ||
] | ||
|
||
if s.respond_to? :specification_version then | ||
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION | ||
s.specification_version = 3 | ||
|
||
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then | ||
s.add_runtime_dependency(%q<erector>, [">= 0"]) | ||
else | ||
s.add_dependency(%q<erector>, [">= 0"]) | ||
end | ||
else | ||
s.add_dependency(%q<erector>, [">= 0"]) | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
p "Hello, #{@name}!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
puts "zomg" | ||
puts "block=#{@block}" | ||
html do | ||
head { title "Hello" } | ||
body { yield } | ||
end |