Default filter? Filtering *all* node text?

4 views
Skip to first unread message

ma...@mkdynamic.co.uk

unread,
May 25, 2014, 7:39:05 PM5/25/14
to ha...@googlegroups.com
I'm currently using a custom filter for SmartyPants, to get beautiful typography, via RubyPants (https://github.com/jmcnevin/rubypants).

So currently I write code like this in the templates:

%p
  :smarty
    My awesome text -- with lazy typography. "Don't quote this", he said.

And it will output something like:

<p>My awesome text — with lazy typography. “Don’t quote this”, he said.</p>

What I really want is for *all* the text of all HTML nodes to run through this filter, so I could just write:

%p
  My awesome text -- with lazy typography. "Don't quote this", he said.

How possibly does this seem? Any ideas for how to hook into all text for HTML nodes?

Couple thoughts:

- For safety, it would seem best to run through this filter *before* any escaping took place.
- I'd obviously want to benchmark performance impact.

Before I dive in and try a bunch of stupid things and nasty hacks, curious if anybody knows of a good way to approach this.

Any thoughts much appreciated!
Reply all
Reply to author
Forward
0 new messages