octopress-escape-code 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/{test/.clash.yml → .clash.yml} +0 -0
- data/.travis.yml +1 -1
- data/CHANGELOG.md +7 -0
- data/README.md +7 -8
- data/lib/octopress-escape-code.rb +21 -12
- data/lib/octopress-escape-code/version.rb +1 -1
- data/octopress-escape-code.gemspec +1 -1
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ca16dcac0c8038eb9a7068e2b706beb0edea8cf8
|
4
|
+
data.tar.gz: 47d6aaa2db951aba700a7acfbef0c3aa2ba72747
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 831d88825c3f4a385b61236dc7bb35e6be6e7359b72ee102b0d9d04ead5caabd04acf911706be86dfeba1da65e2107a0946e7cd767238ab6244d06d8be548fd3
|
7
|
+
data.tar.gz: 1aae49f38d24565cb301408eecf21fb3b894824f774009dc23bfde04438ba2842940d0e156aaea57cddcd276524ed9f55abb55a1dc55e0c512667873aa898ee7
|
File without changes
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
ADDED
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
|
-
|
5
|
-
|
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
|
[](https://travis-ci.org/octopress/escape-code)
|
8
8
|
[](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
|
42
|
+
[Octopress codeblock](https://github.com/octopress/codeblock) plugin.
|
43
43
|
|
44
|
-
Some Markdown processors and the [Octopress codefence](https://github.com/octopress/
|
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
|
-
|
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,
|
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 '
|
2
|
+
require 'octopress-hooks'
|
3
3
|
|
4
|
-
module
|
5
|
-
|
6
|
-
|
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")
|
@@ -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 '
|
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.
|
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-
|
11
|
+
date: 2014-09-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: octopress-hooks
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
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: '
|
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.
|
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
|