Fix up action list in Appendix A.
authorGlenn Hutchings <zondo42@gmail.com>
Mon, 18 Apr 2016 16:44:34 +0000 (17:44 +0100)
committerGlenn Hutchings <zondo42@gmail.com>
Mon, 18 Apr 2016 16:44:34 +0000 (17:44 +0100)
appendices/a.rst
conf.py
tables/actions.rst [new file with mode: 0644]
tables/actions.txt [new file with mode: 0644]
tables/wordtable.py [new file with mode: 0644]

index 8bcbbb0d5264fc3bd4d0d7658c7b3b2e8bdfab60..4d51c887e719d5a54341361ebc1be7f97e5a1e79 100644 (file)
@@ -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 c153fcb67f56d87737181daf79676e9a14c2926f..ec350aeb1feaf2d43598d8790b40e37a4d4ba997 100644 (file)
--- 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 (file)
index 0000000..e6b5c57
--- /dev/null
@@ -0,0 +1,33 @@
+.. Autogenerated by wordtable.py -- do not edit!\r
+\r
+.. raw:: html\r
+\r
+   <table>\r
+   <tr><td>ASK    </td><td>DROP   </td><td>INVENTORY</td><td>PUSH  </td><td>SWIM      </td><td>TRANSFER</td></tr>\r
+   <tr><td>BURN   </td><td>EAT    </td><td>JUMP     </td><td>PUT   </td><td>SWITCH OFF</td><td>TURN    </td></tr>\r
+   <tr><td>BUY    </td><td>EMPTY  </td><td>KILL     </td><td>READ  </td><td>SWITCH ON </td><td>UNLOCK  </td></tr>\r
+   <tr><td>CLEAN  </td><td>ENTER  </td><td>KISS     </td><td>SEARCH</td><td>TAKE      </td><td>WAIT    </td></tr>\r
+   <tr><td>CLIMB  </td><td>EXAMINE</td><td>LISTEN   </td><td>SHOW  </td><td>TASTE     </td><td>WAVE    </td></tr>\r
+   <tr><td>CLOSE  </td><td>EXIT   </td><td>LOCK     </td><td>SING  </td><td>TELL      </td><td>WEAR    </td></tr>\r
+   <tr><td>CUT    </td><td>FILL   </td><td>LOOK     </td><td>SIT   </td><td>THINK     </td><td>        </td></tr>\r
+   <tr><td>DIG    </td><td>GIVE   </td><td>OPEN     </td><td>SLEEP </td><td>THROW     </td><td>        </td></tr>\r
+   <tr><td>DISROBE</td><td>GO     </td><td>PRAY     </td><td>SMELL </td><td>TIE       </td><td>        </td></tr>\r
+   <tr><td>DRINK  </td><td>INSERT </td><td>PULL     </td><td>STAND </td><td>TOUCH     </td><td>        </td></tr>\r
+   </table>\r
+\r
+.. raw:: latex\r
+\r
+   \begin{tabular}{llllll}\r
+   \hline\r
+    ASK     & DROP    & INVENTORY & PUSH   & SWIM       & TRANSFER \\\r
+    BURN    & EAT     & JUMP      & PUT    & SWITCH OFF & TURN     \\\r
+    BUY     & EMPTY   & KILL      & READ   & SWITCH ON  & UNLOCK   \\\r
+    CLEAN   & ENTER   & KISS      & SEARCH & TAKE       & WAIT     \\\r
+    CLIMB   & EXAMINE & LISTEN    & SHOW   & TASTE      & WAVE     \\\r
+    CLOSE   & EXIT    & LOCK      & SING   & TELL       & WEAR     \\\r
+    CUT     & FILL    & LOOK      & SIT    & THINK      &          \\\r
+    DIG     & GIVE    & OPEN      & SLEEP  & THROW      &          \\\r
+    DISROBE & GO      & PRAY      & SMELL  & TIE        &          \\\r
+    DRINK   & INSERT  & PULL      & STAND  & TOUCH      &          \\\r
+   \hline\r
+   \end{tabular}\r
diff --git a/tables/actions.txt b/tables/actions.txt
new file mode 100644 (file)
index 0000000..ad7a4eb
--- /dev/null
@@ -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 (file)
index 0000000..b034b70
--- /dev/null
@@ -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'])