I love the endash/emdash feature, but sometimes the text wraps so that the dash is at the beginning of a line. Would it be possible to make the preceding space (if there is one) a   character to make the dash stick to the previous word?

Comments

mikl’s picture

Version: 6.x-1.0-rc1 » 6.x-1.x-dev
Status: Active » Needs work

If someone is willing to find a good way to implement this, please go ahead.

frank ralf’s picture

If you look at typogrify.class.php (line 23 ff.) this feature should already be implemented:

/**
   * Puts a   before and after an &ndash or —
   *
   * Dashes may have whitespace or an `` `` on both sides
   * @param string
   * @return string
   */
  public static function dash($text) {
      $dash_finder = "/(\s| | )*(—|–|–|–|—|—)(\s| | )*/";
      return preg_replace($dash_finder, ' \\2 ', $text);
  }

So this might be a browser problem?

hth
Frank

mrtoner’s picture

Status: Needs work » Active

Adam's point is that   is a breaking space and will thus at times break before the dash. However, instead of   as he suggests,   -- a non-breaking space with a similar width to the thin space -- is more appropriate.

(Reset status as there is no patch attached.)