nanoc-tilt 0.1.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: cd37dc3da6439b4623567a5b942be237e6313281c50fb1fa908d7bd41d67f65e
4
+ data.tar.gz: ae623da463dd72e786b09f837b6240ec17a6d4e5b8e193bfc327ba62e12aa7e4
5
+ SHA512:
6
+ metadata.gz: 2e2f65df0303430a522548bfbffc6249c835f006da27123f2cf1bfb35a339af0866fd59dbbe2bcacf03d511509a2fffe371d2116c24561ba8c57ec1089408ba2
7
+ data.tar.gz: 03c80f11485a7baf7317800fbb5af430e9af759bf7a51222ed86e336d07f2fade71102b2d4b1ea803cb0a9f5a2c206f47107ca1defdf2ddc90b47a06f56a89cc
data/NEWS.md ADDED
@@ -0,0 +1,5 @@
1
+ # nanoc-tilt news
2
+
3
+ ## 1.0.0 (2022-10-29)
4
+
5
+ Initial release.
data/README.md CHANGED
@@ -1,40 +1,31 @@
1
1
  # nanoc-tilt
2
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
3
+ This provides a filter that allows [Nanoc](https://nanoc.app) to process content via [Tilt](https://github.com/rtomayko/tilt).
11
4
 
12
5
  ## Installation
13
6
 
14
- To use the nanoc-tilt, you have to start by installing the gem.
7
+ Add `nanoc-tilt` to the `nanoc` group of your Gemfile:
15
8
 
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"
9
+ ```ruby
10
+ group :nanoc do
11
+ gem 'nanoc-tilt'
12
+ end
13
+ ```
21
14
 
22
15
  ## Usage
23
16
 
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
17
+ Call the `:tilt` filter. For example:
32
18
 
33
- ## Author
19
+ ```ruby
20
+ filter :tilt
21
+ ```
34
22
 
35
- * Jake Benilov <benilov@gmail.com>
23
+ Options passed to this filter will be passed on to the tilt filter. For example:
36
24
 
37
- ## License
25
+ ```ruby
26
+ filter :tilt, args: { escape: true }
27
+ ```
38
28
 
39
- Copyright (c) 2011 Jake Benilov, nanoc-tilt is released under the MIT license.
40
- See the LICENSE.md file for details.
29
+ ```ruby
30
+ filter :tilt, args: { escape: false }
31
+ ```
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nanoc
4
+ module Tilt
5
+ class Filter < Nanoc::Filter
6
+ identifier :tilt
7
+
8
+ # Runs the content through [Tilt](https://github.com/rtomayko/tilt).
9
+ # Parameters passed as `:args` will be passed on to Tilt.
10
+ #
11
+ # @param [String] content The content to filter
12
+ #
13
+ # @return [String] The filtered content
14
+ def run(content, params = {})
15
+ # Get options
16
+ options = params.fetch(:args, {})
17
+
18
+ # Create context
19
+ context = ::Nanoc::Core::Context.new(assigns)
20
+
21
+ # Get result
22
+ proc = assigns[:content] ? -> { assigns[:content] } : nil
23
+
24
+ # Find Tilt template class
25
+ ext = item.identifier.ext || item[:extension]
26
+ template_class = ::Tilt[ext]
27
+
28
+ # Render
29
+ template = template_class.new(options) { content }
30
+ template.render(context, assigns, &proc)
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nanoc
4
+ module Tilt
5
+ VERSION = '1.0.0'
6
+ end
7
+ end
data/lib/nanoc/tilt.rb ADDED
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nanoc
4
+ module Tilt
5
+ end
6
+ end
7
+
8
+ require 'tilt'
9
+
10
+ require 'nanoc/tilt/version'
11
+ require 'nanoc/tilt/filter'
data/lib/nanoc-tilt.rb CHANGED
@@ -1,29 +1,3 @@
1
- require "nanoc-tilt/version"
2
- require 'tempfile'
3
- require 'nanoc3'
1
+ # frozen_string_literal: true
4
2
 
5
- module Nanoc3::Filters
6
- class TiltFilter < Nanoc3::Filter
7
- identifier :tilt
8
- type :text
9
-
10
- def run(content, params={})
11
- require 'tilt'
12
-
13
- # Create context
14
- context = ::Nanoc3::Context.new(assigns)
15
-
16
- # Get result
17
- proc = content ? lambda { content } : nil
18
- Tilt.new(path_to_tiltable_file_for(content)).render(context, assigns, &proc)
19
- end
20
-
21
- protected
22
- def path_to_tiltable_file_for(content)
23
- tempfile = Tempfile.new(["tilt", "." + @item[:extension]])
24
- tempfile << content
25
- tempfile.close
26
- tempfile.path
27
- end
28
- end
29
- end
3
+ require 'nanoc/tilt'
metadata CHANGED
@@ -1,80 +1,83 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nanoc-tilt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
5
- prerelease:
4
+ version: 1.0.0
6
5
  platform: ruby
7
6
  authors:
8
- - Jake Benilov
9
- autorequire:
7
+ - Denis Defreyne
8
+ autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2011-06-26 00:00:00.000000000Z
11
+ date: 2022-10-29 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
- name: nanoc3
16
- requirement: &2156346780 !ruby/object:Gem::Requirement
17
- none: false
14
+ name: nanoc-core
15
+ requirement: !ruby/object:Gem::Requirement
18
16
  requirements:
19
- - - ! '>='
17
+ - - "~>"
20
18
  - !ruby/object:Gem::Version
21
- version: '0'
19
+ version: '4.11'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 4.11.14
22
23
  type: :runtime
23
24
  prerelease: false
24
- version_requirements: *2156346780
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '4.11'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 4.11.14
25
33
  - !ruby/object:Gem::Dependency
26
34
  name: tilt
27
- requirement: &2156346360 !ruby/object:Gem::Requirement
28
- none: false
35
+ requirement: !ruby/object:Gem::Requirement
29
36
  requirements:
30
- - - ! '>='
37
+ - - "~>"
31
38
  - !ruby/object:Gem::Version
32
- version: '0'
39
+ version: '2.0'
33
40
  type: :runtime
34
41
  prerelease: false
35
- version_requirements: *2156346360
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
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '2.0'
47
+ description: Provides a :tilt filter for Nanoc
48
+ email: denis+rubygems@denis.ws
41
49
  executables: []
42
50
  extensions: []
43
51
  extra_rdoc_files: []
44
52
  files:
45
- - .gitignore
46
- - .rvmrc
47
- - Gemfile
48
- - Gemfile.lock
49
- - LICENSE.md
53
+ - NEWS.md
50
54
  - README.md
51
- - Rakefile
52
55
  - 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:
56
+ - lib/nanoc/tilt.rb
57
+ - lib/nanoc/tilt/filter.rb
58
+ - lib/nanoc/tilt/version.rb
59
+ homepage: https://nanoc.ws/
60
+ licenses:
61
+ - MIT
62
+ metadata:
63
+ rubygems_mfa_required: 'true'
64
+ post_install_message:
58
65
  rdoc_options: []
59
66
  require_paths:
60
67
  - lib
61
68
  required_ruby_version: !ruby/object:Gem::Requirement
62
- none: false
63
69
  requirements:
64
- - - ! '>='
70
+ - - ">="
65
71
  - !ruby/object:Gem::Version
66
- version: '0'
72
+ version: '2.7'
67
73
  required_rubygems_version: !ruby/object:Gem::Requirement
68
- none: false
69
74
  requirements:
70
- - - ! '>='
75
+ - - ">="
71
76
  - !ruby/object:Gem::Version
72
77
  version: '0'
73
78
  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)
79
+ rubygems_version: 3.3.24
80
+ signing_key:
81
+ specification_version: 4
82
+ summary: Tilt filter for Nanoc
80
83
  test_files: []
data/.gitignore DELETED
@@ -1,3 +0,0 @@
1
- *.gem
2
- .bundle
3
- pkg/*
data/.rvmrc DELETED
@@ -1 +0,0 @@
1
- rvm 1.9.2@nanoc-tilt --create
data/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source "http://rubygems.org"
2
-
3
- # Specify your gem's dependencies in nanoc-tilt.gemspec
4
- gemspec
data/Gemfile.lock DELETED
@@ -1,22 +0,0 @@
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 DELETED
@@ -1,24 +0,0 @@
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/Rakefile DELETED
@@ -1 +0,0 @@
1
- require 'bundler/gem_tasks'
@@ -1,5 +0,0 @@
1
- module Nanoc
2
- module Tilt
3
- VERSION = "0.1.1"
4
- end
5
- end
data/nanoc-tilt.gemspec DELETED
@@ -1,23 +0,0 @@
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 "nanoc3"
22
- s.add_dependency "tilt"
23
- end