octopress-escape-code 1.0.0 → 1.0.1

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: 265a17b0eb6c9ba1a4cbbaa1f01a456e958b0e8d
4
- data.tar.gz: 65cbeed0d373060db77e0e08d9e81bbed0289574
3
+ metadata.gz: ca16dcac0c8038eb9a7068e2b706beb0edea8cf8
4
+ data.tar.gz: 47d6aaa2db951aba700a7acfbef0c3aa2ba72747
5
5
  SHA512:
6
- metadata.gz: 94351ffb99649c83c509be109dbef8fcb95cd18890c66ab951625746e45bacfb9826e8849b6cee5de53e4c88746fbc4f99d6f23dc50204f32a14d95057c822e8
7
- data.tar.gz: 8e608f4cd8974d0a473a2f1e4aba255913b5249ef2af06d652e429fb51956b9e22a8989d5bf801adc1baa79e27f90231335df2a260065d1e4a2c91d76b1baa84
6
+ metadata.gz: 831d88825c3f4a385b61236dc7bb35e6be6e7359b72ee102b0d9d04ead5caabd04acf911706be86dfeba1da65e2107a0946e7cd767238ab6244d06d8be548fd3
7
+ data.tar.gz: 1aae49f38d24565cb301408eecf21fb3b894824f774009dc23bfde04438ba2842940d0e156aaea57cddcd276524ed9f55abb55a1dc55e0c512667873aa898ee7
File without changes
data/.travis.yml CHANGED
@@ -2,4 +2,4 @@ language: ruby
2
2
  rvm:
3
3
  - 2.0.0
4
4
  - 1.9.3
5
- script: cd test && bundle exec clash
5
+ script: bundle exec clash test
data/CHANGELOG.md ADDED
@@ -0,0 +1,7 @@
1
+ # Changelog
2
+
3
+ ### 1.0.1
4
+ - Upgraded to octopress-hooks 2.x
5
+
6
+ ### 1.0.0
7
+ - Initial release
data/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # Octopress Escape Code
2
2
 
3
- Automatically escape code blocks so you can use liquid tags
4
- without worry having to surround them with unsightly `{% raw %}` and
5
- `{% endraw %}` tags.
3
+ Automatically escape code blocks so you can use liquid tags without worry having to surround them with unsightly
4
+ `{% raw %}` and `{% endraw %}` tags. This escapes code block created with `{% highlight %}`, `{% codeblock %}`, code fences,
5
+ Markdown indented code blocks, and in-line back tick code tags.
6
6
 
7
7
  [![Build Status](https://travis-ci.org/octopress/escape-code.svg)](https://travis-ci.org/octopress/escape-code)
8
8
  [![Gem Version](http://img.shields.io/gem/v/octopress-escape-code.svg)](https://rubygems.org/gems/octopress-escape-code)
@@ -39,9 +39,9 @@ ensuring that their contents aren't parsed by Liquid. For example, a `{% highlig
39
39
  {% endraw %}{% endhighlight %}
40
40
 
41
41
  The `{% highlight %}` block is still interpreted by Liquid, but the contents are escaped. This will also escape the
42
- [Octopress code block](https://github.com/octopress/code-block) plugin.
42
+ [Octopress codeblock](https://github.com/octopress/codeblock) plugin.
43
43
 
44
- Some Markdown processors and the [Octopress codefence](https://github.com/octopress/code-block) plugin render code blocks which are
44
+ Some Markdown processors and the [Octopress codefence](https://github.com/octopress/codefence) plugin render code blocks which are
45
45
  surrounded by three back ticks. These are also wrapped with `{% raw %}` tags.
46
46
 
47
47
  {% raw %}
@@ -71,8 +71,7 @@ This works with double back tick code tags as well.
71
71
 
72
72
  ### Disable Automatic escaping
73
73
 
74
- Adding this gem will automatically enable code escaping for your entire site. To disable code escaping for a single page, add this to the
75
- page's YAML front-matter.
74
+ To disable code escaping for a single page, add this to the page's YAML front-matter.
76
75
 
77
76
  escape_code: fasle
78
77
 
@@ -81,7 +80,7 @@ If you prefer, you can enable it on a per page basis, by turning off automatic c
81
80
  // in Jekyll's _config.yml
82
81
  escape_code: false
83
82
 
84
- Then, to enable code escaping on a single page simply add `escape_code: true` to the page's YAML front-matter.
83
+ Then, add `escape_code: true` to the page's YAML front-matter to enable code escaping for a single page.
85
84
 
86
85
 
87
86
  ## Contributing
@@ -1,9 +1,26 @@
1
1
  require "octopress-escape-code/version"
2
- require 'jekyll-page-hooks'
2
+ require 'octopress-hooks'
3
3
 
4
- module Jekyll
5
- class EscapeCode < PageHooks
6
- def pre_render(page)
4
+ module Octopress
5
+ module EscapeCode
6
+
7
+ class EscapePage < Octopress::Hooks::Page
8
+ def pre_render(page)
9
+ if Octopress::EscapeCode.escape_enabled?(page)
10
+ page.content = Octopress::EscapeCode.escape(page.content, page.ext)
11
+ end
12
+ end
13
+ end
14
+
15
+ class EscapePost < Octopress::Hooks::Post
16
+ def pre_render(page)
17
+ if Octopress::EscapeCode.escape_enabled?(page)
18
+ page.content = Octopress::EscapeCode.escape(page.content, page.ext)
19
+ end
20
+ end
21
+ end
22
+
23
+ def self.escape_enabled?(page)
7
24
  site_config = page.site.config['escape_code']
8
25
  site_config = true if site_config.nil?
9
26
 
@@ -11,16 +28,8 @@ module Jekyll
11
28
  page_config = site_config if page_config.nil?
12
29
 
13
30
  enabled = page_config
14
-
15
- if enabled
16
- page.content = Octopress::EscapeCode.escape(page.content, page.ext)
17
- end
18
31
  end
19
- end
20
- end
21
32
 
22
- module Octopress
23
- module EscapeCode
24
33
  def self.escape(content, ext)
25
34
  ext = ext.downcase
26
35
  content.encode!("UTF-8")
@@ -1,5 +1,5 @@
1
1
  module Octopress
2
2
  module EscapeCode
3
- VERSION = "1.0.0"
3
+ VERSION = "1.0.1"
4
4
  end
5
5
  end
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_runtime_dependency 'jekyll-page-hooks', '~> 1.1'
21
+ spec.add_runtime_dependency 'octopress-hooks', '~> 2.0'
22
22
 
23
23
  spec.add_development_dependency "bundler", "~> 1.6"
24
24
  spec.add_development_dependency "rake"
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: octopress-escape-code
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
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-20 00:00:00.000000000 Z
11
+ date: 2014-09-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: jekyll-page-hooks
14
+ name: octopress-hooks
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.1'
19
+ version: '2.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.1'
26
+ version: '2.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -87,8 +87,10 @@ executables: []
87
87
  extensions: []
88
88
  extra_rdoc_files: []
89
89
  files:
90
+ - ".clash.yml"
90
91
  - ".gitignore"
91
92
  - ".travis.yml"
93
+ - CHANGELOG.md
92
94
  - Gemfile
93
95
  - LICENSE.txt
94
96
  - README.md
@@ -96,7 +98,6 @@ files:
96
98
  - lib/octopress-escape-code.rb
97
99
  - lib/octopress-escape-code/version.rb
98
100
  - octopress-escape-code.gemspec
99
- - test/.clash.yml
100
101
  - test/Gemfile
101
102
  - test/_config.yml
102
103
  - test/_expected/index.html
@@ -121,12 +122,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
121
122
  version: '0'
122
123
  requirements: []
123
124
  rubyforge_project:
124
- rubygems_version: 2.2.2
125
+ rubygems_version: 2.4.1
125
126
  signing_key:
126
127
  specification_version: 4
127
128
  summary: Return tag renders a variable with some nice features
128
129
  test_files:
129
- - test/.clash.yml
130
130
  - test/Gemfile
131
131
  - test/_config.yml
132
132
  - test/_expected/index.html