It turns out that it breaks many Game Courier presets that already use directories with colons in them. So we might need a different solution than just getting rid of them. Could you adjust your code to look for colons only where they would be used as separators?
The problem is that filenames are one of the items that have to be separated by the colons. A piece is defined by a line NAME:ID:MOVE:IMAGEFILE:STARTSQUARES. Normally the IMAGEFILE would not contain the directory name, which would be supplied by the graphicsDir parameter, and would typically be something like /graphics.dir/alfaeriePNG/. And it would not care if there are colons in the name. The colon hurts when you have to specify the full pathname of an 'extaneous' image that was not in the standard set your Diagram used, and was uploaded to the article's directory. And especially CwDA articles are likely to need that, as the novel armies typically contain weird pieces.
Possible other solutions are:
upload the images for the CwDA article to some other directory of an unrelated article not containing a colon in its name.
upload a copy of all the standard piece images you are using to the article's directory, and then specify that with the graphicsDir parameter to the Diagram. So that all required images are found there, and no extraneous images are needed.
use another character or character combination as escape for the colon in filenames, and make the Diagram script recognize and replace that in the IMAGEFILE string after having split the piece-definition line at the colons.
None of this is ideal. Many users might not know how to obtain the copies of the standard images, or that they even have to do it in case 2. People submitting an article with a colon in the title might not have other articles published where they can park the required images, and they might not realize the standard upload directory is unsuitable for storing their on-site images in case 1. For case 3 they would somehow have to know what the escape sequance for the colon is.
But perhaps we should accept that using 'extraneous' piece images in Interactive Diagrams is too complex for most users in the first place, so that they would need help anyway. In that case solution 3 might be the best option. Easiers would be to just pick one other character to mean 'colon' when it appears in the IMAGEFILE. But we should take care that this then is a character that would never appear in the name of any upload directory.
In the mean time I have started (next to cwda-the-bent-bozos) two more articles on CwDA armies, which now use upload directories and article names that were stripped from the variant name:
cwda-the-daring-dragons
cwda-the-silly-sliders
which would also have to moved back to a colon-containing name if you want to undo the slugify changes.
The problem is that filenames are one of the items that have to be separated by the colons. A piece is defined by a line NAME:ID:MOVE:IMAGEFILE:STARTSQUARES. Normally the IMAGEFILE would not contain the directory name, which would be supplied by the graphicsDir parameter, and would typically be something like /graphics.dir/alfaeriePNG/. And it would not care if there are colons in the name. The colon hurts when you have to specify the full pathname of an 'extaneous' image that was not in the standard set your Diagram used, and was uploaded to the article's directory. And especially CwDA articles are likely to need that, as the novel armies typically contain weird pieces.
Possible other solutions are:
None of this is ideal. Many users might not know how to obtain the copies of the standard images, or that they even have to do it in case 2. People submitting an article with a colon in the title might not have other articles published where they can park the required images, and they might not realize the standard upload directory is unsuitable for storing their on-site images in case 1. For case 3 they would somehow have to know what the escape sequance for the colon is.
But perhaps we should accept that using 'extraneous' piece images in Interactive Diagrams is too complex for most users in the first place, so that they would need help anyway. In that case solution 3 might be the best option. Easiers would be to just pick one other character to mean 'colon' when it appears in the IMAGEFILE. But we should take care that this then is a character that would never appear in the name of any upload directory.
In the mean time I have started (next to cwda-the-bent-bozos) two more articles on CwDA armies, which now use upload directories and article names that were stripped from the variant name:
cwda-the-daring-dragons
cwda-the-silly-sliders
which would also have to moved back to a colon-containing name if you want to undo the slugify changes.