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.
On 28/05/06, FreeAll Support support@freeall.org 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
On 5/28/06, FreeAll Support support@freeall.org 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>
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@lists.wikimedia.org