octopress-escape-code 2.0.1 → 2.0.3
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/CHANGELOG.md +7 -0
- data/lib/octopress-escape-code.rb +11 -19
- data/lib/octopress-escape-code/version.rb +1 -1
- data/test/_expected/markdown-table.html +4 -0
- data/test/markdown-table.md +7 -0
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 87a16d06eb93d1e274beca0a08c799255a344e3b
|
4
|
+
data.tar.gz: ffd7f742d28c93af2d9f8a68abee0308902dfabd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c5f7b1f1d8968fc701298e75000a649e19904a97dde8c759e7de8ce41e122315e4e60696cac0ad995ffd0d19d0aa7ae85f3f69af0ee388a85d5b76e80bcb5674
|
7
|
+
data.tar.gz: 8f5d23b0124230c21f217c70d1ea019a799b849227323ad720972aba2bff3f2942866d97235e3a04cd5dc4ad5a0920df23c14bd26f34487a8f08cc6deb3d60f4
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
### 2.0.3 - 2015-01-03
|
4
|
+
- Set plugin priority to lowest, ensuring that code is escaped after all hooks.
|
5
|
+
|
6
|
+
### 2.0.2 - 2015-01-02
|
7
|
+
- Fixed issue where insignificant whitespace would break escaping.
|
8
|
+
- Simplified space and tab code block matching expressions.
|
9
|
+
|
3
10
|
### 2.0.1 - 2014-12-19
|
4
11
|
- Fixed issue where code blocks would get additional whitespace.
|
5
12
|
|
@@ -5,6 +5,8 @@ module Octopress
|
|
5
5
|
module EscapeCode
|
6
6
|
|
7
7
|
class EscapePage < Octopress::Hooks::Page
|
8
|
+
priority :lowest
|
9
|
+
|
8
10
|
def pre_render(page)
|
9
11
|
if Octopress::EscapeCode.escape_enabled?(page)
|
10
12
|
page.content = Octopress::EscapeCode.escape(page)
|
@@ -17,6 +19,8 @@ module Octopress
|
|
17
19
|
end
|
18
20
|
|
19
21
|
class EscapePost < Octopress::Hooks::Post
|
22
|
+
priority :lowest
|
23
|
+
|
20
24
|
def pre_render(page)
|
21
25
|
if Octopress::EscapeCode.escape_enabled?(page)
|
22
26
|
page.content = Octopress::EscapeCode.escape(page)
|
@@ -58,15 +62,9 @@ module Octopress
|
|
58
62
|
# Escape markdown style code blocks
|
59
63
|
if md_ext.include?(ext)
|
60
64
|
|
61
|
-
# Escape four space indented code blocks
|
62
|
-
content = content.gsub /^( {4}[^\n].+?)\n($|\S)/m do
|
63
|
-
"{% raw %}#{$1}\n{% endraw %}#{$
|
64
|
-
end
|
65
|
-
|
66
|
-
|
67
|
-
# Escape tab indented code blocks
|
68
|
-
content = content.gsub /^(\t[^\n].+?)\n($|\S)/m do
|
69
|
-
"{% raw %}#{$1}\n{% endraw %}#{$2}"
|
65
|
+
# Escape four tab or space indented code blocks
|
66
|
+
content = content.gsub /^((\t| {4})[^\n].+?)\n($|\S)/m do
|
67
|
+
"{% raw %}#{$1}\n{% endraw %}#{$3}"
|
70
68
|
end
|
71
69
|
|
72
70
|
# Escape in-line code backticks
|
@@ -79,19 +77,13 @@ module Octopress
|
|
79
77
|
"{% raw %}#{$1}{% endraw %}"
|
80
78
|
end
|
81
79
|
|
82
|
-
# Remove internal raw tags within space intented codeblocks
|
83
|
-
content = content.gsub
|
80
|
+
# Remove internal raw tags within tab or space intented codeblocks
|
81
|
+
content = content.gsub /^({% raw %})?((\t| {4})[^\n].+?)\n($|\S)/m do
|
84
82
|
c1 = $1
|
85
83
|
c2 = $2
|
84
|
+
c4 = $4
|
86
85
|
|
87
|
-
"#{c1.gsub(/{% (end)?raw %}/, '')}\n#{
|
88
|
-
end
|
89
|
-
|
90
|
-
# Remove internal raw tags within tab intented codeblocks
|
91
|
-
content = content.gsub /(\t[^\n].+?)\n($|\S)/m do
|
92
|
-
c1 = $1
|
93
|
-
c2 = $2
|
94
|
-
"#{c1.gsub(/{% (end)?raw %}/, '')}\n#{c2}"
|
86
|
+
"#{c1}#{c2.gsub(/{% (end)?raw %}/, '')}\n#{c4}"
|
95
87
|
end
|
96
88
|
end
|
97
89
|
|
@@ -0,0 +1,4 @@
|
|
1
|
+
<p>| Asset directory | Description |
|
2
|
+
|:----------------|:------------------------------------------------|
|
3
|
+
| layouts | Users can add layouts by setting <code>layout: plugin_slug:some_layout</code> in a page's YAML front-matter. |
|
4
|
+
| includes | Includes are available to users by <code>{% include plugin_slug:some_file.html %}</code>. |</p>
|
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
---
|
3
|
+
| Asset directory | Description |
|
4
|
+
|:----------------|:------------------------------------------------|
|
5
|
+
| layouts | Users can add layouts by setting `layout: plugin_slug:some_layout` in a page's YAML front-matter. |
|
6
|
+
| includes | Includes are available to users by `{% include plugin_slug:some_file.html %}`. |
|
7
|
+
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: octopress-escape-code
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.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:
|
11
|
+
date: 2015-01-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: octopress-hooks
|
@@ -116,8 +116,10 @@ files:
|
|
116
116
|
- test/_config.yml
|
117
117
|
- test/_expected/indented-codefence.html
|
118
118
|
- test/_expected/index.html
|
119
|
+
- test/_expected/markdown-table.html
|
119
120
|
- test/indented-codefence.md
|
120
121
|
- test/index.md
|
122
|
+
- test/markdown-table.md
|
121
123
|
homepage: https://github.com/octopress/escape-code
|
122
124
|
licenses:
|
123
125
|
- MIT
|
@@ -147,5 +149,7 @@ test_files:
|
|
147
149
|
- test/_config.yml
|
148
150
|
- test/_expected/indented-codefence.html
|
149
151
|
- test/_expected/index.html
|
152
|
+
- test/_expected/markdown-table.html
|
150
153
|
- test/indented-codefence.md
|
151
154
|
- test/index.md
|
155
|
+
- test/markdown-table.md
|