markup extensions: wiki links

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

markup extensions: wiki links

FreeAll Support
Hello all!

I am currently making few markup extensions, and I noticed a problem:

Let's say my extension tries to type the same word but in pink. Well, what I
want is something like that:

Writing: "<pinky>Bla Bla [[something]]</pinky>"
Will give me "Bla Bla SOMETHING" where something is a link.
What I get instead is "Bla Bla [[something]]" with no link.

I should have seen it happening, but I still don't have a clue how to do it
otherwise.

I can use a replace function that makes "[[" a "<a href=...>" and "]]" a
"</a>", but it won't do well. All of the links will be blue (even if no
content is inside) and it won't handle well with typing mistakes as
"[[something]". And it's barbaric.

I just want to keep the wiki links as they are, just like the
"<big>[[something]]</big>" does. Can I imitate it somehow?

(main reason for me to do all this is to write an extension that replaces
all specific words within a text with wiki-linked expressions. i.e.:
"<makelinks>bla bla something bla bla</makelinks>" will return something
equal to "bla bla [[something]] bla bla".)

Any core functions I can include to do this?

Glad to hear any ideas!

Peleg.

_______________________________________________
MediaWiki-l mailing list
[hidden email]
http://mail.wikipedia.org/mailman/listinfo/mediawiki-l
Reply | Threaded
Open this post in threaded view
|

Re: markup extensions: wiki links

Rob Church
On 28/05/06, FreeAll Support <[hidden email]> wrote:

> Hello all!
>
> I am currently making few markup extensions, and I noticed a problem:
>
> Let's say my extension tries to type the same word but in pink. Well, what I
> want is something like that:
>
> Writing: "<pinky>Bla Bla [[something]]</pinky>"
> Will give me "Bla Bla SOMETHING" where something is a link.
> What I get instead is "Bla Bla [[something]]" with no link.
>
> I should have seen it happening, but I still don't have a clue how to do it
> otherwise.

Your parser hook is passed a third argument; a reference to the
calling parser. Use it to parse wiki markup further before passing it
back out as HTML. Be careful that you don't end up causing recursion
when doing so.


Rob Church
_______________________________________________
MediaWiki-l mailing list
[hidden email]
http://mail.wikipedia.org/mailman/listinfo/mediawiki-l
Reply | Threaded
Open this post in threaded view
|

Re: markup extensions: wiki links

FreeAll Support
In reply to this post by FreeAll Support
Are there any examples of it somewhere?

Any documentation?

Thanks,
Peleg.

====
Rob wrote:

" Your parser hook is passed a third argument; a reference to the calling
parser. Use it to parse wiki markup further before passing it back out as
HTML. Be careful that you don't end up causing recursion when doing so."

_______________________________________________
MediaWiki-l mailing list
[hidden email]
http://mail.wikipedia.org/mailman/listinfo/mediawiki-l
Reply | Threaded
Open this post in threaded view
|

Re: markup extensions: wiki links

Rob Church
On 29/05/06, FreeAll Support <[hidden email]> wrote:
> Are there any examples of it somewhere?

Look at stuff like Cite, the code for which is in SVN.


Rob Church
_______________________________________________
MediaWiki-l mailing list
[hidden email]
http://mail.wikipedia.org/mailman/listinfo/mediawiki-l
Reply | Threaded
Open this post in threaded view
|

Re: markup extensions: wiki links

Bugzilla from sy1234@gmail.com
In reply to this post by FreeAll Support
On 5/28/06, FreeAll Support <[hidden email]> wrote:
> I can use a replace function that makes "[[" a "<a href=...>" and "]]" a
> "</a>", but it won't do well. All of the links will be blue (even if no
> content is inside)

Just a note.. for colouring links, the colouration has to be set
inside the link like [[link|<font color="red">link</font>]]

You'd have to make your extension pretty smart to let people do
<extension>red text [[red link]]</extension>
_______________________________________________
MediaWiki-l mailing list
[hidden email]
http://mail.wikipedia.org/mailman/listinfo/mediawiki-l
Reply | Threaded
Open this post in threaded view
|

Re: markup extensions: wiki links

Bugzilla from sy1234@gmail.com
Also, another quicky.. I use a template for easier colouring, so I do this:

{{red|some red text}}

where Template:red is:

<font color="red">{{{1}}}</font>

which has been useful for me..
_______________________________________________
MediaWiki-l mailing list
[hidden email]
http://mail.wikipedia.org/mailman/listinfo/mediawiki-l