From: Glenn Hutchings Date: Mon, 18 Apr 2016 16:44:34 +0000 (+0100) Subject: Fix up action list in Appendix A. X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=dc7fec99d92b670126e1e73e05df8f60706edc2d;p=ibg.git Fix up action list in Appendix A. --- diff --git a/appendices/a.rst b/appendices/a.rst index 8bcbbb0..4d51c88 100644 --- a/appendices/a.rst +++ b/appendices/a.rst @@ -40,71 +40,7 @@ occasionally, IN and OUT. There is quite an impressive stock of standard actions which can generally be relied upon to do something, even if only to tell you that you're wasting your time: -.. todo:: - - These columns aren't coming through in the PDF version. - -.. hlist:: - :columns: 5 - - * ASK - * BURN - * BUY - * CLEAN - * CLIMB - * CLOSE - * CUT - * DIG - * DISROBE - * DRINK - * DROP - * EAT - * EMPTY - * ENTER - * EXAMINE - * EXIT - * FILL - * GIVE - * GO - * INSERT - * INVENTORY - * JUMP - * KILL - * KISS - * LISTEN - * LOCK - * LOOK - * OFF - * ON - * OPEN - * PRAY - * PULL - * PUSH - * PUT - * READ - * SEARCH - * SHOW - * SING - * SIT - * SLEEP - * SMELL - * STAND - * SWIM - * SWITCH - * SWITCH - * TAKE - * TASTE - * TELL - * THINK - * THROW - * TIE - * TOUCH - * TRANSFER - * TURN - * UNLOCK - * WAIT - * WAVE - * WEAR +.. include:: /tables/actions.rst You don't have to play IF with a list like this open in front of you; the idea is that a good game should understand whatever seems logical for you diff --git a/conf.py b/conf.py index c153fcb..ec350ae 100644 --- a/conf.py +++ b/conf.py @@ -90,7 +90,7 @@ language = None # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. -exclude_patterns = ['config', 'output'] +exclude_patterns = ['config', 'output', 'tables'] # The reST default role (used for this markup: `text`) to use for all # documents. diff --git a/tables/actions.rst b/tables/actions.rst new file mode 100644 index 0000000..e6b5c57 --- /dev/null +++ b/tables/actions.rst @@ -0,0 +1,33 @@ +.. Autogenerated by wordtable.py -- do not edit! + +.. raw:: html + + + + + + + + + + + + +
ASK DROP INVENTORYPUSH SWIM TRANSFER
BURN EAT JUMP PUT SWITCH OFFTURN
BUY EMPTY KILL READ SWITCH ON UNLOCK
CLEAN ENTER KISS SEARCHTAKE WAIT
CLIMB EXAMINELISTEN SHOW TASTE WAVE
CLOSE EXIT LOCK SING TELL WEAR
CUT FILL LOOK SIT THINK
DIG GIVE OPEN SLEEP THROW
DISROBEGO PRAY SMELL TIE
DRINK INSERT PULL STAND TOUCH
+ +.. raw:: latex + + \begin{tabular}{llllll} + \hline + ASK & DROP & INVENTORY & PUSH & SWIM & TRANSFER \\ + BURN & EAT & JUMP & PUT & SWITCH OFF & TURN \\ + BUY & EMPTY & KILL & READ & SWITCH ON & UNLOCK \\ + CLEAN & ENTER & KISS & SEARCH & TAKE & WAIT \\ + CLIMB & EXAMINE & LISTEN & SHOW & TASTE & WAVE \\ + CLOSE & EXIT & LOCK & SING & TELL & WEAR \\ + CUT & FILL & LOOK & SIT & THINK & \\ + DIG & GIVE & OPEN & SLEEP & THROW & \\ + DISROBE & GO & PRAY & SMELL & TIE & \\ + DRINK & INSERT & PULL & STAND & TOUCH & \\ + \hline + \end{tabular} diff --git a/tables/actions.txt b/tables/actions.txt new file mode 100644 index 0000000..ad7a4eb --- /dev/null +++ b/tables/actions.txt @@ -0,0 +1,56 @@ +ASK +BURN +BUY +CLEAN +CLIMB +CLOSE +CUT +DIG +DISROBE +DRINK +DROP +EAT +EMPTY +ENTER +EXAMINE +EXIT +FILL +GIVE +GO +INSERT +INVENTORY +JUMP +KILL +KISS +LISTEN +LOCK +LOOK +OPEN +PRAY +PULL +PUSH +PUT +READ +SEARCH +SHOW +SING +SIT +SLEEP +SMELL +STAND +SWIM +SWITCH OFF +SWITCH ON +TAKE +TASTE +TELL +THINK +THROW +TIE +TOUCH +TRANSFER +TURN +UNLOCK +WAIT +WAVE +WEAR diff --git a/tables/wordtable.py b/tables/wordtable.py new file mode 100644 index 0000000..b034b70 --- /dev/null +++ b/tables/wordtable.py @@ -0,0 +1,41 @@ +""" +Convert word table to various other formats. + +Needs tabulate (https://pypi.python.org/pypi/tabulate). + +Usage: python wordtable.py actions.txt > actions.rst +""" + +import sys +from tabulate import tabulate + + +def tabledata(data, rows=10): + padding = rows - (len(data) % rows) + values = list(data) + [None] * padding + for row in range(rows): + yield [values[idx] for idx in range(row, len(values), rows)] + + +def writetable(words, formats): + table = list(tabledata(words)) + print ".. Autogenerated by wordtable.py -- do not edit!" + + for fmt in formats: + output = tabulate(table, tablefmt=fmt) + + print + print ".. raw::", fmt + print + for line in output.split("\n"): + print " ", line + + +if __name__ == "__main__": + import fileinput + + words = [] + for word in fileinput.input(): + words.append(word.strip()) + + writetable(words, formats=['html', 'latex'])