function EducateDashesOldSchoolInverted in Typogrify 5
Same name and namespace in other branches
- 6 smartypants.php \EducateDashesOldSchoolInverted()
- 7 smartypants.php \EducateDashesOldSchoolInverted()
1 call to EducateDashesOldSchoolInverted()
1 string reference to 'EducateDashesOldSchoolInverted'
File
- ./
smartypants.php, line 553
Code
function EducateDashesOldSchoolInverted($_) {
#
# Parameter: String.
#
# Returns: 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.)
#
# en em
$_ = str_replace(array(
"---",
"--",
), array(
'–',
'—',
), $_);
return $_;
}