Home » Text » Text_Wiki_Mediawiki » Bug #9309
Patch for pear/Text_Wiki/Text/Wiki/Parse/Mediawiki/Url.php
Details
| Request #9309 | Patch for pear/Text_Wiki/Text/Wiki/Parse/Mediawiki/Url.php |
|---|---|
| Submitted | 2006-11-11 20:48 UTC |
| From | outtatime at gmail dot com |
| Assigned | ritzmo |
| Status | Bogus |
| Package | Text_Wiki_Mediawiki |
| PHP Version | 5.1.6 |
| OS | OpenSuse 10.1 |
| Roadmaps | (Not assigned) |
Comments
[2006-11-11 20:48 UTC] outtatime at gmail dot com
Description:
------------
The diff.txt for this patch can be found at the following URL: http://jetlib.com/code/pear/2006_11-mediawiki/
File in question (to be modified):
pear/Text_Wiki/Text/Wiki/Parse/Mediawiki/Url.php
Verbose Explanation:
====================
This simple change consists of appending a single entry to the schemes
array which makes it possible for Mediawiki to parse links which use the
following syntax:
[//pear.php.net Pear::Homepage]
The W3C document which discusses the resolution of partial URLs can be found
at http://www.w3.org/Addressing/URL/4_3_Partial.html. The portion of this
document which is relevant for the purposes of this patch is the following
statement:
``If the scheme parts are different, the whole absolute URI must be given.
Otherwise, the scheme is omitted, ..``
The URL definition (from the official W3 specifications) seems to support
legitimacy of the aforementioned document as it states that it does not
define the resolution of fragmented or partial URLs. This document can be
found at http://www.w3.org/Addressing/URL/url-spec.txt. The specific quote
is:
``Fragment identifiers and partial URLs are not involved in the basic
URL definition.``
Examples:
=========
If we were presently at https://example.com/index.php, and this page
renders a Mediawiki link which has the wiki form of
"[//images.example.com/hello.jpg]", the specification would dictate that the
URI resolve to https://images.example.com/hello.jpg.
As a supplementary example, if we were presently at
http://example.com/index.php, and this page renders a Mediawiki link which
has the wiki form of "[//images2.example.com/hello2.jpg]", the specification
would dictate that the URI resolve to http://images2.example.com/hello2.jpg.
Testing Methodology:
====================
I am basically proposing that we add the ability to omit the scheme from a
url to be able to inherit from the proper document. I have verified that
this works as described in the examples above through testing on my own
apache webserver. My tests concluded that if one is to use a url in an
xhtml document which has the form of:
"//fully.qualified.ip.org.dns.entry/resource/specific_one", the url scheme
gets inherited from whatever scheme the document was accessed with (I tested
that this works for both Internet Explorer 6 and Firefox 1.5). Testing was
performed by executing queries equivalent to the examples and then checking
the logs to verify the appropriate scheme had been used each time.
Optional Reading:
=================
And for those of you who may be interested in this kind of thing, I found
http://www.w3.org/DesignIssues/Axioms.html to be an interesting read
regarding URI schemes (even though the document appears to be a decade old
by now and is not official).
Final Thoughts:
===============
This is my first patch, so please forgive the general excessiveness and/or
any wrongdoing on my part. I have put forth my best effort to follow the
protocol outlined at http://pear.php.net/manual/en/contributing.patches.php.
I welcome constructive feedback regarding how I can improve any future
patches.
Thanks,
Jay
Test script:
---------------
Both the .php and .phps files which demonstrate what is possible with the proposed changed can be seen at the following URL: http://jetlib.com/code/pear/2006_11-mediawiki/
Expected result:
----------------
Well, this is a feature request...without the patch applied the url will obviously not be parsed ;)
Actual result:
--------------
The expected output (after the patch) is: http://jetlib.com/code/pear/2006_11-mediawiki/expected_output.txt
[2006-11-11 21:19 UTC] ritzmo at php dot net
First, sorry for not responding to your E-Mail.
Had some busy days ;-)
The patch would be ok as it is, but I'm not quite sure if I want to apply it to the CVS, as the package actually tries to be compliant with the Mediawiki-Syntax and this does not include your proposed change.
[2006-11-18 23:06 UTC] outtatime at gmail dot com
Moritz Venn wrote:
> The patch would be ok as it is, but I'm not quite sure if I
> want to apply it to the CVS, as the package actually tries
> to be compliant with the Mediawiki-Syntax and this does not
> include your proposed change.
Do you know where I can find the specifications for or a clear
description of the Mediawiki-syntax? I googled and was unable to find
anything beyond the mediawiki foundations help pages for new users.
Thank you,
Jay Taylor
[2006-11-21 10:53 UTC] ritzmo at php dot net
As the Package description says, we use these help pages (found at http://meta.wikimedia.org/wiki/Help:Editing#The_wiki_markup for clarification) for reference.
It is the best documentation besides the mediawiki paser-code (well, actually I think the documentation is way easier to read ;-)).