horrors2

Awful horror fiction
git clone https://git.woozle.org/neale/horrors2.git

commit
d086d3f
parent
c6d4a4c
author
cruft
date
2009-11-18 16:53:22 -0700 MST
Add /The Mirror/, and start at an ePub version
2 files changed,  +291, -0
A stories/A_Child_s_Letter.The_Mirror.tex
+88, -0
 1@@ -0,0 +1,88 @@
 2+\chapauth{A Child's Letter}
 3+\chapter{The Mirror}
 4+
 5+Luke Bavarious' eyes rolled around in their sockets, finally allowing
 6+him to focus again on the bathroom mirror. His Beretta still in hand, he
 7+wiped the few remaining flecks of sick from his mouth.
 8+
 9+{\em What can't I remember? I don't have any idea what I've,
10+  what's\ldots uggh!  Too much shitty tequila}, he concluded. Again, he
11+vomited.
12+
13+The reflection gazing back at him nodded even as Bavarious nodded.
14+
15+{\em I can't live like this! I'm a cop, dammit! I'm a cop! I'm a
16+  copI'macopI'macopI'macop}, he thought, his mind shrieking the mantra,
17+causing liquid rust to ooze from his flaring nostrils.
18+
19+The reflection gazing back at him blinked. Bavarious did not.
20+
21+{\em What the hell?!}
22+
23+Suddenly, rancid vomit streamed from the Bavarious in the mirror,
24+splattering the glass and causing the other to recoil. Bavarious
25+stepped---or stumbled, rather---back, raised his weapon, and aimed for
26+the reflection's chest.
27+
28+{\sc Boom!}
29+
30+Red pain arced across his frame moments after he pulled the
31+trigger. Shards of silvered glass protruded evilly from his hands and
32+chest, callously inviting Bavarious' tattered sports coat to greedily
33+lick away every spent drop of blood.
34+
35+On the other side of what had been the mirror, the ``reflection'' stood,
36+grinning lustily at its fallen doppelgänger.
37+
38+``Who\ldots what\ldots what are you!'' wondered Bavarious aloud.
39+
40+{\em I am you}, projected the specter as it placed a shaking withered
41+hand on either side of the mirror's frame and thrust an impossibly long
42+and spidery leg through the opening.
43+
44+``The {\em fuck} you are!'' shouted Bavarious, who fired three more
45+rounds into the advancing creature. As every mushrooming burst of metal
46+rage ripped into it, Bavarious felt as though {\em he} had been shot.
47+
48+``What are you {\em doing} to me!'' he roared, or tried to: his voice,
49+hoarse, weakly reverberated throughout the dismal room. His crimson
50+lifeforce spread out before him, pooling in a macabre circle.
51+
52+{\em What am I doing to you? The question, Luke, is what are you doing
53+  to you.}
54+
55+{\em I don't know what you're---shit, now {\em I'm} doing it---}
56+
57+``I don't know what you're talking about!''
58+
59+{\em I know}, it smiled as it injected itself into Baravious'
60+reality. {\em I know.}
61+
62+That's when Bavarious realized the smile wasn't one of joy or elation;
63+rather, it was one of rueful, inescapable sadness. The kind of smile one
64+smiles when, having done everything to avoid a foregone conclusion, the
65+conclusion looms inevitable.
66+
67+{\em I don't want to die}, whined Bavarious. {\em What do I do?}
68+
69+``You...die, Luke,'' it whispered.
70+
71+Gently---lovingly, it stroked Bavarious' cheek with its bony
72+fingers. With every tortured breath, Bavarious felt his body contort,
73+stretch out, become more like that of the entity now cradling his
74+convulsing head.
75+
76+Maybe it was a trick of the greenish ultraviolet light; maybe it was his
77+uncontrollable spasms, but Bavarious was almost---no, he was one hundred
78+percent positive that the monster was somehow {\em condensing},
79+coalescing: somehow, its thready arms and legs were gaining proportion
80+even as its previously gaunt features seemed to swell with health.
81+
82+Through the multifaceted, bloodstained reflection of a shattered
83+bathroom mirror, the last thing Bavarious ever saw was {\em himself}
84+reach down and collect his Beretta.
85+
86+{\em I'm a cop}, he sighed.
87+
88+``I'm a cop,'' he said aloud, tucking his sidearm within the confines of
89+his tattered sports coat and walking briskly from the room.
A toepub.py
+203, -0
  1@@ -0,0 +1,203 @@
  2+#! /usr/bin/env python3
  3+
  4+import re
  5+
  6+block1_re = re.compile(r'{\\(?P<cmd>[\w*]+) (?P<txt>[^{}]+)}')
  7+block2_re = re.compile(r'\\(?P<cmd>[\w*]+)(\[[^]]+\])?{(?P<txt>[^{}]*)}')
  8+
  9+
 10+chapauth = None
 11+chapimg = None
 12+display = True
 13+pfx = ''
 14+
 15+def texsub(m):
 16+    global pfx, display
 17+
 18+    cmd = m.group('cmd')
 19+    txt = m.group('txt')
 20+    if cmd == 'em':
 21+        return '<em>%s</em>' % txt
 22+    elif cmd == 'bf':
 23+        return '<strong>%s</strong>' % txt
 24+    elif cmd == 'sf':
 25+        return '<samp>%s</samp>' % txt
 26+    elif cmd == 'sc':
 27+        return '<span class="sc">%s</span>' % txt
 28+    elif cmd == 'rm':
 29+        return '<span class="rm">%s</span>' % txt
 30+    elif cmd == 'url':
 31+        return '<a href="%s">%s</a>' % (txt, txt)
 32+    elif cmd == 'begin':
 33+        if txt in ('center',):
 34+            return
 35+        elif txt in ('quotation', 'quote'):
 36+            pfx = '> '
 37+        elif txt == 'textblock':
 38+            display = False
 39+        else:
 40+            print(cmd, txt)
 41+            raise TypeError(cmd)
 42+    elif cmd == 'end':
 43+        if txt == 'textblock':
 44+            display = True
 45+        else:
 46+            pfx = ''
 47+        return ''
 48+    elif cmd in ('include',
 49+                 'chapter',
 50+                 'chapimg',
 51+                 'chapauth',
 52+                 'illustration',
 53+                 'scriptsize',
 54+                 'section*',
 55+                 'part'):
 56+        return '#%s %s' % (cmd, txt)
 57+    elif cmd in ('pagenumbering',
 58+                 'includegraphics',
 59+                 'newcommand',
 60+                 'hbox'):
 61+        return ''
 62+    elif cmd in ('TeX',
 63+                 'LaTeX'):
 64+        return cmd
 65+    else:
 66+        print(cmd, txt)
 67+        raise TypeError(cmd)
 68+
 69+decor_stack = []
 70+decor_re = re.compile(r'({\\(?P<cmd>\w\w) ?|})')
 71+
 72+def decorsub(m):
 73+    cmd = m.group('cmd')
 74+    if not cmd:
 75+        if not decor_stack:
 76+            return m.group(0)
 77+        cmd = decor_stack.pop()
 78+        return '</%s>' % cmd
 79+    else:
 80+        if cmd == 'bf':
 81+            cmd = 'strong'
 82+        elif cmd == 'em':
 83+            pass
 84+        elif cmd == 'sc':
 85+            decor_stack.append('span')
 86+            return '<span class="sc">'
 87+        else:
 88+            raise TypeError(cmd)
 89+        decor_stack.append(cmd)
 90+        return '<%s>' % cmd
 91+
 92+def art(artist, url, title=None):
 93+    alt = title or ("Artwork by %s" % artist)
 94+    print('<div class="art">')
 95+    print('<img src="%s" alt="%s" />' % (url, alt))
 96+    if title:
 97+        print('<em>%s</em> by %s' % (title, artist))
 98+    else:
 99+        print(alt)
100+    print('</div>')
101+
102+outbuf = ''
103+
104+def outline(l):
105+    global chapimg, chapauth, outbuf
106+
107+    l = l.strip()
108+    if not l:
109+        print(outbuf)
110+    elif l[0] == '%':
111+        return
112+    l = l.replace(r'\'e', 'é')
113+    l = l.replace(r'\,c', 'ç')
114+    l = l.replace(r'\'n', 'ń')
115+    l = l.replace("''", '&rdquo;')
116+    l = l.replace("``", '&ldquo;')
117+    l = l.replace("'", '&rsquo;')
118+    l = l.replace("`", '&lsquo;')
119+    l = l.replace('---', '&mdash;')
120+    l = l.replace('--', '&ndash;')
121+    l = l.replace('\\\\', '<br />')
122+    l = l.replace('\_', '_')
123+    l = l.replace('\#', '#')
124+    l = l.replace('\$', '$')
125+    l = l.replace('\ ', ' ')
126+    l = l.replace(r'\-', '')
127+    l = l.replace(r'\~n', 'ñ')
128+    l = l.replace(r'{\ldots}', '&hellip;')
129+    l = l.replace(r'\ldots', '&hellip;')
130+    l = l.replace(r'\copyright', '&copy;')
131+    l = block1_re.sub(texsub, l)
132+    l = block2_re.sub(texsub, l)
133+    l = l.replace('{}', '')
134+    l = decor_re.sub(decorsub, l)
135+
136+    if not l:
137+        return
138+    if l[0] == '#':
139+        if l.startswith('#include'):
140+            include(l[9:] + '.tex')
141+        elif l.startswith('#chapimg'):
142+            chapimg = l[9:-1].split('{')
143+        elif l.startswith('#chapauth'):
144+            chapauth = l[10:]
145+        elif l.startswith('#chapter'):
146+            print('<h1 class="chapter">%s</h1>' % l[9:])
147+            if chapauth:
148+                print('<h2 class="author">by %s</h2>' % chapauth)
149+                chapauth = None
150+            if chapimg:
151+                art(chapimg[0], chapimg[1])
152+                chapimg = None
153+        elif l.startswith('#part'):
154+            print('<h1 class="part">%s</h1>' % l[6:])
155+        elif l.startswith('#illustration'):
156+            artist, title, url = l[14:].split('{')
157+            title = title[:-1]
158+            url = url[:-1]
159+            art(artist, url, title)
160+        elif l.startswith('#section*'):
161+            print('<h2 class="section">%s</h2>' % l[10:])
162+        else:
163+            print('<--! %s -->' % l)
164+    elif l[0] == '\\':
165+        what = l[1:5].lower()
166+        if what in ('bigs', 'vfil'):
167+            print('<br class="bigskip"/>')
168+        elif what == 'newp':
169+            print('<br class="pagebreak"/>')
170+        elif what == 'noin':
171+            print(l[10:])
172+        elif what in ('hbox',
173+                      'inde',
174+                      'tabl',
175+                      'appe',
176+                      'page',
177+                      'list'):
178+            pass
179+        elif l[1:9] == 'maketitl':
180+            print('<h1>Horrors 2</h1>')
181+            print('<h2>The Something Awful Forums</h2>')
182+        else:
183+            print('================= %r' % what)
184+    elif display:
185+        print('%s%s' % (pfx, l))
186+
187+def include(fn):
188+    if fn == 'praise.tex':
189+        return
190+    f = open(fn)
191+
192+    for l in f:
193+        outline(l)
194+
195+f = open('horrors2.ltx')
196+
197+# skip LaTeX crap
198+for l in f:
199+    if l.startswith('\\begin{document'):
200+        break
201+
202+for l in f:
203+    outline(l)
204+