You are here

public static function Typogrify::dash in Typogrify 6

Same name and namespace in other branches
  1. 5 typogrify.class.php \Typogrify::dash()
  2. 7 typogrify.class.php \Typogrify::dash()

Puts a   before and after an &ndash or —

Dashes may have whitespace or an `` `` on both sides

Parameters

string:

Return value

string

1 call to Typogrify::dash()
Typogrify::filter in ./typogrify.class.php
typogrify

File

./typogrify.class.php, line 30
typogrify.class.php Defines a class for providing different typographical tweaks to HTML

Class

Typogrify
@file typogrify.class.php Defines a class for providing different typographical tweaks to HTML

Code

public static function dash($text) {
  $dash_finder = "/(\\s| | )*(—|–|–|–|—|—)(\\s| | )*/";
  return preg_replace($dash_finder, ' \\2 ', $text);
}