public static function SmartyPants::educateDashesOldSchoolInverted in Typogrify 8
EducateDashesOldSchoolInverted.
Parameters
string $_: Input text.
Return value
string The string, with each instance of "--" translated to an em-dash HTML entity, and each "---" translated to an en-dash HTML entity. 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.)
1 call to SmartyPants::educateDashesOldSchoolInverted()
- SmartyPants::process in src/
SmartyPants.php - SmartyPants.
File
- src/
SmartyPants.php, line 1128
Class
- SmartyPants
- SmartyPants - Smart punctuation for web sites.
Namespace
Drupal\typogrifyCode
public static function educateDashesOldSchoolInverted($_) {
// Dashes en em.
$_ = str_replace([
"---",
"--",
], [
'–',
'—',
], $_);
return $_;
}