Index: liquid_filters.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/liquid/liquid_filters.module,v retrieving revision 1.3 diff -u -p -r1.3 liquid_filters.module --- liquid_filters.module 8 Feb 2007 21:02:10 -0000 1.3 +++ liquid_filters.module 16 Mar 2007 10:45:48 -0000 @@ -61,4 +61,65 @@ function liquid_filters_filter($op, $del } } -?> \ No newline at end of file +function liquid_filters_filter_tips($delta, $format, $long = false) { + $output = '

'.t('This site allows wiki content. The wiki format is called "MediaWiki" and you can get more info about it on Wikipedia.org.').'

'; + $supported_tags = 'italics bold bold-italics heading-1 heading-2 heading-3 links rule bullet-list numbered-list table '; + $output = '

'.t('Supported formatting is:').t($supported_tags).'

'; + + if ($long) { + $output .= t('

This table is from the wikipedia cheat-sheet:

'); + + $tips = array( + 'italics' => array( ''. t('Italics') .'', t("''Italics''") ), + 'bold' => array( ''. t('Bold'). '', t("'''Bold'''")), + 'bold-italics' => array( ''. t('Bold Italics'). '', t("'''''Bold Italics'''''")), + 'heading-1' => array( '

'. t('Heading 1') .'

', t('==Heading 1==')), + 'heading-2' => array( '

'. t('Heading 2') .'

', t('===Heading 2===')), + 'heading-3' => array( '

'. t('Heading 3') .'

', t('====Heading 3====')), + 'links' => array( ''. t('Link with text') .'', t('[http://example.com/page Link with text]')), + 'rule' => array( '
', '----'), + 'bullet-list' => array( '', " + * one + * two + ** two-one + ** two-two + * three"), + 'numbered-list' => array( '
  1. '.t('one').'
  2. '.t('two').'
    1. '.t('two-one').'
    2. '.t('two-two').'
  3. '.t('three').'
', " + # one + # two + ## two-one + ## two-two + # three"), + // Assumes and describes tr, td, th. + 'table' => array( '
'. t('Header 1') .''.t('Header 2').'
'.t('Cell').''.t('Cell').'
'.t("Cell").''.t('Cell').'
', " + {| border=1 align=center + |- bgcolor=silver + !Header 1 || Header 2 + |- + | Cell || Cell + |- + | Cell || Cell + |}"), + ); + $header = array(t('You Want'), t('You Type')); + preg_match_all('/([a-z0-9-]+)[^a-z0-9-]/i', $supported_tags, $out); + foreach ($out[1] as $tag) { + if (array_key_exists($tag, $tips)) { + if ($tips[$tag]) { + $rows[] = array( + array('data' => $tips[$tag][0], 'class' => 'get'), + array('data' => '
'. check_plain($tips[$tag][1]) .'
', 'class' => 'type'), + ); + } + } + else { + $rows[] = array( + array('data' => t('No help provided for tag %tag.', array('%tag' => $tag)), 'class' => 'description', 'colspan' => 3), + ); + } + } + $output .= theme('table', $header, $rows); + } + return($output); +} +?>