Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Wikipedia: Mediawiki

Converting "_" to "%20" in file:/// url

 

 

Wikipedia mediawiki RSS feed   Index | Next | Previous | View Threaded


kushalkoolwal at hotmail

Nov 6, 2009, 10:57 AM

Post #1 of 11 (522 views)
Permalink
Converting "_" to "%20" in file:/// url

MediaWiki: 1.12
Host OS: Linux

Most of our intranet mediawiki users are very non-technical. We link to a lot of file that resides on Windows shared network drive in our mediawiki articles. There are hundreds and hundreds of such files. These files and their paths have "spaces" in them which needs to be converted into their ASCII equivalent of "%20".

Using {{urlencode}} does not work because it converts "spaces" into "+" character according to RFC1738.

Right now I am using string replacement extension and created a template called "Delspace" with following function:

{{#replace:{{{1}}}| |%20}}

and I am using the template in our wiki articles like this (for example):
[{{delspace|file///Z:/my project/final results.pdf}} Link to results.pdf]

The above works but as I mentioned before, most of the users are non-technical (word doc types) and it is kind of cumbersome for them to use the above template every time they need to put a link to a document.

So my question(s) is:
1. Basically I am looking for is a way in which the users won't have to
use the template manually every time they need to put a link to a
document which have "spaces".


2. Alternatively, is there a way by which all the file:/// urls in a wiki article which have "spaces" get automatically converted into proper urls (with %20 instead of "spaces") when the user hits the "Save Page" button?

Any other better solution is also welcomed.

Kushal Koolwal

I do blog at http://blogs.koolwal.net/

_________________________________________________________________
Windows 7: Unclutter your desktop.
http://go.microsoft.com/?linkid=9690331&ocid=PID24727::T:WLMTAGL:ON:WL:en-US:WWL_WIN_evergreen:112009
_______________________________________________
MediaWiki-l mailing list
MediaWiki-l[at]lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l


Platonides at gmail

Nov 6, 2009, 3:07 PM

Post #2 of 11 (500 views)
Permalink
Re: Converting "_" to "%20" in file:/// url [In reply to]

Kushal Koolwal wrote:
> MediaWiki: 1.12
> Host OS: Linux
>
> Most of our intranet mediawiki users are very non-technical. We link to a lot of file that resides on Windows shared network drive in our mediawiki articles. There are hundreds and hundreds of such files. These files and their paths have "spaces" in them which needs to be converted into their ASCII equivalent of "%20".
>
> Using {{urlencode}} does not work because it converts "spaces" into "+" character according to RFC1738.
>
> Right now I am using string replacement extension and created a template called "Delspace" with following function:
>
> {{#replace:{{{1}}}| |%20}}
>
> and I am using the template in our wiki articles like this (for example):
> [{{delspace|file///Z:/my project/final results.pdf}} Link to results.pdf]
>
>
> The above works but as I mentioned before, most of the users are non-technical (word doc types) and it is kind of cumbersome for them to use the above template every time they need to put a link to a document.
>
> So my question(s) is:
> 1. Basically I am looking for is a way in which the users won't have to
> use the template manually every time they need to put a link to a
> document which have "spaces".

You could have them use {{file|results.pdf}} and provide a template
which expands to the whole url.


> 2. Alternatively, is there a way by which all the file:/// urls in a wiki article which have "spaces" get automatically converted into proper urls (with %20 instead of "spaces") when the user hits the "Save Page" button?

No, since a space marks the end of the url. You'd need something else to
mark its end (like passing it to a template, like you're doing).

Plase note that file urls don't work on some browsers, like Firefox.
There're workarounds, and extensions but file:/// urls usually give
problems.


_______________________________________________
MediaWiki-l mailing list
MediaWiki-l[at]lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l


kushalkoolwal at hotmail

Nov 6, 2009, 5:05 PM

Post #3 of 11 (499 views)
Permalink
Re: Converting "_" to "%20" in file:/// url [In reply to]

<hd2a7g$7e3$1[at]ger.gmane.org>
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0


> Plase note that file urls don't work on some browsers=2C like Firefox.
> There're workarounds=2C and extensions but file:/// urls usually give
> problems.
Hmm that interesting. So you mean there are other ways (besides file:///) b=
y which we can link to files on the windows shared network drives? Can you =
please point out what those methods (or extension) would be?

Right now=2C the file linking and the spaces to %20 conversion is the bigge=
st hurdle we are having to adopt the wiki into our systems.

Platonides=2C thanks for your reply.

Kushal Koolwal

I do blog at http://blogs.koolwal.net/
=20
_________________________________________________________________
Windows 7: Unclutter your desktop.
http://go.microsoft.com/?linkid=3D9690331&ocid=3DPID24727::T:WLMTAGL:ON:WL:=
en-US:WWL_WIN_evergreen:112009=

_______________________________________________
MediaWiki-l mailing list
MediaWiki-l[at]lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l


Platonides at gmail

Nov 7, 2009, 12:09 PM

Post #4 of 11 (485 views)
Permalink
Re: Converting "_" to "%20" in file:/// url [In reply to]

Kushal Koolwal wrote:
>> Plase note that file urls don't work on some browsers like Firefox.
>> There're workarounds and extensions but file:/// urls usually give
>> problems.
> Hmm that interesting. So you mean there are other ways (besides file:///) b=
> y which we can link to files on the windows shared network drives? Can you =
> please point out what those methods (or extension) would be?
>
> Right now, the file linking and the spaces to %20 conversion is the bigge=
> st hurdle we are having to adopt the wiki into our systems.

http://kb.mozillazine.org/Links_to_local_pages_do_not_work

The way to make sure it will always work would be by setting a http
server serving the contents of the network drive.


_______________________________________________
MediaWiki-l mailing list
MediaWiki-l[at]lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l


kushalkoolwal at hotmail

Nov 9, 2009, 11:54 AM

Post #5 of 11 (468 views)
Permalink
Re: Converting "_" to "%20" in file:/// url [In reply to]

> http://kb.mozillazine.org/Links_to_local_pages_do_not_work
Yes, I am already aware of the FireFox issue.

> The way to make sure it will always work would be by setting a http
> server serving the contents of the network drive.
Yes, you are right. Ideally one should do this. But I don't think this is a possibility right now at our place and that's why we need to come up with a workaround.

One of the benefits of using a open source system like mediawiki is that we can customize it to make it fit into the system. So I am hoping that there ought to be some way by which we can fix the links automatically.






_________________________________________________________________
Hotmail: Trusted email with powerful SPAM protection.
http://clk.atdmt.com/GBL/go/177141665/direct/01/
_______________________________________________
MediaWiki-l mailing list
MediaWiki-l[at]lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l


Platonides at gmail

Nov 9, 2009, 3:17 PM

Post #6 of 11 (466 views)
Permalink
Re: Converting "_" to "%20" in file:/// url [In reply to]

Kushal Koolwal wrote:
>> http://kb.mozillazine.org/Links_to_local_pages_do_not_work
> Yes, I am already aware of the FireFox issue.
>
>> The way to make sure it will always work would be by setting a http
>> server serving the contents of the network drive.
> Yes, you are right. Ideally one should do this. But I don't think this is a possibility right now at our place and that's why we need to come up with a workaround.
>
> One of the benefits of using a open source system like mediawiki is that we can customize it to make it fit into the system. So I am hoping that there ought to be some way by which we can fix the links automatically.

Take
"file:///Z:/my project/data is really important for the company"
should that be a link to file:///Z:/my ? file:///Z:/my%20project/data?
file:///Z:/my%20project/data%20is%20really%20important ?
The space is a separator, and I don't think you can simply incorporate
all spaces into urls without breaking everything.


_______________________________________________
MediaWiki-l mailing list
MediaWiki-l[at]lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l


kushalkoolwal at hotmail

Nov 9, 2009, 4:49 PM

Post #7 of 11 (461 views)
Permalink
Re: Converting "_" to "%20" in file:/// url [In reply to]

<hda7v0$n84$1[at]ger.gmane.org>
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0


> Take
> "file:///Z:/my project/data is really important for the company"
> should that be a link to file:///Z:/my ? file:///Z:/my%20project/data?
> file:///Z:/my%20project/data%20is%20really%20important ?
> The space is a separator=2C and I don't think you can simply incorporate
> all spaces into urls without breaking everything.

I am not sure if I understood your question completely but let me explain t=
his with an example:

Say I have a file link in my wikitext as:
file:///Z:/my project/data is really important for the company.pdf

and I would it to convert automatically as:
file:///Z:/my%20project/data%20is%20really%20important%20for%20the%20compan=
y.pdf

So basically all the "spaces" are converted to "%20".

Kushal Koolwal

I do blog at http://blogs.koolwal.net/

=20
_________________________________________________________________
Hotmail: Trusted email with Microsoft's powerful SPAM protection.
http://clk.atdmt.com/GBL/go/177141664/direct/01/
http://clk.atdmt.com/GBL/go/177141664/direct/01/

_______________________________________________
MediaWiki-l mailing list
MediaWiki-l[at]lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l


roman at jct

Nov 9, 2009, 9:14 PM

Post #8 of 11 (458 views)
Permalink
Re: Converting "_" to "%20" in file:/// url [In reply to]

an improvement:

write a template called "f" (for "file) that will automatically added
the "file:///" (or "file:///Z:") at the beginning. Then your users
will type something like:

{{f|Z:/my project/final results.pdf}}

Less to type, and you don't have to keep track of how many slashes you
put after the "file:".
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Haim (Howard) Roman
Computer Center, Jerusalem College of Technology
Phone: 052-8-592-599 (6022 from within Machon Lev)


On Fri, Nov 6, 2009 at 20:57, Kushal Koolwal <kushalkoolwal[at]hotmail.com> wrote:
...
> Right now I am using string replacement extension and created a template called "Delspace" with following function:
>
> {{#replace:{{{1}}}| |%20}}
>
> and I am using the template in our wiki articles like this (for example):
> [{{delspace|file///Z:/my project/final results.pdf}} Link to results.pdf]

_______________________________________________
MediaWiki-l mailing list
MediaWiki-l[at]lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l


wolkwitz at fh-swf

Nov 9, 2009, 11:04 PM

Post #9 of 11 (458 views)
Permalink
Re: Converting "_" to "%20" in file:/// url [In reply to]

Hi Kushal,

have you thought about using the filelink-Extension?

With that extension, your users can choose which file the want to make a link to
and the extension does the rest...

Greetings
Katharina

Kushal Koolwal schrieb am 06.11.2009 19:57:
> MediaWiki: 1.12
> Host OS: Linux
>
> Most of our intranet mediawiki users are very non-technical. We link to a lot of file that resides on Windows shared network drive in our mediawiki articles. There are hundreds and hundreds of such files. These files and their paths have "spaces" in them which needs to be converted into their ASCII equivalent of "%20".
>
> Using {{urlencode}} does not work because it converts "spaces" into "+" character according to RFC1738.
>
> Right now I am using string replacement extension and created a template called "Delspace" with following function:
>
> {{#replace:{{{1}}}| |%20}}
>
> and I am using the template in our wiki articles like this (for example):
> [{{delspace|file///Z:/my project/final results.pdf}} Link to results.pdf]
>
> The above works but as I mentioned before, most of the users are non-technical (word doc types) and it is kind of cumbersome for them to use the above template every time they need to put a link to a document.
>
> So my question(s) is:
> 1. Basically I am looking for is a way in which the users won't have to
> use the template manually every time they need to put a link to a
> document which have "spaces".
>
>
> 2. Alternatively, is there a way by which all the file:/// urls in a wiki article which have "spaces" get automatically converted into proper urls (with %20 instead of "spaces") when the user hits the "Save Page" button?
>
> Any other better solution is also welcomed.
>
> Kushal Koolwal
>
> I do blog at http://blogs.koolwal.net/

_______________________________________________
MediaWiki-l mailing list
MediaWiki-l[at]lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l


Platonides at gmail

Nov 10, 2009, 3:46 PM

Post #10 of 11 (435 views)
Permalink
Re: Converting "_" to "%20" in file:/// url [In reply to]

Kushal Koolwal wrote:
>> Take
>> "file:///Z:/my project/data is really important for the company"
>> should that be a link to file:///Z:/my ? file:///Z:/my%20project/data?
>> file:///Z:/my%20project/data%20is%20really%20important ?
>> The space is a separator=2C and I don't think you can simply incorporate
>> all spaces into urls without breaking everything.
>
> I am not sure if I understood your question completely but let me explain t=
> his with an example:
>
> Say I have a file link in my wikitext as:
> file:///Z:/my project/data is really important for the company.pdf
>
> and I would it to convert automatically as:
> file:///Z:/my%20project/data%20is%20really%20important%20for%20the%20compan=
> y.pdf
>
> So basically all the "spaces" are converted to "%20".
>
> Kushal Koolwal

I understood that. But I also think you don't want
"file:///Z:/my project/data is really important for the company.pdf
(created by the boss)" to convert automatically to
"file:///Z:/my%20project/data%20is%20really%20important%20for%20the%20company.pdf%20created%20by%20the%20boss)"

Really, using a template passing the filename as a parameter, as i
mentioned at the beginning, and Haim is now resuggesting, is the way to go.


_______________________________________________
MediaWiki-l mailing list
MediaWiki-l[at]lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l


kushalkoolwal at hotmail

Nov 10, 2009, 5:56 PM

Post #11 of 11 (433 views)
Permalink
Re: Converting "_" to "%20" in file:/// url [In reply to]

<4AF91098.3090706[at]fh-swf.de>
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0


Katharina=2C

Thanks for pointing that extension. Looks like it will do what I want to do=
=2C specially about the dialog box that pops out to ask you which file you =
want to link to. However when I installed it as per the instructions [1]=2C=
I am getting "HTTP 500 Internal server Error" as soon as I try to access m=
y main wiki page - basically it breaks the entire wiki. As soon as I disabl=
e it (comment out in LocalSettings.php)=2C I no longer get the 500 error.

I also noticed that this plugin is quite old and it uses "include" instead =
of the standard "require_once" in LocalSettings.php fie. I am using MediaWi=
ki 1.12.

Has anyone tried this extension before?

Also it looks like [2] is also a good alternative but I would ideally want =
a dialog box that opens which asks you to browse to the file that you want =
to link to as [1] suggests it would do that.


[1] http://www.mediawiki.org/wiki/Extension:FileLink
[2] http://www.mediawiki.org/wiki/Extension:FileProtocolLinks

Kushal Koolwal

I do blog at http://blogs.koolwal.net/
=20
_________________________________________________________________
Hotmail: Trusted email with powerful SPAM protection.
http://clk.atdmt.com/GBL/go/177141665/direct/01/=

_______________________________________________
MediaWiki-l mailing list
MediaWiki-l[at]lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l

Wikipedia mediawiki RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.