octopress-render-tag 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9aa9842657c88e4874e5fb77e459eb2c3ec71ffe
4
- data.tar.gz: 7836131fe925b864564e7e9608738f158fd0bd0e
3
+ metadata.gz: 23ec46e74b6b488da291b6527f9f5cafd0fb6414
4
+ data.tar.gz: 129eaae81207ec96343cf4465951784e1349a4aa
5
5
  SHA512:
6
- metadata.gz: c4da2d15ef77ec5958f007a27a3769e37a2d4994c1c128c0b3e5632c7aa8a0c6e72827110e75609d1f4915c60abb64a7d607e6dd8c9caf282dd4c138421b1e66
7
- data.tar.gz: 62582ceb255164560c9268395d40956e8b284351e70421bd94ab094e1b01b2453b25811ce6a2796c594312e7eb5e2e18cba1db24ff67e01b216b8f744defa34a
6
+ metadata.gz: 64d0030f1d7993775908f935b77d9deade5ea1e5ccafb1fa62ed855dbdf122b63b061d5cc3006e8ef5479965b677104dc33b5630cadc71fd0b14291573a4b53c
7
+ data.tar.gz: 2300fe9149a460a2ddb0eb34e4187f563afb991c777824012a9d9c58ece8953d10a4b7f9566033a3a10b4fa48b373676018b1d716de7e436f8b8dcbefd7d95d4
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ### 1.0.3 - 2014-07-27
4
+
5
+ - No longer requires Jekyll page hooks.
6
+ - Triggers Octopress hooks if present.
7
+
3
8
  ### 1.0.2 - 2014-07-16
4
9
 
5
10
  - Added Octopress Ink plugin
@@ -0,0 +1,47 @@
1
+ # Add support for Octopress hooks
2
+ #
3
+ module Octopress
4
+
5
+ # Create a new page class to allow partials to trigger Octopress Hooks.
6
+ #
7
+ class Partial
8
+ include Jekyll::Convertible
9
+
10
+ attr_accessor :name, :content, :site, :ext, :output, :data
11
+
12
+ def initialize(site, name, content)
13
+ @site = site
14
+ @name = name
15
+ @ext = File.extname(name)
16
+ @content = content
17
+ @data = { layout: nil } # hack
18
+
19
+ end
20
+
21
+ def render(payload)
22
+ pre_render
23
+ do_layout(payload, { no_layout: nil })
24
+ post_render
25
+ end
26
+
27
+ def hooks
28
+ if self.site.respond_to? :page_hooks
29
+ self.site.page_hooks
30
+ else
31
+ []
32
+ end
33
+ end
34
+
35
+ def pre_render
36
+ self.hooks.each do |hook|
37
+ hook.pre_render(self)
38
+ end
39
+ end
40
+
41
+ def post_render
42
+ self.hooks.each do |hook|
43
+ hook.post_render(self)
44
+ end
45
+ end
46
+ end
47
+ end
@@ -1,7 +1,7 @@
1
1
  module Octopress
2
2
  module Tags
3
3
  module RenderTag
4
- VERSION = "1.0.2"
4
+ VERSION = "1.0.3"
5
5
  end
6
6
  end
7
7
  end
@@ -1,7 +1,7 @@
1
1
  require "octopress-render-tag/version"
2
2
  require "octopress-tag-helpers"
3
3
  require "octopress-render-tag/ink-plugin"
4
- require "jekyll-page-hooks"
4
+ require "octopress-render-tag/hooks"
5
5
  require "jekyll"
6
6
 
7
7
  module Octopress
@@ -51,9 +51,7 @@ module Octopress
51
51
 
52
52
  content = replace_raw(content)
53
53
 
54
- if defined?(Jekyll::ConvertiblePartial)
55
- content = parse_convertible(content, context).strip
56
- end
54
+ content = parse_convertible(content, context).strip
57
55
 
58
56
  unless content.nil? || filters.nil?
59
57
  content = TagHelpers::Var.render_filters(content, filters, context)
@@ -88,7 +86,7 @@ module Octopress
88
86
  end
89
87
 
90
88
  def parse_convertible(content, context)
91
- page = Jekyll::ConvertiblePartial.new(context.registers[:site], @path, content)
89
+ page = Octopress::Partial.new(context.registers[:site], @path, content)
92
90
  page.render({})
93
91
  page.output.strip
94
92
  end
@@ -19,7 +19,6 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ["lib"]
20
20
 
21
21
  spec.add_runtime_dependency "octopress-tag-helpers", "~> 1.0"
22
- spec.add_runtime_dependency "jekyll-page-hooks", "~> 1.0"
23
22
  spec.add_runtime_dependency "jekyll", "~> 2.0"
24
23
 
25
24
  spec.add_development_dependency "clash"
data/test/.clash.yml CHANGED
@@ -1,2 +1,2 @@
1
1
  build: true
2
- compare: "_site, _expected"
2
+ compare: "_expected, _site"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: octopress-render-tag
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandon Mathis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-16 00:00:00.000000000 Z
11
+ date: 2014-07-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: octopress-tag-helpers
@@ -24,20 +24,6 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.0'
27
- - !ruby/object:Gem::Dependency
28
- name: jekyll-page-hooks
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '1.0'
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '1.0'
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: jekyll
43
29
  requirement: !ruby/object:Gem::Requirement
@@ -125,6 +111,7 @@ files:
125
111
  - assets/docs/changelog.markdown
126
112
  - assets/docs/index.markdown
127
113
  - lib/octopress-render-tag.rb
114
+ - lib/octopress-render-tag/hooks.rb
128
115
  - lib/octopress-render-tag/ink-plugin.rb
129
116
  - lib/octopress-render-tag/version.rb
130
117
  - octopress-render-tag.gemspec