You are here

function _typogrify_filter_tips in Typogrify 7

Filter tips callback for Typogrify filter.

1 string reference to '_typogrify_filter_tips'
typogrify_filter_info in ./typogrify.module
Implements hook_filter_info().

File

./typogrify.module, line 47
Typogrify: Brings typographical refinemnts to drupal

Code

function _typogrify_filter_tips($filter, $format, $long) {
  if ($long) {
    module_load_include('php', 'typogrify', 'unicode-conversion');
    $output = t('Typogrify.module brings the typographic refinements of Typogrify to Drupal.');
    $output .= '<ul>';
    if ($filter->settings['wrap_ampersand']) {
      $output .= '<li>' . t('Wraps ampersands (the “&amp;” character) with !span.', array(
        '!span' => '<code>&lt;span class="amp"&gt;&amp;&lt;/span&gt;</code>',
      )) . '</li>';
    }
    if ($filter->settings['widont_enabled']) {
      $output .= '<li>' . t("Prevents single words from wrapping onto their own line using Shaun Inman's Widont technique.") . '</li>';
    }
    if ($filter->settings['wrap_initial_quotes']) {
      $output .= '<li>' . t("Converts straight quotation marks to typographer's quotation marks, using SmartyPants.");
      $output .= '</li><li>' . t('Wraps initial quotation marks with !quote or !dquote.', array(
        '!quote' => '<code>&lt;span class="quo"&gt;&lt;/span&gt;</code>',
        '!dquote' => '<code>&lt;span class="dquo"&gt;&lt;/span&gt;</code>',
      )) . '</li>';
    }
    $output .= t('<li>Converts multiple hyphens to en dashes and em dashes (according to your preferences), using SmartyPants.</li>');
    if ($filter->settings['hyphenate_shy']) {
      $output .= '<li>' . t('Words may be broken at the hyphenation points marked by “=”.') . '</li>';
    }
    if ($filter->settings['wrap_abbr']) {
      $output .= '<li>' . t('Wraps abbreviations as “e.g.” to !span and adds a thin space (1/6 em) after the dots.</li>', array(
        '!span' => '<code>&lt;span class="abbr"&gt;e.g.&lt;/span&gt;</code>',
      )) . '</li>';
    }
    if ($filter->settings['wrap_numbers']) {
      $output .= '<li>' . t('Wraps large numbers &gt; 1&thinsp;000 with !span and inserts thin space for digit grouping.', array(
        '!span' => '<code>&lt;span class="number"&gt;…&lt;/span&gt;</code>',
      )) . '</li>';
    }
    if ($filter->settings['wrap_caps']) {
      $output .= '<li>' . t('Wraps multiple capital letters with !span.', array(
        '!span' => '<code>&lt;span class="caps"&gt;CAPS&lt;/span&gt;</code>',
      )) . '</li>';
    }
    $output .= '<li>' . t('Adds a css style sheet that uses the &lt;span&gt; tags to substitute a showy ampersand in headlines, switch caps to small caps, and hang initial quotation marks.') . '</li>';

    // Build a list of quotation marks to convert.
    foreach (unicode_conversion_map('quotes') as $ascii => $unicode) {
      if ($filter->settings['quotes'][$ascii]) {
        $output .= '<li>' . t('Converts <code>!ascii</code> to !unicode', array(
          '!ascii' => $ascii,
          '!unicode' => $unicode,
        )) . "</li>\n";
      }
    }
    $output .= '</ul>';
  }
  else {
    $output = t('Typographic refinements will be added.');
  }
  return $output;
}