| ... | ... |
@@ -159,6 +159,27 @@ module Helpers |
| 159 | 159 |
def style_amp(input) |
| 160 | 160 |
input.gsub(" & "," <span class='amp'>&</span> ")
|
| 161 | 161 |
end |
| 162 |
+ |
|
| 163 |
+ module PartialsHelper |
|
| 164 |
+ |
|
| 165 |
+ # A very hackish way to handle partials. We'll go with it till it breaks... |
|
| 166 |
+ def include(partial_name) |
|
| 167 |
+ file_ext = partial_name[(partial_name.index('.') + 1)..partial_name.length]
|
|
| 168 |
+ contents = IO.read("_includes/#{partial_name}")
|
|
| 169 |
+ case file_ext |
|
| 170 |
+ when 'haml' |
|
| 171 |
+ Haml::Engine.new(contents).render(binding) |
|
| 172 |
+ when 'textile' |
|
| 173 |
+ RedCloth.new(contents).to_html |
|
| 174 |
+ when 'markdown' |
|
| 175 |
+ RDiscount.new(contents).to_html |
|
| 176 |
+ else |
|
| 177 |
+ contents |
|
| 178 |
+ end |
|
| 179 |
+ end |
|
| 180 |
+ end |
|
| 181 |
+ |
|
| 182 |
+ include PartialsHelper |
|
| 162 | 183 |
end |
| 163 | 184 |
|
| 164 | 185 |
class String |