Skip to content

Commit

Permalink
Merge pull request #291 from jch/update-dependencies
Browse files Browse the repository at this point in the history
Update dependencies
  • Loading branch information
gjtorikian authored Mar 14, 2018
2 parents d9a4621 + b2a204f commit a84d7fa
Show file tree
Hide file tree
Showing 46 changed files with 444 additions and 461 deletions.
6 changes: 0 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,13 @@ rvm:
- 2.4.0
- 2.3.1
- 2.2.5
- 2.1
- 2.0
- ruby-head

matrix:
fast_finish: true
allow_failures:
- rvm: ruby-head
exclude:
- gemfile: gemfiles/rails_5.gemfile
rvm: 2.1
- gemfile: gemfiles/rails_5.gemfile
rvm: 2.0
- gemfile: gemfiles/rails_4.gemfile
rvm: 2.4.0
- gemfile: gemfiles/rails_3.gemfile
Expand Down
16 changes: 8 additions & 8 deletions Appraisals
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
appraise "rails-3" do
gem "rack", "< 2"
gem "rails", "3.2.22.2"
appraise 'rails-3' do
gem 'rack', '< 2'
gem 'rails', '3.2.22.2'
end

appraise "rails-4" do
gem "rack", "< 2"
gem "rails", "~> 4.2.6"
appraise 'rails-4' do
gem 'rack', '< 2'
gem 'rails', '~> 4.2.6'
end

appraise "rails-5" do
gem "rails", "~> 5.0.0"
appraise 'rails-5' do
gem 'rails', '~> 5.0.0'
end
35 changes: 13 additions & 22 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,32 +1,23 @@
source "https://rubygems.org"
source 'https://rubygems.org'

# Specify your gem's dependencies in html-pipeline.gemspec
gemspec

group :development do
gem "bundler"
gem "rake"
gem "appraisal"
gem 'appraisal'
gem 'bundler'
gem 'rake'
end

group :test do
gem "minitest"
gem "rinku", "~> 1.7", :require => false
gem "gemoji", "~> 2.0", :require => false
gem "RedCloth", "~> 4.2.9", :require => false
gem "commonmarker", "~> 0.14", :require => false
gem "email_reply_parser", "~> 0.5", :require => false
gem "sanitize", "~> 2.0", :require => false
gem 'commonmarker', '~> 0.14', require: false
gem 'email_reply_parser', '~> 0.5', require: false
gem 'gemoji', '~> 2.0', require: false
gem 'minitest'
gem 'RedCloth', '~> 4.2.9', require: false
gem 'rinku', '~> 1.7', require: false
gem 'sanitize', '~> 2.0', require: false

if RUBY_VERSION < "2.1.0"
gem "escape_utils", "~> 0.3", :require => false
gem "github-linguist", "~> 2.6.2", :require => false
else
gem "escape_utils", "~> 1.0", :require => false
gem "github-linguist", "~> 2.10", :require => false
end

if RUBY_VERSION < "1.9.3"
gem "activesupport", ">= 2", "< 4"
end
gem 'escape_utils', '~> 1.0', require: false
gem 'rouge', '~> 3.1', require: false
end
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,12 +171,12 @@ EmojiPipeline = Pipeline.new [

Filter gem dependencies are not bundled; you must bundle the filter's gem
dependencies. The below list details filters with dependencies. For example,
`SyntaxHighlightFilter` uses [github-linguist](https://github.com/github/linguist)
`SyntaxHighlightFilter` uses [rouge](https://github.com/jneen/rouge)
to detect and highlight languages. For example, to use the `SyntaxHighlightFilter`,
add the following to your Gemfile:

```ruby
gem 'github-linguist'
gem 'rouge'
```

* `AutolinkFilter` - `rinku`
Expand All @@ -185,7 +185,7 @@ gem 'github-linguist'
* `MarkdownFilter` - `commonmarker`
* `PlainTextInputFilter` - `escape_utils`
* `SanitizationFilter` - `sanitize`
* `SyntaxHighlightFilter` - `github-linguist`
* `SyntaxHighlightFilter` - `rouge`
* `TextileFilter` - `RedCloth`

_Note:_ See [Gemfile](/Gemfile) `:test` block for version requirements.
Expand Down Expand Up @@ -242,7 +242,6 @@ Here are some extensions people have built:
* [tilt-html-pipeline](https://github.com/bradgessler/tilt-html-pipeline)
* [html-pipeline-wiki-link'](https://github.com/lifted-studios/html-pipeline-wiki-link) - WikiMedia-style wiki links
* [task_list](https://github.com/github/task_list) - GitHub flavor Markdown Task List
* [html-pipeline-rouge_filter](https://github.com/JuanitoFatas/html-pipeline-rouge_filter) - Syntax highlight with [Rouge](https://github.com/jneen/rouge/)
* [html-pipeline-nico_link](https://github.com/rutan/html-pipeline-nico_link) - An HTML::Pipeline filter for [niconico](http://www.nicovideo.jp) description links
* [html-pipeline-gitlab](https://gitlab.com/gitlab-org/html-pipeline-gitlab) - This gem implements various filters for html-pipeline used by GitLab
* [html-pipeline-youtube](https://github.com/st0012/html-pipeline-youtube) - An HTML::Pipeline filter for YouTube links
Expand Down
10 changes: 5 additions & 5 deletions Rakefile
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#!/usr/bin/env rake
require "rubygems"
require "bundler/setup"
require 'rubygems'
require 'bundler/setup'

require "bundler/gem_tasks"
require 'bundler/gem_tasks'
require 'rake/testtask'

Rake::TestTask.new do |t|
t.libs << "test"
t.libs << 'test'
t.test_files = FileList['test/**/*_test.rb']
t.verbose = true
end

task :default => :test
task default: :test
30 changes: 15 additions & 15 deletions bin/html-pipeline
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@ require 'html/pipeline'
require 'optparse'

# Accept "help", too
ARGV.map!{|a| a == "help" ? "--help" : a }
.map! { |a| a == 'help' ? '--help' : a }

OptionParser.new do |opts|
onParser.new do |opts|
opts.banner = <<-HELP.gsub(/^ /, '')
Usage: html-pipeline [-h] [-f]
html-pipeline [FILTER [FILTER [...]]] < file.md
cat file.md | html-pipeline [FILTER [FILTER [...]]]
cat file.md | html-pipeline [FILTER [FILTER [...]]]
HELP

opts.separator "Options:"
opts.separator 'Options:'

opts.on("-f", "--filters", "List the available filters") do
filters = HTML::Pipeline.constants.grep(/\w+Filter$/).
map{|f| f.to_s.gsub(/Filter$/,'') }
opts.on('-f', '--filters', 'List the available filters') do
filters = HTML::Pipeline.constants.grep(/\w+Filter$/)
.map { |f| f.to_s.gsub(/Filter$/, '') }

# Text filter doesn't work, no call method
filters -= ["Text"]
filters -= ['Text']

abort <<-HELP.gsub(/^ /, '')
Available filters:
Expand All @@ -38,12 +38,12 @@ if ARGV.empty?
HTML::Pipeline::ImageMaxWidthFilter,
HTML::Pipeline::EmojiFilter,
HTML::Pipeline::AutolinkFilter,
HTML::Pipeline::TableOfContentsFilter,
HTML::Pipeline::TableOfContentsFilter
]

# Add syntax highlighting if linguist is present
# Add syntax highlighting if rouge is present
begin
require 'linguist'
require 'rouge'
filters << HTML::Pipeline::SyntaxHighlightFilter
rescue LoadError
end
Expand All @@ -52,7 +52,7 @@ else

def filter_named(name)
case name
when "Text"
when 'Text'
raise NameError # Text filter doesn't work, no call method
end

Expand All @@ -70,9 +70,9 @@ else
end

context = {
:asset_root => "/assets",
:base_url => "/",
:gfm => true
asset_root: '/assets',
base_url: '/',
gfm: true
}

puts HTML::Pipeline.new(filters, context).call(ARGF.read)[:output]
2 changes: 1 addition & 1 deletion gemfiles/rails_3.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ group :test do
gem "email_reply_parser", "~> 0.5", :require => false
gem "sanitize", "~> 2.0", :require => false
gem "escape_utils", "~> 1.0", :require => false
gem "github-linguist", "~> 2.10", :require => false
gem "rouge", "~> 3.1", :require => false
end

gemspec :path => "../"
2 changes: 1 addition & 1 deletion gemfiles/rails_4.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ group :test do
gem "email_reply_parser", "~> 0.5", :require => false
gem "sanitize", "~> 2.0", :require => false
gem "escape_utils", "~> 1.0", :require => false
gem "github-linguist", "~> 2.10", :require => false
gem "rouge", "~> 3.1", :require => false
end

gemspec :path => "../"
2 changes: 1 addition & 1 deletion gemfiles/rails_5.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ group :test do
gem "email_reply_parser", "~> 0.5", :require => false
gem "sanitize", "~> 2.0", :require => false
gem "escape_utils", "~> 1.0", :require => false
gem "github-linguist", "~> 2.10", :require => false
gem "rouge", "~> 3.1", :require => false
end

gemspec :path => "../"
26 changes: 13 additions & 13 deletions html-pipeline.gemspec
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
# -*- encoding: utf-8 -*-
require File.expand_path("../lib/html/pipeline/version", __FILE__)

require File.expand_path('../lib/html/pipeline/version', __FILE__)

Gem::Specification.new do |gem|
gem.name = "html-pipeline"
gem.name = 'html-pipeline'
gem.version = HTML::Pipeline::VERSION
gem.license = "MIT"
gem.authors = ["Ryan Tomayko", "Jerry Cheung"]
gem.email = ["[email protected]", "[email protected]"]
gem.description = %q{GitHub HTML processing filters and utilities}
gem.summary = %q{Helpers for processing content through a chain of filters}
gem.homepage = "https://github.com/jch/html-pipeline"
gem.license = 'MIT'
gem.authors = ['Ryan Tomayko', 'Jerry Cheung']
gem.email = ['[email protected]', '[email protected]']
gem.description = 'GitHub HTML processing filters and utilities'
gem.summary = 'Helpers for processing content through a chain of filters'
gem.homepage = 'https://github.com/jch/html-pipeline'

gem.files = `git ls-files -z`.split("\x0").reject { |f| f =~ %r(^(test|gemfiles|script)/) }
gem.require_paths = ["lib"]
gem.files = `git ls-files -z`.split("\x0").reject { |f| f =~ %r{^(test|gemfiles|script)/} }
gem.require_paths = ['lib']

gem.add_dependency "nokogiri", ">= 1.4"
gem.add_dependency "activesupport", ">= 2"
gem.add_dependency 'activesupport', '>= 2'
gem.add_dependency 'nokogiri', '>= 1.4'

gem.post_install_message = <<msg
-------------------------------------------------
Expand Down
30 changes: 15 additions & 15 deletions lib/html/pipeline.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
require "nokogiri"
require "active_support/xml_mini/nokogiri" # convert Documents to hashes
require 'nokogiri'
require 'active_support/xml_mini/nokogiri' # convert Documents to hashes

module HTML
# GitHub HTML processing filters and utilities. This module includes a small
Expand Down Expand Up @@ -43,12 +43,12 @@ class Pipeline
autoload :TableOfContentsFilter, 'html/pipeline/toc_filter'
autoload :TextFilter, 'html/pipeline/text_filter'

class MissingDependencyError < LoadError; end
class MissingDependencyError < RuntimeError; end
def self.require_dependency(name, requirer)
require name
rescue LoadError => e
raise MissingDependencyError,
"Missing dependency '#{name}' for #{requirer}. See README.md for details.\n#{e.class.name}: #{e}"
"Missing dependency '#{name}' for #{requirer}. See README.md for details.\n#{e.class.name}: #{e}"
end

# Our DOM implementation.
Expand Down Expand Up @@ -85,7 +85,7 @@ class << self
end

def initialize(filters, default_context = {}, result_class = nil)
raise ArgumentError, "default_context cannot be nil" if default_context.nil?
raise ArgumentError, 'default_context cannot be nil' if default_context.nil?
@filters = filters.flatten.freeze
@default_context = default_context.freeze
@result_class = result_class || Hash
Expand All @@ -108,9 +108,9 @@ def call(html, context = {}, result = nil)
context = @default_context.merge(context)
context = context.freeze
result ||= @result_class.new
payload = default_payload :filters => @filters.map(&:name),
:context => context, :result => result
instrument "call_pipeline.html_pipeline", payload do
payload = default_payload filters: @filters.map(&:name),
context: context, result: result
instrument 'call_pipeline.html_pipeline', payload do
result[:output] =
@filters.inject(html) do |doc, filter|
perform_filter(filter, doc, context, result)
Expand All @@ -125,9 +125,9 @@ def call(html, context = {}, result = nil)
#
# Returns the result of the filter.
def perform_filter(filter, doc, context, result)
payload = default_payload :filter => filter.name,
:context => context, :result => result
instrument "call_filter.html_pipeline", payload do
payload = default_payload filter: filter.name,
context: context, result: result
instrument 'call_filter.html_pipeline', payload do
filter.call(doc, context, result)
end
end
Expand Down Expand Up @@ -178,13 +178,13 @@ def instrument(event, payload = nil)
#
# Returns a Hash.
def default_payload(payload = {})
{:pipeline => instrumentation_name}.merge(payload)
{ pipeline: instrumentation_name }.merge(payload)
end
end
end

# XXX nokogiri monkey patches for 1.8
if not ''.respond_to?(:force_encoding)
unless ''.respond_to?(:force_encoding)
class Nokogiri::XML::Node
# Work around an issue with utf-8 encoded data being erroneously converted to
# ... some other shit when replacing text nodes. See 'utf-8 output 2' in
Expand All @@ -196,8 +196,8 @@ def replace_with_encoding_fix(replacement)
replace_without_encoding_fix(replacement)
end

alias_method :replace_without_encoding_fix, :replace
alias_method :replace, :replace_with_encoding_fix
alias replace_without_encoding_fix replace
alias replace replace_with_encoding_fix

def swap(replacement)
replace(replacement)
Expand Down
Loading

0 comments on commit a84d7fa

Please sign in to comment.