Wandering Thoughts archives


A Wikitext formatting mistake that I made here

There are a number of things about DWiki that I would change if I was writing it from scratch again. I'm not entirely sure that I'd completely replace its dialect of wikitext with a standard one such as Markdown, but there are certainly aspects of it that I would redo. In particular, one part of DWiki's wikitext dialect has turned out to be a terrible mistake.

You see, when I was designing my wikitext dialect, for some reason I decided that digits at the start of line should be one of the things that started a numbered list entry. No doubt this struck me as sensible at the time; it lets you write the vaguely traditional format of:

0 some numbered list
0 another entry on it
00 an inner numbered list
1 any number will do

(I may have copied this from somewhere or I may have thought it was a good thing to go along with the more common '#' at the start of lines.)

Then I started writing paragraphs with free-floating numbers in them, when for example I discuss 'Fedora 14' or '404 errors'. And reflowing the paragraphs. When you reflow paragraphs with free-floating numbers in them, at some point you are going to reflow a paragraph so that the number is at the start of a line. At that point my wikitext design mistake bit me in the rear, because the parser (such as it is) immediately declared the reflowed line to be the start of a numbered list.

(I've seen this issue bite people leaving comments, too.)

One of the things that this this says to me is that designing a wikitext dialect is hard partly because you don't necessarily find out your mistakes until you've started writing a substantial and varied amount of text in your new dialect, at which point it's difficult to change. (Well. Sort of. It's at least annoying.)

Another thing I take from this is that I really want to use some sort of real parser to parse wikitext, instead of hand built regexp-based processing. My hope is that using a real parser would make it easier to express things like 'numbered lists can't begin when you're in paragraph mode'.

(I have some vague opinions on why parsing wikitext is hard with traditional parsers, but it's possible that I just haven't seen the trick to doing it easily.)

(Probably someday I will bite the bullet by taking this 'feature' out of my wikitext parser, then finding and fixing all current pages that use it. So far that's been just a bit more annoying than living with the current situation.)

web/WikiTextMistake written at 00:36:18; Add Comment

Page tools: See As Normal.
Login: Password:
Atom Syndication: Recent Pages, Recent Comments.

This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.