nanoc-tilt 0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -0
- data/.rvmrc +1 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +22 -0
- data/LICENSE.md +24 -0
- data/README.md +40 -0
- data/Rakefile +1 -0
- data/lib/nanoc-tilt.rb +28 -0
- data/lib/nanoc-tilt/version.rb +5 -0
- data/nanoc-tilt.gemspec +23 -0
- metadata +80 -0
data/.gitignore
ADDED
data/.rvmrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rvm 1.9.2@nanoc-tilt --create
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
nanoc-tilt (0.1)
|
5
|
+
nanoc
|
6
|
+
tilt
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: http://rubygems.org/
|
10
|
+
specs:
|
11
|
+
cri (1.0.1)
|
12
|
+
nanoc (3.1.8)
|
13
|
+
nanoc3 (>= 3.1.8)
|
14
|
+
nanoc3 (3.1.8)
|
15
|
+
cri (~> 1.0)
|
16
|
+
tilt (1.3.2)
|
17
|
+
|
18
|
+
PLATFORMS
|
19
|
+
ruby
|
20
|
+
|
21
|
+
DEPENDENCIES
|
22
|
+
nanoc-tilt!
|
data/LICENSE.md
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# License
|
2
|
+
|
3
|
+
## (The MIT License)
|
4
|
+
|
5
|
+
Copyright (c) 2011 Jake Benilov <benilov@gmail.com>
|
6
|
+
|
7
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
8
|
+
a copy of this software and associated documentation files (the
|
9
|
+
"Software"), to deal in the Software without restriction, including
|
10
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
11
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
12
|
+
permit persons to whom the Software is furnished to do so, subject to
|
13
|
+
the following conditions:
|
14
|
+
|
15
|
+
The above copyright notice and this permission notice shall be
|
16
|
+
included in all copies or substantial portions of the Software.
|
17
|
+
|
18
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
19
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
20
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
21
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
22
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
23
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
24
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
# nanoc-tilt
|
2
|
+
|
3
|
+
## Description
|
4
|
+
|
5
|
+
The nanoc-tilt gem allows [tilt](https://github.com/rtomayko/tilt) to manage the rendering of your files. That way, you can just follow the conventions that Tilt enforces (e.g. .haml files will be rendered by the Haml engine, .sass by Sass, etc) and end up much simpler compile rules in the nanoc Rules file.
|
6
|
+
|
7
|
+
## Requirements
|
8
|
+
|
9
|
+
* nanoc3
|
10
|
+
* tilt
|
11
|
+
|
12
|
+
## Installation
|
13
|
+
|
14
|
+
To use the nanoc-tilt, you have to start by installing the gem.
|
15
|
+
|
16
|
+
gem install nanoc-tilt
|
17
|
+
|
18
|
+
Then require the project main file in your default.rb file in the lib directory of your nanoc project.
|
19
|
+
|
20
|
+
require "nanoc/tilt"
|
21
|
+
|
22
|
+
## Usage
|
23
|
+
|
24
|
+
Here is a sample compile rule (in the Rules file) which uses nanoc-tilt:
|
25
|
+
|
26
|
+
compile '*' do
|
27
|
+
unless item.binary?
|
28
|
+
filter :tilt if Tilt.registered?(item[:extension])
|
29
|
+
layout 'common' if item[:extension] == 'erb'
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
## Author
|
34
|
+
|
35
|
+
* Jake Benilov <benilov@gmail.com>
|
36
|
+
|
37
|
+
## License
|
38
|
+
|
39
|
+
Copyright (c) 2011 Jake Benilov, nanoc-tilt is released under the MIT license.
|
40
|
+
See the LICENSE.md file for details.
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
data/lib/nanoc-tilt.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
require "nanoc-tilt/version"
|
2
|
+
require 'tempfile'
|
3
|
+
|
4
|
+
module Nanoc3::Filters
|
5
|
+
class TiltFilter < Nanoc3::Filter
|
6
|
+
identifier :tilt
|
7
|
+
type :text
|
8
|
+
|
9
|
+
def run(content, params={})
|
10
|
+
require 'tilt'
|
11
|
+
|
12
|
+
# Create context
|
13
|
+
context = ::Nanoc3::Context.new(assigns)
|
14
|
+
|
15
|
+
# Get result
|
16
|
+
proc = content ? lambda { content } : nil
|
17
|
+
Tilt.new(path_to_tiltable_file_for(content)).render(context, assigns, &proc)
|
18
|
+
end
|
19
|
+
|
20
|
+
protected
|
21
|
+
def path_to_tiltable_file_for(content)
|
22
|
+
tempfile = Tempfile.new(["tilt", "." + @item[:extension]])
|
23
|
+
tempfile << content
|
24
|
+
tempfile.close
|
25
|
+
tempfile.path
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
data/nanoc-tilt.gemspec
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "nanoc-tilt/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "nanoc-tilt"
|
7
|
+
s.version = Nanoc::Tilt::VERSION
|
8
|
+
s.authors = ["Jake Benilov"]
|
9
|
+
s.email = ["benilov@gmail.com"]
|
10
|
+
s.homepage = "https://github.com/benilovj/nanoc-tilt"
|
11
|
+
s.summary = %q{A filter for the nanoc (https://github.com/ddfreyne/nanoc), a static page generator, that lets you render your files with tilt (https://github.com/rtomayko/tilt)}
|
12
|
+
s.description = %q{This gem delivers a nanoc filter that allows the user to use tilt (https://github.com/rtomayko/tilt). Tilt is a wrapper around several Ruby template engines, which picks the correct one based on the source filename. }
|
13
|
+
|
14
|
+
s.rubyforge_project = "nanoc-tilt"
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
+
s.require_paths = ["lib"]
|
20
|
+
|
21
|
+
s.add_dependency "nanoc"
|
22
|
+
s.add_dependency "tilt"
|
23
|
+
end
|
metadata
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: nanoc-tilt
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '0.1'
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Jake Benilov
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2011-06-26 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: nanoc
|
16
|
+
requirement: &2160872140 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *2160872140
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: tilt
|
27
|
+
requirement: &2160871720 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *2160871720
|
36
|
+
description: ! 'This gem delivers a nanoc filter that allows the user to use tilt
|
37
|
+
(https://github.com/rtomayko/tilt). Tilt is a wrapper around several Ruby template
|
38
|
+
engines, which picks the correct one based on the source filename. '
|
39
|
+
email:
|
40
|
+
- benilov@gmail.com
|
41
|
+
executables: []
|
42
|
+
extensions: []
|
43
|
+
extra_rdoc_files: []
|
44
|
+
files:
|
45
|
+
- .gitignore
|
46
|
+
- .rvmrc
|
47
|
+
- Gemfile
|
48
|
+
- Gemfile.lock
|
49
|
+
- LICENSE.md
|
50
|
+
- README.md
|
51
|
+
- Rakefile
|
52
|
+
- lib/nanoc-tilt.rb
|
53
|
+
- lib/nanoc-tilt/version.rb
|
54
|
+
- nanoc-tilt.gemspec
|
55
|
+
homepage: https://github.com/benilovj/nanoc-tilt
|
56
|
+
licenses: []
|
57
|
+
post_install_message:
|
58
|
+
rdoc_options: []
|
59
|
+
require_paths:
|
60
|
+
- lib
|
61
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
62
|
+
none: false
|
63
|
+
requirements:
|
64
|
+
- - ! '>='
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '0'
|
67
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
68
|
+
none: false
|
69
|
+
requirements:
|
70
|
+
- - ! '>='
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '0'
|
73
|
+
requirements: []
|
74
|
+
rubyforge_project: nanoc-tilt
|
75
|
+
rubygems_version: 1.8.5
|
76
|
+
signing_key:
|
77
|
+
specification_version: 3
|
78
|
+
summary: A filter for the nanoc (https://github.com/ddfreyne/nanoc), a static page
|
79
|
+
generator, that lets you render your files with tilt (https://github.com/rtomayko/tilt)
|
80
|
+
test_files: []
|