Erubi 1.13.0 Released #40
jeremyevans
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Erubi 1.13.0 has been released!
This release adds erubi/capture_block, supporting capturing block output
via standard <%= and <%== tags.
This implementation is based on @seki's recent presentations at RubyWorld
and RubyKaigi regarding an implementation for stdlib ERB. This implementation
has the following changes:
The Buffer class is a String subclass for better compatibility with code
that calls string methods on the buffer.
This uses <<= instead of +=, so that we don't have to override Buffer#+,
since for strings that should not mutate the receiver.
This supports escaped tags <%== by using the |= operator, and has Buffer#|
do the escaping and concatenating (this is an extension to ERB added by
Erubis and retained by Erubi).
This handles empty tags by treating them as containing the empty string
for compatibility.
Unfortunately, the capture_block support isn't 100% compatible with the
standard support. At least, behavior for multiple statements inside
<%= and <%== differs:
The capture_block support doesn't support the :escapefunc option. For
custom escaping functions, you'll need to use a Buffer subclass. It also
doesn't support the :chain_appends option (it ignores it if set).
Additionally, this release makes Erubi.h a module function instead of just
a singleton method.
Thanks,
Jeremy
Beta Was this translation helpful? Give feedback.
All reactions