[Mediawiki-l] Underscores / Spaces

Frederich, Eric P2173 eric.frederich at siemens.com
Fri Sep 15 15:04:39 UTC 2006


Hello,
 
I just e-mailed this list with a template I created to help keep source
files and image files in sync such as a screen shot of a Visio file and
the Visio file itself.

The template contained two links
1 : [[Media:{{{1}}}]] 
2 : [[:Image:{{{1}}}]]

The first one is used to download the file, and the 2nd one takes you to
the image page of the file so you can upload a new version or look at
previous versions.

This works fine when the file already exists, but when the file doesn't
exist the first link instead of downloading the file is a link to upload
the file and the 2nd link brings you to edit the page for a file that
doesn't exist.

I would like to have a 3rd link which will upload the file whether it
exists or not which is where I'm running into problems with underscores
What I have come up with so far for this is the following....

[{{fullurl:Special:Upload|wpDestFile={{{1}}}}} Upload]

The problem here is that what is contained in {{{1}}} may have spaces.
So if {{{1}}} is "Some File.ppt" then the link will be to
index.php?title=Special:Upload&wpDestFile=Some instead of
index.php?title=Special:Upload&wpDestFile=Some_File and of course the
text of the link will be File Upload instead of Upload.

I would like to know if there is a template out there that will take
some text and replace spaces with underscores so that I can do what I
want.

I would hope there is since the space / underscore conversion is done
all over the place in MediaWiki.  I just don't know where I can access
that functionality.

Thanks in advance,
~Eric



More information about the MediaWiki-l mailing list