You are here

protected static function SmartyPants::abbrSpan in Typogrify 8

Wrapping abbreviations adding whitespace by setting margin-left in a span.

Parameters

array $hit: A matcher-array from preg_replace_callback.

Return value

string The first element of the array, wrapped in a span.

File

src/SmartyPants.php, line 892

Class

SmartyPants
SmartyPants - Smart punctuation for web sites.

Namespace

Drupal\typogrify

Code

protected static function abbrSpan(array $hit) {
  $thbl = '.<span style="margin-left:0.167em"><span style="display:none">&nbsp;</span></span>';
  $res = preg_replace('/\\.(\\p{L})/u', $thbl . '\\1', $hit[0]);
  return '<span class="abbr">' . $res . '</span>';
}