On 2 Nov 2005 17:23:40 +0100, Patrick Gundlach pg@levana.de wrote:
question concerning markup/parser:
In a <pre> section, all markup is preserved (not interpreted), except for <nowiki>....</nowiki> tags. So
Isn't this inconsistent? Or is this intentional behaviour? I am asking, because I write a mediawiki markup parser in Ruby and like to get things 'right' (whatever that means).
Well, it's not inconsistent, exactly, it's just what you might call "markup precedence": because of the way the "parser" is coded, no 2 actions can happen "at the same time", and processing proceeds by type, not position, so combinations will only ever "happen" one way round.
If I remember the code rightly, <nowiki> tags are the very first thing to be processed, because by definition their content needs to be hidden from all other processing [looking, it seems only the optional <html> gets done earlier]. Presumably, <pre> gets processed straight after, since it has the same properties, but since it also acts as an HTML <pre>, it's not the same, so can't be done at *exactly* the same time. So <nowiki> ends up "having precedence over" <pre>, whichever way round you nest them; by the time the <pre> tags get processed, the <nowiki> has already been processed and vanished.
Admittedly, if you were designing the markup on logical grounds, that wouldn't make a whole lot of sense, but it's certainly expressable as a consistent rule.
-- Rowan Collins BSc [IMSoP]