Do the bulk of the conversion work.
Quotes to entities.
Call the individual dash conversion to entities functions.
Call the individual ellipse conversion to entities functions.
Parameter: String. Returns: The string, with "educated" curly quote characters. Example input: "Isn't this fun?" Example output: “Isn’t this fun?”
Replace double (back)ticks w/ characters.
Replace single (back)ticks w/ characters.
Dashes to character
Parameter: String. Returns: The string, with each instance of "--" translated to an em-dash character.
Dashes to entities.
Parameter: String. Returns: The string, with each instance of "--" translated to an en-dash character, and each "---" translated to an em-dash character.
Parameter: String. Returns: The string, with each instance of "--" translated to an em-dash character, and each "---" translated to an en-dash character. Two reasons why: First, unlike the en- and em-dash syntax supported by EducateDashesOldSchool(), it's compatible with existing entries written before SmartyPants 1.1, back when "--" was only used for em-dashes. Second, em-dashes are more common than en-dashes, and so it sort of makes sense that the shortcut should be shorter to type. (Thanks to Aaron Swartz for the idea.)
Parameter: String. Returns: The string, with each instance of "..." translated to an ellipsis character. Example input: Huh...? Example output: Huh…?
Parameter: String. Returns: The string, with after processing the following backslash escape sequences. This is useful if you want to force a "dumb" quote or other character to appear. Escape Value ------ ----- \\ \ \" " \' ' \. . \- - \` `
Plerd::SmartyPants
This is a fork of Text::SmartyPants version 1.3, originally by John Gruber. (See "Copyright and License", below.) It has been simplified and customized for use by the Plerd static blog generator by Jason McIntosh.
Unlike Text::SmartyPants, it's not intended for use in any other context.
The biggest difference between Plerd::SmartyPants and Text::SmartyPants is that the former doesn't convert anything into HTML entities; instead it converts its ASCII input directly into UTF-8 characters.
Copyright (c) 2003 John Gruber (http://daringfireball.net/) All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
* Neither the name "SmartyPants" nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
This software is provided by the copyright holders and contributors "as is" and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. In no event shall the copyright owner or contributors be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this software, even if advised of the possibility of such damage.
To install Plerd, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Plerd
CPAN shell
perl -MCPAN -e shell install Plerd
For more information on module installation, please visit the detailed CPAN module installation guide.