[Moin-user] URL Referencing with Spaces in File Strings

Yandle, Hans Hans.Yandle at cingular.com
Fri Oct 25 12:28:01 EDT 2002

Well, you are right that does work by translating the spaces to %20's but
that requires people thinking like computers and as such is not very wiki
like. So, I took some time out and found how to fix it. Keep in mind that I
am not a programmer by trade. So, if you would like to be able to include
spaces with in your referenced URLs that are enclosed in brackets see the
patch below:

Example: [file://servername/toolsanddocs/Build Functional Requirements.doc:
Build Functional Requirements]
Please note the lack of %20's.

Here is a patch for Moin/Lib/site-packages/MoinMoin/parser/wiki.py under the
def _url_bracket_repl:

starting at line 360 (wiki.py,v 1.91 2002/07/18 19:20:52 jhermann):
<start> if scheme == "wiki": return self.interwiki(words, pretty_url=1)
<add>   # Enable spaces with in URLs by using another ':' for the
<add>   # example [http://www.company.com/intranet/market 2002 diagram.png:
Market 2002]
<add>   labelsplit = string.find(words[1],':')
<add>   if labelsplit is not -1 and len(words[1]) > 1 :
<add>       words[0] = words[0] + ' ' + words[1][:labelsplit]
<add>       words[1] = string.lstrip(words[1][labelsplit + 1:])
<end>   if scheme in self.attachment_schemas:
<end>       return self.attachment(words, pretty_url=1)



-----Original Message-----
From: Brian Dorsey [mailto:brian at dorseys.org]
Sent: Thursday, October 24, 2002 8:08 PM
To: 'moin-user at lists.sourceforge.net'
Subject: Re: [Moin-user] URL Referencing with Spaces in File Strings

Here is what I ended up doing to link to files with spaces on remote NT

Build Functional Requirements]

This ends up turning into a nice link with a little floppy next to it.

Take care,

On Thu, Oct 24, 2002 at 12:51:03PM -0400, Yandle, Hans wrote:
> I have come to a bit of a problem. I am trying to setup a wiki page but
> attachments stored on an external NT file server. NTFS supports long
> filenames and spaces with in them. So for instance, one might have the
> following:
> Server Name: abcserver
> Share Name: attachments
> UNC: \\abcserver\attachments
> Under the attachments root folder, one might have:
> /Company Logos
>   My Logo.png
>   Logo2.png
> Please note the space in the directory name ("Company Logos") and file
> ("My Logo.png"). The following wiki statements work:
> *	Opens a new window, supports spaces in directories and filenames:
> [[NewWindow("file://abcserver/attachments/Company Logos/My Logo.png"[, "My
> Company Logo"])]]
> *	Here is the same image being displayed as an inline image. I
> converted the spaces to HTML encodings, i.e. <pre>asc(32)=html( ):
> file://abcserver/attachments/Company Logos/My Logo.png </pre>
> *	Here is a html reference for the logo using pure html code:
> <pre>[[HTML(<a href="file://abcserver/attachments/Company Logos/My
> Logo.png">My Company Logo</a>)]]</pre>
> I tried using the url[] command but every time it encounter a space the
> command broke off the remainder/tail as its description. In other words
> does not work:
> *	url["file://abcserver/attachments/Company Logos/My Logo.png" My
> Company Logo]
> It seems logical enough to me that if one encloses their file string
> quotes that file string should be pass quoted and as is to the "a hrefs"
> "image" tags.
> Can someone tell me how to workaround this issue or possible fix it. I
> understand the conversion of spaces to html encoding but my users will
> Regards,
> Hans

More information about the Moin-user mailing list