Index: wiki.module =================================================================== --- wiki.module (revision 571) +++ wiki.module (working copy) @@ -6,16 +6,22 @@ * Handle filtering of Wiki Text */ -define('WIKI_FILTER_HTML_ENABLE', 1); -define('WIKI_FILTER_HTML_DISABLE', 2); - /** * Implementation of hook_help(). */ -function wiki_help($section) { +function wiki_help($section='admin/help#wiki') { switch ($section) { - case 'admin/modules#description': - return t('Enables users to use simple WikiText markup to format content.'); + case 'admin/help#wiki': + return t(' +

+ The Wiki module allows users to enter content using PhpWiki, + a simple, plain text syntax that is filtered into valid HTML. + The + filter tips page provides syntax descriptions and + examples. +

+ '); } } @@ -39,7 +45,7 @@ return t('Converts WikiText to HTML.'); case 'process': - return _wiki_filter($text); + return _wiki_filter($text, $format); case 'settings': return _wiki_filter_settings($format); @@ -57,7 +63,7 @@ $items = array(); if ($may_cache) { - $items[] = array('path' => 'wiki/goto', 'title' => t('wiki goto'), 'type' => MENU_CALLBACK, + $items[] = array('path' => 'wiki/goto', 'title' => t('Wiki goto'), 'type' => MENU_CALLBACK, 'callback' => 'wiki_goto', 'access' => user_access('access content')); } @@ -68,13 +74,23 @@ * Settings for the WikiText filter. */ function _wiki_filter_settings($format) { - $group = form_radios(t('Support Escaped HTML'), "wiki_filter_html", variable_get("wiki_filter_html", WIKI_FILTER_HTML_DISABLE), array(WIKI_FILTER_HTML_ENABLE => t('Enable HTML'), WIKI_FILTER_HTML_DISABLE => t('Disable HTML')), t('Whether to allow |>-escaped HTML. If set to "enable", then any HTML goes on each line after the |> escape marker. If set to "disable", then any HTML tags will be shown as is, unless the HTML Filter has been separately enabled. It is recommended that this be disabled. Turn on the HTML Filter to support HTML, but make sure the HTML filter applies after the WikiText filter.')); - $output .= form_group(t('WikiText filter'), $group); - return $output; + $the_form = array(); + $the_form['wiki_settings'] = + array('#type' => 'fieldset', + '#title' => t('WikiText filter'), + '#collapsible' => TRUE, + '#collapsed' => TRUE); + $the_form['wiki_settings']["enable_html_${format}"] = + array( + '#type' => 'checkbox', + '#title' => t('Enable HTML'), + '#default_value' => variable_get("enable_html_${format}", 0), + '#description' => t('Whether to allow |>-escaped HTML. If enabled, then any HTML goes on each line after the |> escape marker. If disabled, then any HTML tags will be shown as is, unless the HTML Filter has been separately enabled. It is recommended that this be disabled. Turn on the HTML Filter to support HTML, but make sure the HTML filter applies after the WikiText filter.')); + + return $the_form; } - define("WIKI_ZERO_LEVEL", 0); define("WIKI_NESTED_LEVEL", 1); define("WIKI_FIELD_SEPARATOR", "\263"); @@ -354,7 +370,7 @@ /** * WikiText filter. Provides filtering of input into accepted HTML. */ -function _wiki_filter($text) { +function _wiki_filter($text, $format) { $html = ''; $isprotect = FALSE; // whether we're within a {{{ }}} protection block $istable = FALSE; // whether we're currently in a table @@ -407,7 +423,7 @@ $html .= _wiki_set_output_mode('', WIKI_ZERO_LEVEL, 0); continue; } - elseif (variable_get("wiki_filter_html", WIKI_FILTER_HTML_DISABLE) == WIKI_FILTER_HTML_ENABLE) { + elseif (variable_get("enable_html_${format}", 0)) { // We protect HTML by having lines start with |> php-wiki way is just | // this change is to prevent wiki table from being skipped if (preg_match("/(^\|>)(.*)/", $tmpline, $matches)) { @@ -645,10 +661,11 @@ /** * Implementation of hook_filter_tips(). */ -function wiki_filter_tips($delta = 0, $format = -1, $long = false) { - if ($long) { - // orig. from - // but has since been enhanced with other WikiText support. +function wiki_filter_tips($delta, $format, $long = false) { + global $base_url; + if (!$long) { + return t('WikiText is converted to HTML (supported WikiText formatting will show in the long tip format).'); + } else { $output = t('WikiText is converted to HTML according to the following formatting guidelines:

Paragraphs