Wikihack
Advertisement

This file needs line numbers! --ZeroOne 17:49, 13 August 2006 (UTC)

perl -i.bak -ple '$_ = sprintf "%-4s%s", ++$i . ".", $_ if /^\s/' file.wiki
It's not perfect, but probably quite good enough. You'll need to tweak the 4 for however many digits the largest line number has. Eidolos 18:09, 13 August 2006 (UTC)
Ah, but Jayt has a source wikification script made in Python. It includes some html-code to make the lines linkable. But as it happens, I haven't got a Python environment in my use. --ZeroOne 18:45, 13 August 2006 (UTC)
Good point, I forgot about line linking. I'll run objects.c through Jayt's wikification script. Eidolos 18:49, 13 August 2006 (UTC)
perl -i.bak -ple '$_ = sprintf " <span id=\"line%d\">%-6s%s</span>", ++$i, "$i.", $_ if /^\s/' file.wiki
Now it's much closer to Jayt's script (even in how it justifies), but it's more for adding line numbers to existing wiki pages rather than wikifying NetHack source (a task for which there already exists a fine script). Eidolos 19:02, 13 August 2006 (UTC)
Advertisement