SmartyPants-PHP
Introduction
SmartyPants-PHP is a PHP4 port of John Gruber's excellent SmartyPants quote-educator software.
What does it do? To paraphrase from the SmartyPants website:
SmartyPants-PHP is a function library that translates plain ASCII punctuation characters into “smart” typographic punctuation HTML entities.
SmartyPants-PHP can perform the following transformations:
- Straight quotes ( " and ' ) into “curly” quote HTML entities
- Backticks-style quotes (``like this'') into “curly” quote HTML entities
- Dashes (“--” and “---”) into en- and em-dash entities
- Three consecutive dots (“...”) into an ellipsis entity
For additional information on features, see the code and/or the readme document.
SmartyPants-PHP 1.5.1-r1 has been tested with PHP 4.3.2 and 4.3.3. (The 1.4.X series required 4.3.3; 1.5.X do not.)
Downloads
- SmartyPants-PHP 1.5.1-r1 released on 2004-08-08
Includes contributions by Alexander M. Rosenberg and Kevin L. Papendick. - SmartyPants-PHP 1.4.1-r2 released 2004-03-02
- SmartyPants-PHP 1.4.1 released 2004-02-21
Change Log
Changes to SmartyPants-PHP are recorded in the CHANGELOG.
Sample Usage
Input:
"She asked, 'Do nested quotes work?'... I answered, 'Yes, Ma'm -- of course they do.'"
Code:
require_once './SmartyPants-PHP.inc';
echo SmartyPants($s);
Output:
“She asked, ‘Do nested quotes work?’… I answered, ‘Yes, Ma’m — of course they do.’”
Comments and Bug Reports
Send email to bugs (at) monauraljerk (dot) org
Credits
The original SmartyPants plug-in was written in PERL by John Gruber (http://daringfireball.net). John's code was translated to PHP by matthew mcglynn (http://debris.com). Early testing and feedback was provided by Joseph Stump. Additional testing, bugfixes and feature suggestions by Kevin L. Papendick. The 1.5.1-b1 library was contributed by Alexander M. Rosenberg.
Copyright and License
Because SmartyPants-PHP is a modification of and redistribution of code authored by someone else, it is subject to the original's license terms, which can be found at the SmartyPants website.