[Wikitext-l] How to define <nowiki>?

Platonides platonides at gmail.com
Thu Nov 22 20:19:49 UTC 2007


Steve Bennett wrote:
> On 11/22/07, Mark Clements <gmane at kennel17.co.uk> wrote:
>> I think he means pass the contents of <nowiki> through htmlspecialchars()
>> before outputting.
> 
> Yes, but all that is assuming the <nowiki> is not embedded inside
> anything else. How should all the following behave:

IMHO <nowiki> means that its content loses its "magicness": it must 
appear literal (for the user, not in the page source).

So the following would produce links:
> [[<nowiki>image</nowiki>:foo.jpg]]
> [[image:<nowiki>foo</nowiki>.jpg]]
> [http://foo.com<nowiki></nowiki>bloot] (this one actually works
> currently, so my "token separator, not whitespace" comment may be
> wrong)

As you're stripping "magic powers" to words which are not part of a spell.
Note that nowiking the namespace can be controversial, as it's not clear 
if the power resides in the namespace or not. I think the magic is in 
the square brackets and it should still be rendered as usual. The other 
option would be to make it a normal link but it's better not to add such 
esoteric constructs without a need (but could be added if proved easier 
to be coded!).

However,
 > [[image:foo.jpg|<nowiki>right</nowiki>|thumb]]
has the text right as right loses its ability to align it.

> [<nowiki>http</nowiki>://foo.com]
This doesn't match the URL format so would render literally. If they 
were double square brackets, it'd make an internal link, as opposed to 
normal [<a href="http://foo.com">[1]</a>] without <nowiki>

> <nowiki><b></nowiki>bold</b>
We want a literal <b>, so output is &lt;b&gt;bold + an unmatching bold 
closing tag to ignore/produce a warning.

> <b <nowiki>style="bloot;"</nowiki>

You call tag <b> with parameter 'style="bloot;"'. As tags don't get 
parameters separated by spaces, it's ignored(warning).

> etc etc.
> 
> Steve



More information about the Wikitext-l mailing list