html-pipeline 1.5.0 → 1.6.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/CHANGELOG.md +6 -0
- data/Gemfile +7 -6
- data/README.md +3 -1
- data/lib/html/pipeline/camo_filter.rb +2 -3
- data/lib/html/pipeline/email_reply_filter.rb +6 -0
- data/lib/html/pipeline/version.rb +1 -1
- data/test/html/pipeline/camo_filter_test.rb +6 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b0bdbb5edcf3fe65badad9351ff3d8a09fe2e12b
|
4
|
+
data.tar.gz: 159fcac5e236a176e81fa14f267810cc2a61d6aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ada148d84bdec400671449581e17e0fbe7df5899cbc12827a8550f8404c17fec4bc1e52b3d9d912933fe0ab6c2d6e7de4082e8d0b133c8e27293932a1fc0f21
|
7
|
+
data.tar.gz: 0660e087d3b251ed047a27e847fb6147ef6a59b0ee773996c9f69c6fba2fc3be4f9b0e4846b61f1141981e7bed20ba47b5b371cd6bb86699f234972bab2cbe63
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
+
## 1.6.0
|
4
|
+
|
5
|
+
* Doc update for syntax highlighting #108 simeonwillbanks
|
6
|
+
* Add missing dependency for EmailReplyFilter #110 foca
|
7
|
+
* Fix deprecation warning for Digest::Digest #103 chrishunt
|
8
|
+
|
3
9
|
## 1.5.0
|
4
10
|
|
5
11
|
* More flexible whitelist configuration for SanitizationFilter #98 aroben
|
data/Gemfile
CHANGED
@@ -9,12 +9,13 @@ group :development do
|
|
9
9
|
end
|
10
10
|
|
11
11
|
group :test do
|
12
|
-
gem "rinku",
|
13
|
-
gem "gemoji",
|
14
|
-
gem "RedCloth",
|
15
|
-
gem "escape_utils",
|
16
|
-
gem "github-linguist",
|
17
|
-
gem "github-markdown",
|
12
|
+
gem "rinku", "~> 1.7", :require => false
|
13
|
+
gem "gemoji", "~> 1.0", :require => false
|
14
|
+
gem "RedCloth", "~> 4.2.9", :require => false
|
15
|
+
gem "escape_utils", "~> 0.3", :require => false
|
16
|
+
gem "github-linguist", "~> 2.6.2", :require => false
|
17
|
+
gem "github-markdown", "~> 0.5", :require => false
|
18
|
+
gem "email_reply_parser", "~> 0.5", :require => false
|
18
19
|
|
19
20
|
if RUBY_VERSION < "1.9.2"
|
20
21
|
gem "sanitize", ">= 2", "< 2.0.4", :require => false
|
data/README.md
CHANGED
@@ -71,6 +71,8 @@ Prints:
|
|
71
71
|
</div>
|
72
72
|
```
|
73
73
|
|
74
|
+
To generate CSS for HTML formatted code, use the [pygments.rb](https://github.com/tmm1/pygments.rb#usage) `#css` method. `pygments.rb` is a dependency of the `SyntaxHighlightFilter`.
|
75
|
+
|
74
76
|
Some filters take an optional **context** and/or **result** hash. These are
|
75
77
|
used to pass around arguments and metadata between filters in a pipeline. For
|
76
78
|
example, if you want don't want to use GitHub formatted Markdown, you can
|
@@ -111,7 +113,7 @@ gem 'github-linguist'
|
|
111
113
|
```
|
112
114
|
|
113
115
|
* `AutolinkFilter` - `rinku`
|
114
|
-
* `EmailReplyFilter` - `escape_utils`
|
116
|
+
* `EmailReplyFilter` - `escape_utils`, `email_reply_parser`
|
115
117
|
* `EmojiFilter` - `gemoji`
|
116
118
|
* `MarkdownFilter` - `github-markdown`
|
117
119
|
* `PlainTextInputFilter` - `escape_utils`
|
@@ -22,7 +22,7 @@ module HTML
|
|
22
22
|
# Hijacks images in the markup provided, replacing them with URLs that
|
23
23
|
# go through the github asset proxy.
|
24
24
|
def call
|
25
|
-
return unless asset_proxy_enabled?
|
25
|
+
return doc unless asset_proxy_enabled?
|
26
26
|
|
27
27
|
doc.search("img").each do |element|
|
28
28
|
original_src = element['src']
|
@@ -56,8 +56,7 @@ module HTML
|
|
56
56
|
|
57
57
|
# Private: calculate the HMAC digest for a image source URL.
|
58
58
|
def asset_url_hash(url)
|
59
|
-
|
60
|
-
OpenSSL::HMAC.hexdigest(digest, asset_proxy_secret_key, url)
|
59
|
+
OpenSSL::HMAC.hexdigest('sha1', asset_proxy_secret_key, url)
|
61
60
|
end
|
62
61
|
|
63
62
|
# Private: Return true if asset proxy filter should be enabled
|
@@ -4,6 +4,12 @@ rescue LoadError => _
|
|
4
4
|
abort "Missing dependency 'escape_utils' for EmailReplyFilter. See README.md for details."
|
5
5
|
end
|
6
6
|
|
7
|
+
begin
|
8
|
+
require "email_reply_parser"
|
9
|
+
rescue LoadError => _
|
10
|
+
abort "Missing dependency 'email_reply_parser' for EmailReplyFilter. See README.md for details."
|
11
|
+
end
|
12
|
+
|
7
13
|
module HTML
|
8
14
|
class Pipeline
|
9
15
|
# HTML Filter that converts email reply text into an HTML DocumentFragment.
|
@@ -13,6 +13,12 @@ class HTML::Pipeline::CamoFilterTest < Test::Unit::TestCase
|
|
13
13
|
}
|
14
14
|
end
|
15
15
|
|
16
|
+
def test_asset_proxy_disabled
|
17
|
+
orig = %(<p><img src="http://twitter.com/img.png"></p>)
|
18
|
+
assert_equal orig,
|
19
|
+
CamoFilter.call(orig, @options.merge(:disable_asset_proxy => true)).to_s
|
20
|
+
end
|
21
|
+
|
16
22
|
def test_camouflaging_http_image_urls
|
17
23
|
orig = %(<p><img src="http://twitter.com/img.png"></p>)
|
18
24
|
assert_equal %(<p><img src="https//assets.example.org/a5ad43494e343b20d745586282be61ff530e6fa0/687474703a2f2f747769747465722e636f6d2f696d672e706e67" data-canonical-src="http://twitter.com/img.png"></p>),
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: html-pipeline
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Tomayko
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-02-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|