wbzyl-sinatra-rdiscount 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1 @@
1
+ *.gem
data/LICENSE ADDED
File without changes
data/README.markdown ADDED
@@ -0,0 +1,105 @@
1
+ # RDiscount Templates for Sinatra
2
+
3
+ The *sinatra-rdiscount* gem is an extension for Sinatra.
4
+ It provides a request-helper method named *rdiscount*
5
+ for rendering RDiscount templates.
6
+
7
+ To use this extension, first install the gem on your system:
8
+
9
+ git clone git://github.com/wbzyl/sinatra-rdiscount.git
10
+ cd sinatra-rdiscount
11
+ gem build sinatra-rdiscount
12
+ sudo gem install sinatra-rdiscount
13
+
14
+ Then create simple Sinatra application *app.rb*:
15
+
16
+ require 'rubygems'
17
+ require 'sinatra'
18
+ require 'sinatra/rdiscount'
19
+
20
+ get "/" do
21
+ rdiscount "# Hello Rdiscount"
22
+ end
23
+
24
+ and run the above code:
25
+
26
+ ruby app.rb
27
+
28
+ The result could be seen here: *http://localhost:4567*.
29
+
30
+ Another example could be find in the *examples* directory.
31
+
32
+
33
+ ## Views / Templates
34
+
35
+ One important thing to remember is that you always have to reference
36
+ templates and layouts with **symbols**, even if they’re in a subdirectory,
37
+ for example `:'subdir/template'`.
38
+
39
+ Rendering methods will render any strings passed to them directly.
40
+
41
+
42
+ ### RDiscount Templates
43
+
44
+ The following gems are required to render RDiscount templates:
45
+ *rdiscount*, *erubis*.
46
+
47
+ This helper method:
48
+
49
+ get '/' do
50
+ rdiscount :index
51
+ end
52
+
53
+ renders template *./views/index.rdiscount*.
54
+
55
+ If a layout named *layout.rdiscount* exists, it will be used each time
56
+ a template is rendered.
57
+
58
+ You can disable layouts by passing:
59
+
60
+ :layout => false
61
+
62
+ For example
63
+
64
+ get '/' do
65
+ rdiscount :index, :layout => false
66
+ end
67
+
68
+ You can set a different layout from the default with:
69
+
70
+ get '/' do
71
+ rdiscount :index, :layout => :application
72
+ end
73
+
74
+ This renders *./views/index.rdiscount* template
75
+ within *./views/application.rdiscount* layout.
76
+
77
+
78
+ ## Important Info
79
+
80
+ Layouts are **HTML**, not RDiscount, files with ERB
81
+ insertions. Example:
82
+
83
+ <!DOCTYPE html>
84
+ <html>
85
+ <head>
86
+ <title><%= @title || "My Sinatra App" %></title>
87
+ </head>
88
+ <body>
89
+ <%= yield %>
90
+ </body>
91
+ </html>
92
+
93
+ Templates are RDiscount files with changed embedded pattern.
94
+ The default pattern `'<% %>'` is replaced by `'{% %}'`.
95
+ Example:
96
+
97
+ # Hello {%= @name %}
98
+
99
+ Such changes were necessary to avoid messing with
100
+ RDiscount engine which converts bare `&lt;` to `&amp;lt;`.
101
+
102
+ Also I think that there is no way with RDiscount to render
103
+ that line:
104
+
105
+ <!DOCTYPE html>
data/Rakefile ADDED
File without changes
@@ -0,0 +1,21 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = "sinatra-rdiscount"
5
+ s.version = '0.0.4'
6
+ s.date = '2009-03-31'
7
+
8
+ s.summary = "RDiscount templates for Sinatra applications"
9
+ s.email = "matwb@univ.gda.pl"
10
+ s.homepage = "http://github.com/wbzyl/sinatra-rdiscount"
11
+ s.description = "RDiscount templates for Sinatra applications"
12
+ s.authors = ["Włodek Bzyl"]
13
+ s.files = Dir['lib/**/*.rb'] + Dir['test/**/*.rb'] + Dir['examples/**/*.{rb,ru,css,rdiscount}'] +
14
+ %w{.gitignore sinatra-rdiscount.gemspec Rakefile README.markdown LICENSE}
15
+
16
+ s.add_dependency 'sinatra', '>=0.9.1'
17
+ s.add_dependency 'rdiscount', '>=1.3.4'
18
+ s.add_dependency 'erubis', '>=2.6.4'
19
+
20
+ s.rubygems_version = '1.3.1'
21
+ end
metadata ADDED
@@ -0,0 +1,86 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: wbzyl-sinatra-rdiscount
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.4
5
+ platform: ruby
6
+ authors:
7
+ - "W\xC5\x82odek Bzyl"
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-03-31 00:00:00 -07:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: sinatra
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 0.9.1
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: rdiscount
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 1.3.4
34
+ version:
35
+ - !ruby/object:Gem::Dependency
36
+ name: erubis
37
+ type: :runtime
38
+ version_requirement:
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: 2.6.4
44
+ version:
45
+ description: RDiscount templates for Sinatra applications
46
+ email: matwb@univ.gda.pl
47
+ executables: []
48
+
49
+ extensions: []
50
+
51
+ extra_rdoc_files: []
52
+
53
+ files:
54
+ - .gitignore
55
+ - sinatra-rdiscount.gemspec
56
+ - Rakefile
57
+ - README.markdown
58
+ - LICENSE
59
+ has_rdoc: false
60
+ homepage: http://github.com/wbzyl/sinatra-rdiscount
61
+ post_install_message:
62
+ rdoc_options: []
63
+
64
+ require_paths:
65
+ - lib
66
+ required_ruby_version: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: "0"
71
+ version:
72
+ required_rubygems_version: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: "0"
77
+ version:
78
+ requirements: []
79
+
80
+ rubyforge_project:
81
+ rubygems_version: 1.2.0
82
+ signing_key:
83
+ specification_version: 2
84
+ summary: RDiscount templates for Sinatra applications
85
+ test_files: []
86
+