content-pipeline 2.0.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/content/pipeline/filters/code.rb +3 -11
- data/lib/content/pipeline/jekyll/converter.rb +17 -6
- data/lib/content/pipeline/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7cc955251ccebda8cb55d407827e8480ef62fa94
|
4
|
+
data.tar.gz: d061059ea9cfd251683788d54c8321aeddfd2304
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f99b023472d5e1d863a676f474148c97050d9590e4f667cf3738527f7a2080b932946ffaea72594a75938fce50e56ac76519773dc30253eb280abebe0162e92
|
7
|
+
data.tar.gz: 6873fe16ffc936e5eb9d185c496fdbe753b653076c15760492e53fa44cb905e5a5bb05656be845eb78174ebfbf23f2c66fb080554ce827522c03b57482195cad
|
@@ -9,17 +9,9 @@ class Content::Pipeline::Filters::Code < Content::Pipeline::Filter
|
|
9
9
|
|
10
10
|
Matcher = /<pre>(.+)<\/pre>/m
|
11
11
|
Templates = {
|
12
|
-
:
|
12
|
+
:wrap => '<figure class="highlight"><pre><code class="%s language-%s" ' \
|
13
|
+
'data-programming-language="%s">%s</code></pre></figure>',
|
13
14
|
:line => '<span class="line">%s</span>',
|
14
|
-
:wrap => <<-HTML,
|
15
|
-
<figure class="highlight">
|
16
|
-
<pre>
|
17
|
-
<code class="%s">
|
18
|
-
%s
|
19
|
-
</code>
|
20
|
-
</pre>
|
21
|
-
</figure>
|
22
|
-
HTML
|
23
15
|
}
|
24
16
|
|
25
17
|
def initialize(*args)
|
@@ -37,7 +29,7 @@ class Content::Pipeline::Filters::Code < Content::Pipeline::Filter
|
|
37
29
|
|
38
30
|
node.parent.replace(
|
39
31
|
Templates[:wrap] % [
|
40
|
-
lang, pygments(node.inner_text, lang)
|
32
|
+
lang, lang, lang, pygments(node.inner_text, lang)
|
41
33
|
]
|
42
34
|
)
|
43
35
|
end
|
@@ -2,18 +2,29 @@ require "content/pipeline"
|
|
2
2
|
|
3
3
|
module Content::Pipeline::Jekyll
|
4
4
|
class Converter < Jekyll::Converter
|
5
|
-
|
5
|
+
require "content/pipeline/filters/https"
|
6
|
+
require "content/pipeline/filters/gemoji"
|
7
|
+
require "content/pipeline/filters/code"
|
8
|
+
|
9
|
+
ContentPipeline = Content::Pipeline.new([
|
10
|
+
Content::Pipeline::Filters::Https,
|
11
|
+
Content::Pipeline::Filters::Markdown,
|
12
|
+
Content::Pipeline::Filters::Code
|
13
|
+
])
|
14
|
+
|
15
|
+
def convert(data)
|
16
|
+
return ContentPipeline.filter(
|
17
|
+
data
|
18
|
+
)
|
19
|
+
end
|
6
20
|
|
7
21
|
def matches(ext)
|
8
|
-
ext =~
|
22
|
+
ext =~ \
|
23
|
+
/\.(md|markdown)\Z/
|
9
24
|
end
|
10
25
|
|
11
26
|
def output_ext(ext)
|
12
27
|
".html"
|
13
28
|
end
|
14
|
-
|
15
|
-
def convert(data)
|
16
|
-
ContentPipeline.filter(data)
|
17
|
-
end
|
18
29
|
end
|
19
30
|
end
|