Wordpress does a pretty good job, though it's written in PHP. Maybe one could port that part of their code to Perl and turn it into a plugin.
On Thu, Mar 24, 2016 at 8:18 PM, Sherwood Botsford <sgbotsf...@gmail.com> wrote: > I was hoping for a little bit more comprehensive solution. Even > SmartyPants doesn't get it all correct. > > To do it right: > > A: Must be able to recognized when inside of PRE and CODE tags. > B: Must not replace inside html tags. <div class=\&rdquot;foo\&ldquot;> > is not a win. > C: Ideally recognises prefix situations: E.g. 'Twas the night before > Christmas, and "Throw 'nother log on the fire" > > Respectfully, > > Sherwood of Sherwood's Forests > > > On 24 March 2016 at 03:53, Dami Laurent (PJ) <laurent.d...@justice.ge.ch> > wrote: > >> Hi, >> >> >> >> I guess you could define a custom filter and then invoke the FILTER >> directive wherever you need it. >> >> The body of the filter could use regular expressions on word boundaries >> to replace quotes; something like this : >> >> >> >> sub replace_quotes { >> >> my $text = shift; >> >> $text =~ s/"\b/«/g; >> >> $text =~ s/\b"/»/g; >> >> return text; >> >> } >> >> >> >> Hope this helps, >> >> >> >> Laurent Dami >> >> >> >> *De :* templates-boun...@template-toolkit.org [mailto: >> templates-boun...@template-toolkit.org] *De la part de* Sherwood Botsford >> *Envoyé :* mercredi 23 mars 2016 02:39 >> *À :* templates@template-toolkit.org >> *Objet :* [Templates] Smart quotes? >> >> >> >> >> >> Anyone have a recipe for adding smartypants or equivalent script into the >> ttree script so that the html output has straight quotes replaced with >> typograper's quotes? >> >> >> >> >> Respectfully, >> >> Sherwood of Sherwood's Forests >> > > > _______________________________________________ > templates mailing list > templates@template-toolkit.org > http://mail.template-toolkit.org/mailman/listinfo/templates > > -- Check out my LEGO blog at brickpile.com <http://www.brickpile.com/> Follow/friend me: Facebook <http://facebook.com/billward> • Flickr <http://flickr.com/photos/billward/> • Twitter <http://twitter.com/williamward> • LinkedIn <http://www.linkedin.com/pub/william-ward/63/393/985/> • Goodreads <https://www.goodreads.com/user/show/2554312-bill-ward>
_______________________________________________ templates mailing list templates@template-toolkit.org http://mail.template-toolkit.org/mailman/listinfo/templates