Index: modules/filter.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/filter.module,v
retrieving revision 1.4
diff -u -r1.4 filter.module
--- modules/filter.module 27 Jan 2004 22:10:47 -0000 1.4
+++ modules/filter.module 31 Jan 2004 03:01:34 -0000
@@ -8,6 +8,7 @@
case 'admin/system/filters':
return t("Filters fit between the raw text in a node and the HTML output. They allow you to replace text selectively. Uses include automatic conversion of emoticons into graphics and filtering HTML content from users' submissions.");
case 'filter#tip':
+ case 'filter#short-tip':
switch (variable_get("filter_html", 1)) {
case 0:
return t("All HTML tags allowed");
@@ -180,10 +181,10 @@
}
function filter_tips_page() {
- $tips = module_invoke_all("help", "filter#tip");
- foreach ($tips as $tip) {
- if ($tip) {
- $tiplist .= "
$tip\n";
+ $tiplist = '';
+ foreach (module_list() as $name) {
+ if ($tip = module_invoke($name, "help", "filter#tip")) {
+ $tiplist .= "$tip\n";
}
}
$output = "\n";
@@ -191,7 +192,15 @@
}
function filter_tips_short() {
- return filter_help("filter#tip") . "
" . l(t("More information on formatting options."), "filter/tips", array("target" => "_blank"));
+ $tiplist = array();
+ foreach (module_list() as $name) {
+ if ($tip = module_invoke($name, "help", "filter#short-tip")) {
+ $tiplist[$name] = $tip;
+ }
+ }
+ $tiplist[] = '
'. l(t("More information on formatting options"), "filter/tips");
+ $output = implode('
', $tiplist);
+ return $output;
}
?>
Index: modules/title.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/title.module,v
retrieving revision 1.24
diff -u -r1.24 title.module
--- modules/title.module 26 Jan 2004 18:59:42 -0000 1.24
+++ modules/title.module 31 Jan 2004 03:01:35 -0000
@@ -2,15 +2,16 @@
// $Id: title.module,v 1.24 2004/01/26 18:59:42 dries Exp $
function title_help($section) {
- $output = "";
+ $output = '';
switch ($section) {
case 'admin/system/modules#description':
- $output = t("Enables users to link to stories, articles or similar content by title.");
- break;
+ return t('Enables users to link to stories, articles or similar content by title.');
+ case 'filter#tip':
+ return t("Wiki-like [node title|text] links are enabled. These shortcuts generate a link labeled 'text' to the node with the title 'node title'. If you omit '|text', the label becomes 'node title'. You may use a substring of a node title if desired. When multiple matching titles are found, a list of matching nodes will be displayed. If no matching titles are found, a full-text search is returned.");
+ case 'filter#short-tip':
+ return t('Title links [node title|text] enabled', array('%title_links' => url('filter/tips#filter-title')));
}
-
- return $output;
}
function title_link($type) {
@@ -64,20 +65,28 @@
}
}
-// filter [node title|description] links. '|description' is optional.
+/**
+ * Filter [node title|description] links. '|description' is optional.
+ *
+ * @param $text
+ * Text to be filtered
+ * @return
+ * Filtered text
+ */
function title_filter($text) {
- $pattern = '\[([^\|\]]+)(?>\|?)(.*?)\]'; // $1 == title: matches at least 1 char up to the first '|' or ']'
- // $2 == text: matches all after a following '|' (if there is) up to the next ']'. may include '|'s.
+ /*
+ ** $1 == title: matches at least 1 char up to the first '|' or ']'
+ ** $2 == text: matches all after a following '|' (if there is) up to the next ']'. may include '|'s.
+ ** there must be no '<' in $1 or $2!
+ */
+ $pattern = '\[([^\|\]<]+)(?>\|?)([^<]*?)\]';
+
$replacement = 'l("$2" ? "$2" : "$1", "title/". urlencode("$1"))';
return preg_replace("/$pattern/e", $replacement, $text);
}
function title_conf_filters() {
- return form_group(t("Title filter"), t("Wiki-like [node title|text] links are enabled. These shortcuts generate a link labeled 'text' to the node with the title 'node title'. If you omit '|text', the label becomes 'node title'. You may use a substring of a node title if desired. When multiple matching titles are found, a list of matching nodes will be displayed. If no matching titles are found, a full-text search is returned."));
-}
-
-function title_compose_tips() {
- return array(t("You may quickly link to another node using this syntax: [node title|text]. This will generate a link labeled 'text' to the node with the title 'node title'. If you omit '|text', the label becomes 'node title'."));
+ return form_group(t("Title filter"), title_help('filter#tip'));
}
?>