Indeed. Writing custom psuedo-namespaces is not easy. (I tried doing
it once with nil success.)
On Mon, 21 Mar 2005 17:30:53 +0000, Rowan Collins
<rowan.collins(a)gmail.com> wrote:
On Mon, 21 Mar 2005 10:36:36 -0600, Beans-v6
<beans_v6(a)the-beans.com> wrote:
I know that I could make 'Define' a
namespace, but how would I go about
making the namespace and customizing its code?
Some thoughts and pointers, in no particular order:
*
http://meta.wikimedia.org/wiki/Help:Custom_namespaces - although
namespaces oin general aren't really designed to behave completely
differently in this way, so you may be better off hacking Parser.php
(function replaceInternalLinks()) and Title.php, where the code
determines "what to do about" them.
* you might want to take a look at the template/inclusion code (some
of which is in Parser.php, I think, though maybe not all) since you'll
probably want to include the text of all the relevant target
("Define:") pages in the source (in the title attribute, or some more
controllable JavaScript pop-up).
* in fact, the feature "feels" more like a special case of inclusion
than linking to me, but that's kind of up to you
* the easier, though, less suited really, way of doing it is with an
extension tag (similar to the <math>...</math> pairs) - see
http://meta.wikimedia.org/wiki/Write_your_own_MediaWiki_extension
e.g., something which would make <define>page=foo; text=bar</define>
do what [[Define:Foo|Bar]] would in your example (if I understand you
right)
* finally, there's the "new style" extension code, event-and-hook
style, which may or may not let you insert something anywhere
appropriate, but is worth a mention - see docs/hooks.doc in your
install for details.
Sounds like an intriguing project, but not an easy one (the parsing
code, in particular, is notoriously ugly...) so happy hacking!
--
Rowan Collins BSc
[IMSoP]
_______________________________________________
MediaWiki-l mailing list
MediaWiki-l(a)Wikimedia.org
http://mail.wikipedia.org/mailman/listinfo/mediawiki-l