Skip to content

Commit

Permalink
Remove deprecated erubis, wikicloth, and maruku templates
Browse files Browse the repository at this point in the history
These all require modifying frozen string literals, so they would
start raising deprecation warnings in Ruby 3.4.  Tilt support for
these templates has been deprecated for almost 6 months without
complaint.
  • Loading branch information
jeremyevans committed Dec 18, 2024
1 parent 1ed346e commit 5dc13d1
Show file tree
Hide file tree
Showing 18 changed files with 31 additions and 398 deletions.
12 changes: 0 additions & 12 deletions .ci.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ gem 'minitest'
gem 'babel-transpiler'
gem 'creole'
gem 'erubi'
gem 'erubis'
gem 'liquid'
gem 'livescript'
gem 'nokogiri'
Expand Down Expand Up @@ -51,10 +50,6 @@ unless RUBY_VERSION < '2.4' && RUBY_ENGINE == 'jruby'
gem 'pandoc-ruby'
end

unless RUBY_VERSION < '2.6' && RUBY_ENGINE == 'jruby'
gem 'maruku'
end

if RUBY_ENGINE == 'jruby'
gem 'haml', '< 6'
else
Expand All @@ -78,9 +73,6 @@ if RUBY_VERSION >= '3.1'
end

platform :ruby do
gem 'wikicloth'
gem 'rinku' # dependency for wikicloth for handling links

gem 'RedCloth'
gem 'commonmarker'

Expand All @@ -93,9 +85,5 @@ platform :ruby do
# a dependency on ruby-enum, which requires Ruby 2.3
# without specifying required_ruby_version
gem 'ruby-enum', '< 0.6'

# i18n is pulled in by wikicloth. This avoids errors
# on Ruby 2.0.
gem 'i18n', '<1.3'
end
end
3 changes: 1 addition & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@ jobs:
COFFEE_SCRIPT: use
steps:
- uses: actions/checkout@v4
# WikiCloth needs IDN
# Pandoc needs Pandoc
- run: sudo apt-get install -y libidn11-dev pandoc
- run: sudo apt-get install -y pandoc
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## master

* Remove deprecated erubis, wikicloth, and maruku templates (jeremyevans)
* Avoid spurious frozen string literal deprecation warning on Ruby 3.4.0-preview2+ (jeremyevans)

## 2.4.0 (2024-06-27)
Expand Down
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,12 @@ Support for these template engines is included with Tilt:
| CSV | .rcsv | csv (ruby stdlib) |
| ERB | .erb, .rhtml | erb (ruby stdlib) |
| Erubi | .erb, .rhtml, .erubi | erubi |
| Erubis | .erb, .rhtml, .erubis | erubis |
| Etanni | .ern, .etanni | none |
| Haml | .haml | haml |
| Kramdown | .markdown, .mkd, .md | kramdown |
| Liquid | .liquid | liquid |
| LiveScript | .ls | livescript (+ javascript) |
| Markaby | .mab | markaby |
| Maruku | .markdown, .mkd, .md | maruku |
| Nokogiri | .nokogiri | nokogiri |
| Pandoc | .markdown, .mkd, .md | pandoc |
| Plain | .html | none |
Expand All @@ -56,7 +54,6 @@ Support for these template engines is included with Tilt:
| Scss | .scss | sass-embedded, sassc, or sass |
| String | .str | none |
| TypeScript | .ts | typescript (+ javascript) |
| WikiCloth | .wiki, .mediawiki, .mw | wikicloth |
| Yajl | .yajl | yajl-ruby |

See [TEMPLATES.md][t] for detailed information on template engine
Expand Down Expand Up @@ -277,7 +274,7 @@ it on subsequent template invocations. Benchmarks show this yields a 5x-10x
performance increase over evaluating the Ruby source on each invocation.

Template compilation is currently supported for these template engines:
StringTemplate, ERB, Erubis, Erubi, Etanni, Haml, Nokogiri, Builder, CSV,
StringTemplate, ERB, Erubi, Etanni, Haml, Nokogiri, Builder, CSV,
Prawn, and Yajl.

LICENSE
Expand Down
67 changes: 9 additions & 58 deletions docs/TEMPLATES.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ which are guaranteed to work across all the implementations. If you wish to be
compatible with all of these template classes, you should only depend on the
cross-implementation features.

* [ERB](#erb) - Generic ERB implementation (backed by erb.rb, Erubis, or Erubi)
* [ERB](#erb) - Generic ERB implementation (backed by erb.rb or Erubi)
* [erb.rb](#erbrb) - `Tilt::ERBTemplate`
* [Erubis](#erubis) - `Tilt::ErubisTemplate`
* [Erubi](#erubi) - `Tilt::ErubiTemplate`
* [Haml](#haml) - `Tilt::HamlTemplate`
* [Liquid](#liquid) - `Tilt::LiquidTemplate`
Expand Down Expand Up @@ -44,15 +43,14 @@ implementations (depending on which are available on your system):
* Kramdown - `Tilt::KramdownTemplate`
* Pandoc - `Tilt::PandocTemplate`
* CommonMarker - `Tilt::CommonMarkerTemplate`
* Maruku - `Tilt::MarukuTemplate`

<a name='erb'></a>
ERB (`erb`, `rhtml`)
--------------------

ERB is a simple but powerful template languge for Ruby. In Tilt it's backed by
[Erubi](#erubi) (if installed on your system) or by
[Erubis](#erubis) (if installed on your system) or by [erb.rb](#erbrb) (which
[erb.rb](#erbrb) (which
is included in Ruby's standard library). This documentation applies to all three
implementations.

Expand Down Expand Up @@ -81,7 +79,7 @@ Or, use `Tilt['erb']` directly to process strings:
Omits newlines and spaces around certain lines (usually those that starts with
`<%` and ends with `%>`). There isn't a specification for how trimming in ERB
should work, so if you need more control over the whitespace, you should use
[erb.rb](#erbrb), [Erubis](#erubis), or [Erubi](#erubi) directly.
[erb.rb](#erbrb) or [Erubi](#erubi) directly.


#### `:outvar => '_erbout'`
Expand All @@ -106,8 +104,8 @@ All the documentation of [ERB](#erb) applies in addition to the following:
### Usage

The `Tilt::ERBTemplate` class is registered for all files ending in `.erb` or
`.rhtml` by default, but with a *lower* priority than ErubiTemplate and
ErubisTemplate. If you specifically want to use ERB, it's recommended to use
`.rhtml` by default, but with a *lower* priority than ErubiTemplate.
If you specifically want to use ERB, it's recommended to use
`#prefer`:

Tilt.prefer Tilt::ERBTemplate
Expand All @@ -132,53 +130,12 @@ following characters:
* [ERB documentation](https://docs.ruby-lang.org/en/master/ERB.html)


<a name='erubis'></a>
Erubis (`erb`, `rhtml`, `erubis`)
---------------------------------

[Erubis][erubis] is a fast, secure, and very extensible implementation of [ERB](#erb).

All the documentation of [ERB](#erb) applies in addition to the following:

### Usage

The `Tilt::ErubisTemplate` class is registered for all files ending in `.erb` or
`.rhtml` by default, but with a *lower* priority than `ErubiTemplate`. If you
specifically want to use Erubis, it's recommended to use `#prefer`:

Tilt.prefer Tilt::ErubisTemplate

__NOTE:__ It's suggested that your program `require 'erubis'` at load time when
using this template engine within a threaded environment.

### Options

#### `:engine_class => Erubis::Eruby`

Allows you to specify a custom engine class to use instead of the
default which is `Erubis::Eruby`.

#### `:escape_html => false`

When `true`, `Erubis::EscapedEruby` will be used as the engine class
instead of the default. All content within `<%= %>` blocks will be
automatically html escaped.

#### Other

Other options are passed to the constructor of the engine class.

### See also

* [Erubis Home][erubis]


<a name='erubi'></a>
Erubi (`erb`, `rhtml`, `erubi`)
---------------------------------

[Erubi][erubi] is a ERB implementation that uses the same algorithm as
[Erubis][erubis], but is maintained and offers numerous improvements..
[Erubi][erubi] is an ERB implementation that uses the same algorithm as
the erubis gem, but is maintained and offers numerous improvements.

All the documentation of [ERB](#erb) applies in addition to the following:

Expand All @@ -187,8 +144,6 @@ All the documentation of [ERB](#erb) applies in addition to the following:
The `Tilt::ErubiTemplate` class is registered for all files ending in `.erb` or
`.rhtml` by default, with the *highest* priority.

Tilt.prefer Tilt::ErubisTemplate

__NOTE:__ It's suggested that your program `require 'erubi'` at load time when
using this template engine within a threaded environment.

Expand Down Expand Up @@ -477,7 +432,6 @@ Markdown formatted texts are converted to HTML with one of these libraries:
* Redcarpet - `Tilt::RedcarpetTemplate`
* Kramdown - `Tilt::KramdownTemplate`
* Pandoc - `Tilt::PandocTemplate`
* Maruku - `Tilt::MarukuTemplate`
* CommonMarker - `Tilt::CommonMarkerTemplate`

### Example
Expand All @@ -501,7 +455,7 @@ To wrap a Markdown formatted document with a layout:
### Options

Every implementation of Markdown *should* support these options, but there are
some known problems with the Kramdown and Maruku engines.
some known problems with the Kramdown engine.

#### `:smartypants => true|false`

Expand All @@ -510,14 +464,12 @@ Set `true` to enable [Smarty Pants][smartypants] style punctuation replacement.
In Kramdown this option only applies to smart quotes. It will apply a
subset of Smarty Pants (e.g. `...` to ``) regardless of any option.

Maruku ignores this option and always applies smart quotes (and nothing else).

#### `:escape_html => true|false`

Set `true` disallow raw HTML in Markdown contents. HTML is converted to
literal text by escaping `<` characters.

Kramdown and Maruku don't support this option.
Kramdown doesn't support this option.

### See also

Expand Down Expand Up @@ -552,7 +504,6 @@ using this template engine within a threaded environment.

[sass]: http://sass-lang.com/ "Sass"
[coffee-script]: http://jashkenas.github.com/coffee-script/ "Coffee Script"
[erubis]: https://github.com/kwatch/erubis "Erubis"
[erubi]: https://github.com/jeremyevans/erubi "Erubi"
[haml]: http://haml.info/ "Haml"
[liquid]: http://www.liquidmarkup.org/ "Liquid"
Expand Down
3 changes: 0 additions & 3 deletions lib/tilt.rb
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,9 @@ def clear

# ERB
register_lazy :ERBTemplate, 'tilt/erb', 'erb', 'rhtml'
register_lazy :ErubisTemplate, 'tilt/erubis', 'erb', 'rhtml', 'erubis'
register_lazy :ErubiTemplate, 'tilt/erubi', 'erb', 'rhtml', 'erubi'

# Markdown
register_lazy :MarukuTemplate, 'tilt/maruku', 'markdown', 'mkd', 'md'
register_lazy :KramdownTemplate, 'tilt/kramdown', 'markdown', 'mkd', 'md'
register_lazy :RDiscountTemplate, 'tilt/rdiscount', 'markdown', 'mkd', 'md'
register_lazy :RedcarpetTemplate, 'tilt/redcarpet', 'markdown', 'mkd', 'md'
Expand Down Expand Up @@ -175,7 +173,6 @@ def clear
register_lazy :SlimTemplate, 'tilt/slim', 'slim'
register_lazy :StringTemplate, 'tilt/string', 'str'
register_lazy :TypeScriptTemplate, 'tilt/typescript', 'ts', 'tsx'
register_lazy :WikiClothTemplate, 'tilt/wikicloth', 'wiki', 'mediawiki', 'mw'
register_lazy :YajlTemplate, 'tilt/yajl', 'yajl'

# TILT3: Remove
Expand Down
51 changes: 0 additions & 51 deletions lib/tilt/erubis.rb

This file was deleted.

6 changes: 3 additions & 3 deletions lib/tilt/mapping.rb
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,14 @@ def split(file)
# the exception of the first, since that was the most preferred one.
#
# mapping = Tilt::Mapping.new
# mapping.register_lazy('Maruku::Template', 'maruku/template', 'md')
# mapping.register_lazy('Kramdown::Template', 'kramdown/template', 'md')
# mapping.register_lazy('RDiscount::Template', 'rdiscount/template', 'md')
# mapping['index.md']
# # => RDiscount::Template
#
# In the previous example we say that RDiscount has a *higher priority* than
# Maruku. Tilt will first try to `require "rdiscount/template"`, falling
# back to `require "maruku/template"`. If none of these are successful,
# Kramdown. Tilt will first try to `require "rdiscount/template"`, falling
# back to `require "kramdown/template"`. If none of these are successful,
# the first error will be raised.
class Mapping < BaseMapping
LOCK = Mutex.new
Expand Down
10 changes: 0 additions & 10 deletions lib/tilt/maruku.rb

This file was deleted.

12 changes: 0 additions & 12 deletions lib/tilt/wikicloth.rb

This file was deleted.

2 changes: 1 addition & 1 deletion test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
require 'warning'
rescue LoadError
else
Warning.ignore(%r{lib/wikicloth/extensions/|lib/pdf/reader/font.rb|lib/maruku/|lib/creole/parser.rb|lib/commonmarker})
Warning.ignore(%r{lib/pdf/reader/font.rb|lib/creole/parser.rb|lib/commonmarker})
end
end

Expand Down
Loading

0 comments on commit 5dc13d1

Please sign in to comment.