content-pipeline 0.1.0 → 0.2.0
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/Gemfile +0 -2
- data/Readme.md +3 -0
- data/lib/content/pipeline/filters/code_highlight.rb +3 -2
- data/lib/content/pipeline/version.rb +1 -1
- metadata +32 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9483f7e3ac36d2ec6ff0c4910eebe19dfe92f98f
|
4
|
+
data.tar.gz: f4fdd75c783504c952dc7fd7ef22221cc1958694
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7240b94490a5c12ae1d73122bfd4c6558701b840489bfb499a2107f5c741ae783a369cc021179116168e1ef48eaf331e7cd9d3655a95c1329450c842285c3dac
|
7
|
+
data.tar.gz: 93cea0fa41702be77982bc347bed02727d2b436a0e2c5ca7b348e9986472cde431338948d8fd79fdb11678cd4c22c261c63d8c46313d4cc00f121cf94f704353
|
data/Gemfile
CHANGED
data/Readme.md
CHANGED
@@ -54,3 +54,6 @@ better than the other, it's done so that people can remain agnostic.*
|
|
54
54
|
### Content::Pipeline::Filters::CodeHighlight
|
55
55
|
|
56
56
|
The code highlight filter allows you to highlight code, with or without Pygments. If Pygments is supported it will require it and syntax highlight, otherwise it will simply wrap your code in the normal code style and not syntax highlight it. You will still have the line numbers, just not the fancy syntax highlight.
|
57
|
+
|
58
|
+
Options:
|
59
|
+
* `:default` - The default syntax language -- If not defined it will default to "ruby".
|
@@ -40,8 +40,8 @@ class Content::Pipeline::Filters::CodeHighlight < Content::Pipeline::Filter
|
|
40
40
|
def highlight
|
41
41
|
@str = @str.to_nokogiri_fragment
|
42
42
|
@str.search('pre').each do |node|
|
43
|
-
node
|
44
|
-
|
43
|
+
lang = node[:lang] || @opts[:default] || "ruby"
|
44
|
+
node.replace Templates[:wrap] % wrap(pygments(node.inner_text, lang), lang)
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
@@ -66,6 +66,7 @@ class Content::Pipeline::Filters::CodeHighlight < Content::Pipeline::Filter
|
|
66
66
|
private
|
67
67
|
def pygments(str, lang)
|
68
68
|
return str if jruby? || !Pygments::Lexer[lang]
|
69
|
+
# Protects you against a possible Pygments error.
|
69
70
|
Pygments::Lexer[lang].highlight(str) =~ Matcher ? $1 : str
|
70
71
|
end
|
71
72
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: content-pipeline
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jordon Bedwell
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-08-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -42,16 +42,44 @@ dependencies:
|
|
42
42
|
name: rspec-expect_error
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.0.4
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.0.4
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: envygeeks-coveralls
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
46
60
|
- !ruby/object:Gem::Version
|
47
61
|
version: 0.0.2
|
48
62
|
type: :development
|
49
63
|
prerelease: false
|
50
64
|
version_requirements: !ruby/object:Gem::Requirement
|
51
65
|
requirements:
|
52
|
-
- -
|
66
|
+
- - ~>
|
53
67
|
- !ruby/object:Gem::Version
|
54
68
|
version: 0.0.2
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: luna-rspec-formatters
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ~>
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.4.2
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ~>
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.4.2
|
55
83
|
description: A less restrictive version of html-pipeline for content.
|
56
84
|
email: envygeeks@gmail.com
|
57
85
|
executables: []
|