I made a new CCK field called "field_vendor_name". So I see the token "[field_vendor_name-title]" as an option, which I'm using in several places.
An example below (node titled "Lisa's Pizza & Italain Rstrnt"):

Custom Breadcrumbs
- The breadcrumb text displays as "Lisa's Pizza & Italain Rstrnt".
- The breadcrumb link is "Lisa%2526%2523039%3Bs+Pizza+%2526amp%3B+Italain+Rstrnt"

PathAuto
- In pathauto, I've successfully been able to remove the single quote by adding "'" to the module's comma-separated list of Strings to Remove (under General Settings), BUT the same is not true for the ampersand (adding "&" to the list does not remove this as it does the single quote for some reason). SO the path shows up as: "Lisas+Pizza+%2526amp%3B+Italain+Rstrnt"

So between these two modules, not only does the breadcrumb text appear non-user-friendly, but the breadcrumb link doesn't link to the page because Pathauto does it differently.

CCK Select Widget
Also, as an aside (to further build a case for my request), the same text that displays in the breadcrumb also displays in a CCK Select Widget I enabled on another content-type -- which allows users to associate this new content type with another using the same field mentioned above (field_vendor_name).

My request:
Is there a way to strip out punctuation and html out of all title links in the token itself?
This way, I wouldn't have to depend on each of these different modules to strip punctuation/html from the token in exactly the same way.

A patch would be fantastic.
A workaround I could add in the meantime would also be very appreciated.

Thanks in advance for any help or advice!

Comments

greggles’s picture

Title: custom breadcrumbs & pathauto both showing punctuation as html. » provide token feature to remove punctuation from tokens
Category: bug » feature
Priority: Critical » Normal

@scottrigby re:pathauto please read the docs about using the -raw tokens. This issue and your pathauto one are filed against pathauto 5.x-2.0 and Token5.x-1.9. If you are using those then when you visit admin/settings/pathauto it will give big red warnings at the top of the page if you are using the style of tokens that cause this problem. No need for further workarounds or patches.

For custom breadcrumbs...I can't say for certain but in my test just now it appears that using token-raw solves the problem. I'll leave it to eaton to respond about whether or not custom breadcrumbs is safe to use the -raw tokens but my impression is that it is since it is passed through the l() function.

Your final request is for for a feature to strip out punctuation. Pathauto currently has its own code for that, I don't think that it can or should be generalized into token, though. If it does it wouldn't happen until a "tokens 2.0".

Changing title and category to reflect the final request and not the initial discussion of problems in configuring the modules.

scottrigby’s picture

Oh - I just installed Token5.x-1.9, but I was wrong about the version of Pathauto.

I've got Pathauto installed.
Also applied the patch pathauto_punc_39.patch

I assume I should upgrade Pathauto to the newest version, but if so should I apply this same patch? Or is that no longer necessary in this new version?

--

Also I've been looking for the raw version of my CCK field, but can't seem to find it anywhere (seems unrelated to the version of Pathauto)? And not sure I'd know what to do with it when I do?

Thanks for your help - it will be great to resolve this.

scottrigby’s picture

Ok, I added the Pathauto 2.0 module. So Pathauto works great now - the only problem is I can't integrate pathauto with breadcrumbs (custom breadcrumbs still don't filter out punctuation).

re: #1 above -- there's no -raw option for my custom CCK field. When I go to Custom Breadcrumbs, under Placeholder Tokens, I see:

CCK node reference tokens
[field_vendor_name-nid]	Referenced node ID.
[field_vendor_name-title]	Referenced node title.
[field_vendor_name-link]	Formatted html link to the node.

Is there a way that Token can create -raw tokens for CCK fields (like [field_vendor_name-title-raw])? Or is there an option to select somewhere that I'm missing?

dave reid’s picture

Status: Active » Closed (won't fix)

D7 token API provides a callback for tokens, but I think this is out of the scope of the project now for D5 and D6.