Difference between revisions of "User:Jayt"
(→What I'm up to: I'll be away until next Tuesday) |
(→Source wikification script: even better spaghetti code!) |
||
Line 78: | Line 78: | ||
<pre> | <pre> | ||
#!/usr/bin/python | #!/usr/bin/python | ||
− | #version | + | #version 20061002 |
− | # usage: ./wikify.py sourcefile.c | + | # usage: ./wikify.py sourcefile.c |
# the first line of output will be the article title, for use with | # the first line of output will be the article title, for use with | ||
# an uploadbot | # an uploadbot | ||
#config: | #config: | ||
− | gamename = "NetHack" | + | outputdir="/home/user/somewhere/" # where to put the wikified file |
− | uploadversion = "3.4. | + | gamename = "NetHack" # NetHack or Hack or SLASH'EM |
− | latestversion = "3.4.3" # | + | uploadversion = "3.4.3" # 1.3d/2.3e/3.1.0/3.4.3/etc. |
− | license = "NGPL" | + | latestversion = "3.4.3" # 3.4.3 or 0.0.7E7F2 |
+ | license = "NGPL" # NGPL or CWI | ||
## | ## | ||
− | import sys | + | import sys, re |
+ | |||
srcfile = sys.argv[1] | srcfile = sys.argv[1] | ||
+ | |||
f = open(srcfile) | f = open(srcfile) | ||
+ | g = open(outputdir + srcfile, "w") | ||
i=1 | i=1 | ||
− | if uploadversion != latestversion: | + | if uploadversion != latestversion or gamename=="SLASH'EM": |
wikilink = gamename + ' ' + uploadversion + '/' + srcfile | wikilink = gamename + ' ' + uploadversion + '/' + srcfile | ||
srccodelink = '[[' + gamename + ' ' + uploadversion + \ | srccodelink = '[[' + gamename + ' ' + uploadversion + \ | ||
Line 101: | Line 105: | ||
+ ' ' + "source code|" + srcfile + "]]" | + ' ' + "source code|" + srcfile + "]]" | ||
oldwarning = "'''Warning!''' This is the source code from an old \ | oldwarning = "'''Warning!''' This is the source code from an old \ | ||
− | release. For the latest release, see [[Source code]]\n" | + | release. For the latest release, see [[Source code]].\n\n" |
else: | else: | ||
wikilink = srcfile | wikilink = srcfile | ||
Line 108: | Line 112: | ||
oldwarning = '' | oldwarning = '' | ||
− | print wikilink | + | if gamename == "SLASH'EM": |
− | print "Below is the full text to '''" + srcfile + "''' from the "\ | + | oldwarning = '' |
+ | if uploadversion != latestversion: | ||
+ | oldwarning = "'''Warning!''' This is the source code\ | ||
+ | from an old release. For the latest release, see [[SLASH'EM "\ | ||
+ | +latestversion+" source code]].\n\n" | ||
+ | slashwarning = "The latest source code for vanilla NetHack is \ | ||
+ | at [[Source code]].\n\n" | ||
+ | else: | ||
+ | slashwarning = '' | ||
+ | |||
+ | print >> g, wikilink | ||
+ | print >> g, "Below is the full text to '''" + srcfile + "''' from the "\ | ||
+ srccodelink + " of [[" \ | + srccodelink + " of [[" \ | ||
+ gamename + ' ' + uploadversion + ']]. To link to a particular line, \ | + gamename + ' ' + uploadversion + ']]. To link to a particular line, \ | ||
Line 115: | Line 130: | ||
'#line123]]</nowiki>]], for example.\n' | '#line123]]</nowiki>]], for example.\n' | ||
− | print oldwarning | + | print >> g, oldwarning + slashwarning |
− | print "{{" + license + "}}" | + | print >> g, "{{" + license + "}}" |
for line in f.readlines(): | for line in f.readlines(): | ||
− | + | wikiline = (str(i) + '.').ljust(6)+line.rstrip("\n") | |
− | (str(i) + '.').ljust(6)+line.rstrip("\n")+'</span>' | + | if re.search("{{",line): |
− | + | wikiline = '<nowiki>'+wikiline+'</nowiki>' | |
+ | print >> g, ' <span id="line' + str(i) + '">'+wikiline\ | ||
+ | +'</span>' | ||
+ | i += 1 | ||
− | print catlink | + | print >> g, catlink |
</pre> | </pre> | ||
Line 133: | Line 151: | ||
Updated to handle old source code files. --[[User:Jayt|Jayt]] 11:51, 31 August 2006 (UTC) | Updated to handle old source code files. --[[User:Jayt|Jayt]] 11:51, 31 August 2006 (UTC) | ||
+ | |||
+ | Updated to handle SLASH'EM and files containing <nowiki>{{</nowiki> --[[User:Jayt|Jayt]] 19:03, 2 October 2006 (UTC) |
Revision as of 19:03, 2 October 2006
Hi fellow hackers! I'm jmst on nethack.alt.org, and an admin here.
Contents
What I'm up to
I'm happy with the way the wiki is going - lots of good people are adding good stuff. My vision is for Wikihack to be a Total Spoiler - a one-stop repository of all of humanity's knowledge of NetHack - as well as a venue for an emerging field of scholarly NetHack analysis :-) My secret desire is that it one day becomes bigger than Wikipedia.
2006/09/15: Travelling until next Tuesday. Tata for now!
2006/08/05: On a redirection binge. Trying to pre-empt duplicate articles.
Previously...
The weather has been too nice for ASCII this week, but the subsequent thunderstorms finally drove me back inside and I'm planning to ascend a rather bedraggled Monk.
- Result: he died on the thrice-accursed Plane of Air! Moral: Defence is only half the equation: you've got to be able to kill 'em. --Jayt 19:08, 4 August 2006 (UTC)
Scorecard
Date | Char | Score | Turns | Conducts |
---|---|---|---|---|
2004/02/29 | Val Hum Mal Law | 5167362 | 85417 | aw |
2004/06/08 | Wiz Elf Fem Cha | 5014828 | 62397 | aw,ps |
2004/11/30 | Pri Elf Mal Cha | 3566624 | 73989 | aw,ps,s |
2004/12/08 | Tou Hum Mal Neu | 9245501 | 74318 | aw,s |
2004/12/17 | Kni Hum Mal Law | 4394088 | 56715 | aw,p,ps,s |
2004/12/18 | Bar Hum Fem Neu | 8916782 | 118767 | aw,s |
2004/12/27 | Sam Hum Mal Law | 4142714 | 50476 | aw,s |
2005/01/19 | Arc Hum Mal Law | 2564564 | 35709 | aw,p,ps,s |
2005/01/22 | Ran Elf Mal Cha | 3638114 | 51113 | aw,ps,s |
2005/01/28 | Cav Dwa Fem Law | 3879664 | 42900 | aw,ps,s |
2005/02/15 | Rog Hum Mal Cha | 2518054 | 40832 | aw,ps,s |
2005/02/20 | Mon Hum Fem Neu | 2725664 | 31920 | aw,ps |
2005/02/23 | Hea Gno Mal Neu | 3239812 | 46553 | aw,p,ps,s |
2005/03/17 | Val Dwa Fem Law | 3315062 | 43018 | aw,g,p,ps,vg,w,s |
2005/10/21 | Wiz Elf Mal Cha | 3348070 | 52493 | aw,g,p,ps,w,s |
2006/02/26 | Bar Hum Mal Cha | 2902394 | 42906 | ps,s |
2006/06/28 | Wiz Hum Mal Neu | 1607752 | 22910 | p,ps,s |
2006/07/04 | Rog Orc Fem Cha | 2550726 | 40404 | aw,g,p,ps,w |
2006/07/20 | Pri Hum Mal Law | 4339290 | 68745 | a,i,g,p |
- a = atheist
- aw = artifact wishless
- g = genocideless
- i = illiterate
- p = polyless
- ps = polyselfless
- vg = vegan
- w = wishless
- s = survivor (I know, not a real conduct)
Old stuff
Completeness
Here are my thoughts on completeness
Source wikification script
#!/usr/bin/python #version 20061002 # usage: ./wikify.py sourcefile.c # the first line of output will be the article title, for use with # an uploadbot #config: outputdir="/home/user/somewhere/" # where to put the wikified file gamename = "NetHack" # NetHack or Hack or SLASH'EM uploadversion = "3.4.3" # 1.3d/2.3e/3.1.0/3.4.3/etc. latestversion = "3.4.3" # 3.4.3 or 0.0.7E7F2 license = "NGPL" # NGPL or CWI ## import sys, re srcfile = sys.argv[1] f = open(srcfile) g = open(outputdir + srcfile, "w") i=1 if uploadversion != latestversion or gamename=="SLASH'EM": wikilink = gamename + ' ' + uploadversion + '/' + srcfile srccodelink = '[[' + gamename + ' ' + uploadversion + \ ' source code|source code]]' catlink = "[[Category:" + gamename + ' ' + uploadversion\ + ' ' + "source code|" + srcfile + "]]" oldwarning = "'''Warning!''' This is the source code from an old \ release. For the latest release, see [[Source code]].\n\n" else: wikilink = srcfile srccodelink = '[[source code]]' catlink = "[[Category:Source code]]" oldwarning = '' if gamename == "SLASH'EM": oldwarning = '' if uploadversion != latestversion: oldwarning = "'''Warning!''' This is the source code\ from an old release. For the latest release, see [[SLASH'EM "\ +latestversion+" source code]].\n\n" slashwarning = "The latest source code for vanilla NetHack is \ at [[Source code]].\n\n" else: slashwarning = '' print >> g, wikilink print >> g, "Below is the full text to '''" + srcfile + "''' from the "\ + srccodelink + " of [[" \ + gamename + ' ' + uploadversion + ']]. To link to a particular line, \ write [[' + wikilink + '#line123|[[' + wikilink + \ '#line123]]]], for example.\n' print >> g, oldwarning + slashwarning print >> g, "{{" + license + "}}" for line in f.readlines(): wikiline = (str(i) + '.').ljust(6)+line.rstrip("\n") if re.search("{{",line): wikiline = ''+wikiline+'' print >> g, ' <span id="line' + str(i) + '">'+wikiline\ +'</span>' i += 1 print >> g, catlink
--Jayt 18:39, 12 June 2006 (UTC)
Updated to output better wikicode. --Jayt 21:56, 13 June 2006 (UTC)
Updated to handle old source code files. --Jayt 11:51, 31 August 2006 (UTC)
Updated to handle SLASH'EM and files containing {{ --Jayt 19:03, 2 October 2006 (UTC)