octopress-escape-code 2.0.3 → 2.0.4

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: 87a16d06eb93d1e274beca0a08c799255a344e3b
4
- data.tar.gz: ffd7f742d28c93af2d9f8a68abee0308902dfabd
3
+ metadata.gz: f9cd2dff39bb81d753dd1148b61c1c98e95f5ce0
4
+ data.tar.gz: 21b9bc401c836632d65a8ecbfd50037688fa6bd6
5
5
  SHA512:
6
- metadata.gz: c5f7b1f1d8968fc701298e75000a649e19904a97dde8c759e7de8ce41e122315e4e60696cac0ad995ffd0d19d0aa7ae85f3f69af0ee388a85d5b76e80bcb5674
7
- data.tar.gz: 8f5d23b0124230c21f217c70d1ea019a799b849227323ad720972aba2bff3f2942866d97235e3a04cd5dc4ad5a0920df23c14bd26f34487a8f08cc6deb3d60f4
6
+ metadata.gz: d9482fbcdb4ea1b80637abaac324444c44a1770077c88dcb8d8991a212d87e49285a38fc38175a9073f25fa8afa1c453900a15068b900a72c6fcda9915cef16b
7
+ data.tar.gz: 4447be2b8f732654a54fb96b590ae514c47cdcccfde5a3f877bf14826c22a0e24c34b570f78183f09bbb64f60e443739bacec876a1a2bb679bf0dd185a428fd9
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # Changelog
2
2
 
3
+ ### 2.0.4 - 2015-01-03
4
+ - Updated regex order to allow different nested code block types.
5
+
3
6
  ### 2.0.3 - 2015-01-03
4
7
  - Set plugin priority to lowest, ensuring that code is escaped after all hooks.
5
8
 
@@ -87,6 +87,16 @@ module Octopress
87
87
  end
88
88
  end
89
89
 
90
+ # Escape codeblock tag contents
91
+ content = content.gsub /^({%\s*codeblock.+?%})(.+?){%\s*endcodeblock\s*%}/m do
92
+ "#{$1}{% raw %}#{$2.gsub /{% (end)?raw %}/, ''}{% endraw %}{% endcodeblock %}"
93
+ end
94
+
95
+ # Escape highlight tag contents
96
+ content = content.gsub /^({%\s*highlight.+?%})(.+?){%\s*endhighlight\s*%}/m do
97
+ "#{$1}{% raw %}#{$2.gsub(/{% (end)?raw %}/, '')}{% endraw %}{% endhighlight %}"
98
+ end
99
+
90
100
  # Escape codefenced codeblocks
91
101
  content = content.gsub /^(`{3}.+?`{3})/m do
92
102
 
@@ -100,16 +110,6 @@ module Octopress
100
110
  "{% raw %}\n#{code}\n{% endraw %}"
101
111
  end
102
112
 
103
- # Escape codeblock tag contents
104
- content = content.gsub /^({%\s*codeblock.+?%})(.+?){%\s*endcodeblock\s*%}/m do
105
- "#{$1}{% raw %}#{$2.gsub /{% (end)?raw %}/, ''}{% endraw %}{% endcodeblock %}"
106
- end
107
-
108
- # Escape highlight tag contents
109
- content = content.gsub /^({%\s*highlight.+?%})(.+?){%\s*endhighlight\s*%}/m do
110
- "#{$1}{% raw %}#{$2.gsub(/{% (end)?raw %}/, '')}{% endraw %}{% endhighlight %}"
111
- end
112
-
113
113
  content
114
114
  end
115
115
  end
@@ -1,5 +1,5 @@
1
1
  module Octopress
2
2
  module EscapeCode
3
- VERSION = "2.0.3"
3
+ VERSION = "2.0.4"
4
4
  end
5
5
  end
@@ -0,0 +1,11 @@
1
+ <p>hey</p>
2
+ <div class="highlight"><pre><code class="language-ruby" data-lang="ruby"><span class="p">{</span><span class="o">%</span> <span class="n">codeblock</span> <span class="ss">lang</span><span class="p">:</span><span class="n">ruby</span> <span class="ss">title</span><span class="p">:</span><span class="s2">&quot;Check if a number is</span>
3
+ <span class="s2">prime&quot;</span> <span class="ss">mark</span><span class="p">:</span><span class="mi">3</span> <span class="sx">%}</span>
4
+ <span class="sx">class Fixnum</span>
5
+ <span class="sx"> def prime?</span>
6
+ <span class="sx"> (&#39;1&#39; * self) !~ /^1?$|^(11+?)\1+$/</span>
7
+ <span class="sx"> end</span>
8
+ <span class="sx">end</span>
9
+ <span class="sx">{% endcodeblock %}</span>
10
+ </code></pre></div>
11
+ <p>guys?</p>
@@ -0,0 +1,17 @@
1
+ ---
2
+ ---
3
+
4
+ hey
5
+
6
+ ```ruby
7
+ {% codeblock lang:ruby title:"Check if a number is
8
+ prime" mark:3 %}
9
+ class Fixnum
10
+ def prime?
11
+ ('1' * self) !~ /^1?$|^(11+?)\1+$/
12
+ end
13
+ end
14
+ {% endcodeblock %}
15
+ ```
16
+
17
+ guys?
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: octopress-escape-code
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.3
4
+ version: 2.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandon Mathis
@@ -117,9 +117,11 @@ files:
117
117
  - test/_expected/indented-codefence.html
118
118
  - test/_expected/index.html
119
119
  - test/_expected/markdown-table.html
120
+ - test/_expected/nested-codeblocks.html
120
121
  - test/indented-codefence.md
121
122
  - test/index.md
122
123
  - test/markdown-table.md
124
+ - test/nested-codeblocks.md
123
125
  homepage: https://github.com/octopress/escape-code
124
126
  licenses:
125
127
  - MIT
@@ -150,6 +152,8 @@ test_files:
150
152
  - test/_expected/indented-codefence.html
151
153
  - test/_expected/index.html
152
154
  - test/_expected/markdown-table.html
155
+ - test/_expected/nested-codeblocks.html
153
156
  - test/indented-codefence.md
154
157
  - test/index.md
155
158
  - test/markdown-table.md
159
+ - test/nested-codeblocks.md