I agree, spaces are normally preferred.
However, unlike the usual metadata File page linked via images, I use a simplified image view.
Instead of [[File:Some image|800px]] on www.example.wiki leading to www.example.wiki/File:Some_image.jpg, images sometimes link to www.example.wiki/File.cgi?Some_image.jpg
File.cgi is an exception on my Apache that is bypassed by MW's default behaviour in returning non-existing page URLs, like: [[File:Some image.jpg|link=File.cgi?Some_image.jpg|800px]]
would achieve.
Using the link=
markup, Replace Text, either by command line or its form-based interface, would be the preferred method of replacing markup across many pages. A search and replace regex could for example:
- Extract the filename pattern between any
[[File:
until the first period before jpg, JPG, png, etc.
- Place in variable and replace spaces in filenames with underscores.
- Insert the
|link=Some_image.jpg
variable in each [[File:
... enclosure, just berore its closing ]]
.
This way the spaces and wiki markup can remain standard. The regex procedure would need to be idempotent to not operate on patterns which have File.cgi somewehere within [[File: .. File.cgi .. .jpg]]
already.
Or, perhaps it is easier to change the MW's File: procedures for image displays to link to example.wiki/File.cgi?... instead of to example.wiki/File:..., in which case the underscores will need to be present.
Can this be configured by hooks in LocalSettings or in one particular MW template or PHP file?
Thank you for any ideas.