Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move the t alias to its own extension file #90

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions README.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,19 @@ License:: MIT

RedCloth is a Ruby library for converting Textile into HTML.

== Attention - Deprecating JRuby and Windows support in version 4.3
== Attention: **BREAKING CHANGE** RedCloth 5.x series

In order to prioritize merging a fix for the long standing vulnerability *CVE-2012-6684*, our {new maintainer}[https://github.com/joshuasiler] has elected to stop maintaining the precompiled versions for Windows and JRuby.
RedCloth 5.x series will not create the the <tt>t</tt> alias by default, but will provide an extension file if you wish to continue that behavior.

Keep in mind the long term plan is to drop this all together.

== JRuby and Windows support in version 4.3

A while ago, around the time *CVE-2012-6684* was open, the {maintainer at that time}[https://github.com/joshuasiler], has elected to stop maintaining the precompiled versions for Windows and JRuby.

But there is an ongoing effort to restore JRuby support.

If this interests you, please :+1: {Issue #44}[https://github.com/jgarber/redcloth/issues/44].

== Installing

Expand Down
11 changes: 2 additions & 9 deletions lib/redcloth.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,16 @@
require 'redcloth/formatters/latex'

module RedCloth

# A convenience method for creating a new TextileDoc. See
# RedCloth::TextileDoc.
def self.new( *args, &block )
RedCloth::TextileDoc.new( *args, &block )
end

# Include extension modules (if any) in TextileDoc.
def self.include(*args)
RedCloth::TextileDoc.send(:include, *args)
end

end

begin
require 'erb'
require 'redcloth/erb_extension'
include ERB::Util
rescue LoadError
end
15 changes: 15 additions & 0 deletions lib/redcloth/erb_alias_extension.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

require 'erb'
require 'redcloth/erb_extension'

class ERB
module Util
alias t textilize
module_function :t
end
end

begin
include ERB::Util
rescue LoadError
end
2 changes: 0 additions & 2 deletions lib/redcloth/erb_extension.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ def textilize( s )
end
end

alias t textilize
module_function :t
module_function :textilize

end
Expand Down
6 changes: 6 additions & 0 deletions redcloth.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,10 @@ Gem::Specification.new do |s|
s.add_development_dependency('rspec', '~> 3.12')
s.add_development_dependency('diff-lcs', '~> 1.5')

s.post_install_message = %q{
**BREAKING CHANGE**: RedCloth 5.x series
RedCloth 5.x series has one breaking change related to alias `t`
Please see https://github.com/jgarber/redcloth#attention-breaking-change-redcloth-5x-series-
}

end
1 change: 1 addition & 0 deletions spec/erb_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require File.dirname(__FILE__) + '/spec_helper'
require 'redcloth/erb_alias_extension'

describe "ERB helper" do
it "should add a textile tag to ERB" do
Expand Down