This repository has been archived by the owner on Dec 19, 2018. It is now read-only.
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
0 parents
commit 1f0ad0e
Showing
9 changed files
with
120 additions
and
0 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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,4 @@ | |||
*.gem | |||
.bundle | |||
Gemfile.lock | |||
pkg/* |
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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,4 @@ | |||
source "http://rubygems.org" | |||
|
|||
# Specify your gem's dependencies in coffee-filter.gemspec | |||
gemspec |
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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,21 @@ | |||
Copyright (c) 2011 Paul Nicholson | |||
|
|||
Permission is hereby granted, free of charge, to any person obtaining | |||
a copy of this software and associated documentation files (the | |||
"Software"), to deal in the Software without restriction, including | |||
without limitation the rights to use, copy, modify, merge, publish, | |||
distribute, sublicense, and/or sell copies of the Software, and to | |||
permit persons to whom the Software is furnished to do so, subject to | |||
the following conditions: | |||
|
|||
The above copyright notice and this permission notice shall be | |||
included in all copies or substantial portions of the Software. | |||
|
|||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | |||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | |||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | |||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | |||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | |||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |||
|
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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,35 @@ | |||
=== What is coffee-filter? | |||
Coffee-filter provides a custom haml filter allowing you to inline coffeescript in your haml templates. | |||
It was inspired by Ivan Nemytchenko's coffee-haml-filter but I wanted an installable gem and "coffeescript" as the filter name. | |||
|
|||
=== Example | |||
Haml: | |||
|
|||
%div | |||
stuff | |||
:coffeescript | |||
alert 'here' | |||
|
|||
Html: | |||
|
|||
<div> | |||
stuff | |||
<script type='text/javascript'> | |||
//<![CDATA[ | |||
(function() { | |||
alert('here'); | |||
}).call(this); | |||
|
|||
//]]> | |||
</script> | |||
</div> | |||
|
|||
=== Installation | |||
Add the following to your Gemfile: | |||
|
|||
gem 'coffee-filter' | |||
|
|||
|
|||
Copyright (c) 2011 Paul Nicholson, released under the MIT license | |||
|
|||
|
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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,2 @@ | |||
require 'bundler' | |||
Bundler::GemHelper.install_tasks |
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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,23 @@ | |||
# -*- encoding: utf-8 -*- | |||
$:.push File.expand_path("../lib", __FILE__) | |||
require "coffee-filter/version" | |||
|
|||
Gem::Specification.new do |s| | |||
s.name = "coffee-filter" | |||
s.version = Coffee::Filter::VERSION | |||
s.platform = Gem::Platform::RUBY | |||
s.authors = ["Paul Nicholson"] | |||
s.email = ["paul@webpowerdesign.net"] | |||
s.homepage = "http://github.com/paulnicholson/coffee-filter" | |||
s.summary = %q{CoffeeFilter is a custom haml filter for rendering coffeescript.} | |||
s.description = %q{CoffeeFilter is a custom haml filter for rendering coffeescript inside your haml templates. It was inspired by Ivan Nemytchenko's coffee-haml-filter but I wanted an installable gem and coffeescript as the filter name.} | |||
|
|||
s.rubyforge_project = "coffee-filter" | |||
s.add_dependency('haml', '>= 3.0.18') | |||
s.add_dependency('coffee-script', '>= 2.2.0') | |||
|
|||
s.files = `git ls-files`.split("\n") | |||
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") | |||
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } | |||
s.require_paths = ["lib"] | |||
end |
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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,6 @@ | |||
require 'coffee-filter/coffeescript' | |||
|
|||
module Coffee | |||
module Filter | |||
end | |||
end |
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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,20 @@ | |||
module Coffee | |||
module Filter | |||
module Coffeescript | |||
include Haml::Filters::Base | |||
|
|||
lazy_require 'coffee-script' | |||
|
|||
def render_with_options(text, options) | |||
This comment has been minimized.
Sorry, something went wrong. |
|||
<<END | |||
<script type=#{options[:attr_wrapper]}text/javascript#{options[:attr_wrapper]}> | |||
//<![CDATA[ | |||
#{CoffeeScript.compile(text)} | |||
//]]> | |||
</script> | |||
END | |||
end | |||
end | |||
end | |||
end | |||
|
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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,5 @@ | |||
module Coffee | |||
module Filter | |||
VERSION = "0.1.0" | |||
end | |||
end |
I'm not a Ruby guy but could you forward the compiled text and options to the JavaScript filter? Besides indenting differently nex3/haml@bc4977f modified the behaviour of
type
attributes.