Hi and thanks for this module,

I have a special use case where I must reproduce aliases from an existing site exactly.

Among other problems, I have to keep the number of spaces, so the number of separators, equal from one site to the other.

For example, the string "This is a special string with two spaces here." should translate to :

this-is-a-special-string-with-two-spaces--here (note the two dashes)

... and not to :

this-is-a-special-string-with-two-spaces-here (one dash only)

I'm using the transliteration module, because french accentuated characters must be managed.

A simple hint to a line I must change in the code would do.

Thanks in advance.

Comments

Countzero’s picture

I tried to change line 209 in pathauto.inc from

$output = preg_replace('/\s+/', $cache['separator'], $output);

to various things like

$output = preg_replace('/\s/', $cache['separator'], $output);

or

$output = str_replace(' ', $cache['separator'], $output);

... but it didn't change anything. I guess spaces are replaced in some other place, but can't find where as of now.

Dave Reid’s picture

I have a special use case where I must reproduce aliases from an existing site exactly.

This isn't a very good fit for using Pathauto - why not just manually set aliases for your content if you need an exact match?

Countzero’s picture

Because I have tenths of thousands of pages which will turn into nodes when migrated.

I think Pathauto is a blessing in this case. It's just the spaces to space thing which bugs me.

Countzero’s picture

Let me try to explain better what I'm trying to do :

- pathauto is perfect for my use case, because of the bulk update feature which lets me update my nodes' paths in minutes.
- The only thing I want is changing the default behaviour, which replaces multiple spaces with only one.
- For my purpose, I'll use a modified version of pathauto, just for the time of the migration.
- I don't understand why the modification I mentioned above doesn't change the behaviour of the module.

So, if someone could just point me to the correct lines of code in the module which I should modify to achieve this (or explain the basic workflow used, or what I miss), it would be a perfect solution for me.

Thanks in advance