I try to display something like

key=[token token_custom token_custom_key]

where token_custom_key=print '123456';

I get
key= 123456
instead of
key=123456

Comments

Morn’s picture

Status: Active » Needs review

replacing in token_filter.module, line 34:

$output .= preg_replace_callback("|\[token ([^ ]*) ([^]]*)\]|i", 'token_filter_replacetoken', $text);

against

$output .= preg_replace_callback("|\[token\s+(\w+)\s+(\w+)\]|i", 'token_filter_replacetoken', $text);

seems to work for me

pvhee’s picture

I don't have the problem you are mentioning, but I am not sure what you mean with "where token_custom_key=print '123456';".

I have implemented a token value in my custom.module:

/**
 * Implementation of hook_token_values().
 */
function custom_token_values($type, $object = NULL, $options = array()) {
  if ($type == 'token_custom') {
    $tokens['token_custom_key']      = '123456';
    return $tokens;
  }
}

I enabled the token_filter in the Full HTML Input Format, and used

"[token token_custom token_custom_key]"

which renders in the body like

"123456"

without any blank character prepended.

pvhee’s picture

Status: Needs review » Closed (won't fix)

status set to wontfix until further notice

sajosh’s picture

Version: 6.x-1.x-dev » 5.x-1.x-dev
Status: Closed (won't fix) » Needs review

I have the same problem on a Drupal 5.7 site. A blank is prepended on the user tokens but not on the global ones. I use this filter on the Full HTML input format.

So I replaced the $output as Morn shows in comment #1. This removed the space for user user and uid but created another problem. It doesn't convert the following ...
[token global site-url]
[token global user-name]
[token global user-id]
[token global user-mail]
[token global user-url]
[token global site-name]
[token user user-raw]

These are the only ones I tested. This is a nice module and a solution to this problem would be very helpful.

pvhee’s picture

Status: Needs review » Closed (won't fix)

I am not actively maintaining the Drupal 5 branch of this module. If you provide a patch, I will commit it. For the moment, I am closing this issue.