mirror of https://github.com/nealey/Horrors2
Add /The Mirror/, and start at an ePub version
This commit is contained in:
parent
c6d4a4c026
commit
d086d3f580
|
@ -0,0 +1,88 @@
|
|||
\chapauth{A Child's Letter}
|
||||
\chapter{The Mirror}
|
||||
|
||||
Luke Bavarious' eyes rolled around in their sockets, finally allowing
|
||||
him to focus again on the bathroom mirror. His Beretta still in hand, he
|
||||
wiped the few remaining flecks of sick from his mouth.
|
||||
|
||||
{\em What can't I remember? I don't have any idea what I've,
|
||||
what's\ldots uggh! Too much shitty tequila}, he concluded. Again, he
|
||||
vomited.
|
||||
|
||||
The reflection gazing back at him nodded even as Bavarious nodded.
|
||||
|
||||
{\em I can't live like this! I'm a cop, dammit! I'm a cop! I'm a
|
||||
copI'macopI'macopI'macop}, he thought, his mind shrieking the mantra,
|
||||
causing liquid rust to ooze from his flaring nostrils.
|
||||
|
||||
The reflection gazing back at him blinked. Bavarious did not.
|
||||
|
||||
{\em What the hell?!}
|
||||
|
||||
Suddenly, rancid vomit streamed from the Bavarious in the mirror,
|
||||
splattering the glass and causing the other to recoil. Bavarious
|
||||
stepped---or stumbled, rather---back, raised his weapon, and aimed for
|
||||
the reflection's chest.
|
||||
|
||||
{\sc Boom!}
|
||||
|
||||
Red pain arced across his frame moments after he pulled the
|
||||
trigger. Shards of silvered glass protruded evilly from his hands and
|
||||
chest, callously inviting Bavarious' tattered sports coat to greedily
|
||||
lick away every spent drop of blood.
|
||||
|
||||
On the other side of what had been the mirror, the ``reflection'' stood,
|
||||
grinning lustily at its fallen doppelgänger.
|
||||
|
||||
``Who\ldots what\ldots what are you!'' wondered Bavarious aloud.
|
||||
|
||||
{\em I am you}, projected the specter as it placed a shaking withered
|
||||
hand on either side of the mirror's frame and thrust an impossibly long
|
||||
and spidery leg through the opening.
|
||||
|
||||
``The {\em fuck} you are!'' shouted Bavarious, who fired three more
|
||||
rounds into the advancing creature. As every mushrooming burst of metal
|
||||
rage ripped into it, Bavarious felt as though {\em he} had been shot.
|
||||
|
||||
``What are you {\em doing} to me!'' he roared, or tried to: his voice,
|
||||
hoarse, weakly reverberated throughout the dismal room. His crimson
|
||||
lifeforce spread out before him, pooling in a macabre circle.
|
||||
|
||||
{\em What am I doing to you? The question, Luke, is what are you doing
|
||||
to you.}
|
||||
|
||||
{\em I don't know what you're---shit, now {\em I'm} doing it---}
|
||||
|
||||
``I don't know what you're talking about!''
|
||||
|
||||
{\em I know}, it smiled as it injected itself into Baravious'
|
||||
reality. {\em I know.}
|
||||
|
||||
That's when Bavarious realized the smile wasn't one of joy or elation;
|
||||
rather, it was one of rueful, inescapable sadness. The kind of smile one
|
||||
smiles when, having done everything to avoid a foregone conclusion, the
|
||||
conclusion looms inevitable.
|
||||
|
||||
{\em I don't want to die}, whined Bavarious. {\em What do I do?}
|
||||
|
||||
``You...die, Luke,'' it whispered.
|
||||
|
||||
Gently---lovingly, it stroked Bavarious' cheek with its bony
|
||||
fingers. With every tortured breath, Bavarious felt his body contort,
|
||||
stretch out, become more like that of the entity now cradling his
|
||||
convulsing head.
|
||||
|
||||
Maybe it was a trick of the greenish ultraviolet light; maybe it was his
|
||||
uncontrollable spasms, but Bavarious was almost---no, he was one hundred
|
||||
percent positive that the monster was somehow {\em condensing},
|
||||
coalescing: somehow, its thready arms and legs were gaining proportion
|
||||
even as its previously gaunt features seemed to swell with health.
|
||||
|
||||
Through the multifaceted, bloodstained reflection of a shattered
|
||||
bathroom mirror, the last thing Bavarious ever saw was {\em himself}
|
||||
reach down and collect his Beretta.
|
||||
|
||||
{\em I'm a cop}, he sighed.
|
||||
|
||||
``I'm a cop,'' he said aloud, tucking his sidearm within the confines of
|
||||
his tattered sports coat and walking briskly from the room.
|
|
@ -0,0 +1,203 @@
|
|||
#! /usr/bin/env python3
|
||||
|
||||
import re
|
||||
|
||||
block1_re = re.compile(r'{\\(?P<cmd>[\w*]+) (?P<txt>[^{}]+)}')
|
||||
block2_re = re.compile(r'\\(?P<cmd>[\w*]+)(\[[^]]+\])?{(?P<txt>[^{}]*)}')
|
||||
|
||||
|
||||
chapauth = None
|
||||
chapimg = None
|
||||
display = True
|
||||
pfx = ''
|
||||
|
||||
def texsub(m):
|
||||
global pfx, display
|
||||
|
||||
cmd = m.group('cmd')
|
||||
txt = m.group('txt')
|
||||
if cmd == 'em':
|
||||
return '<em>%s</em>' % txt
|
||||
elif cmd == 'bf':
|
||||
return '<strong>%s</strong>' % txt
|
||||
elif cmd == 'sf':
|
||||
return '<samp>%s</samp>' % txt
|
||||
elif cmd == 'sc':
|
||||
return '<span class="sc">%s</span>' % txt
|
||||
elif cmd == 'rm':
|
||||
return '<span class="rm">%s</span>' % txt
|
||||
elif cmd == 'url':
|
||||
return '<a href="%s">%s</a>' % (txt, txt)
|
||||
elif cmd == 'begin':
|
||||
if txt in ('center',):
|
||||
return
|
||||
elif txt in ('quotation', 'quote'):
|
||||
pfx = '> '
|
||||
elif txt == 'textblock':
|
||||
display = False
|
||||
else:
|
||||
print(cmd, txt)
|
||||
raise TypeError(cmd)
|
||||
elif cmd == 'end':
|
||||
if txt == 'textblock':
|
||||
display = True
|
||||
else:
|
||||
pfx = ''
|
||||
return ''
|
||||
elif cmd in ('include',
|
||||
'chapter',
|
||||
'chapimg',
|
||||
'chapauth',
|
||||
'illustration',
|
||||
'scriptsize',
|
||||
'section*',
|
||||
'part'):
|
||||
return '#%s %s' % (cmd, txt)
|
||||
elif cmd in ('pagenumbering',
|
||||
'includegraphics',
|
||||
'newcommand',
|
||||
'hbox'):
|
||||
return ''
|
||||
elif cmd in ('TeX',
|
||||
'LaTeX'):
|
||||
return cmd
|
||||
else:
|
||||
print(cmd, txt)
|
||||
raise TypeError(cmd)
|
||||
|
||||
decor_stack = []
|
||||
decor_re = re.compile(r'({\\(?P<cmd>\w\w) ?|})')
|
||||
|
||||
def decorsub(m):
|
||||
cmd = m.group('cmd')
|
||||
if not cmd:
|
||||
if not decor_stack:
|
||||
return m.group(0)
|
||||
cmd = decor_stack.pop()
|
||||
return '</%s>' % cmd
|
||||
else:
|
||||
if cmd == 'bf':
|
||||
cmd = 'strong'
|
||||
elif cmd == 'em':
|
||||
pass
|
||||
elif cmd == 'sc':
|
||||
decor_stack.append('span')
|
||||
return '<span class="sc">'
|
||||
else:
|
||||
raise TypeError(cmd)
|
||||
decor_stack.append(cmd)
|
||||
return '<%s>' % cmd
|
||||
|
||||
def art(artist, url, title=None):
|
||||
alt = title or ("Artwork by %s" % artist)
|
||||
print('<div class="art">')
|
||||
print('<img src="%s" alt="%s" />' % (url, alt))
|
||||
if title:
|
||||
print('<em>%s</em> by %s' % (title, artist))
|
||||
else:
|
||||
print(alt)
|
||||
print('</div>')
|
||||
|
||||
outbuf = ''
|
||||
|
||||
def outline(l):
|
||||
global chapimg, chapauth, outbuf
|
||||
|
||||
l = l.strip()
|
||||
if not l:
|
||||
print(outbuf)
|
||||
elif l[0] == '%':
|
||||
return
|
||||
l = l.replace(r'\'e', 'é')
|
||||
l = l.replace(r'\,c', 'ç')
|
||||
l = l.replace(r'\'n', 'ń')
|
||||
l = l.replace("''", '”')
|
||||
l = l.replace("``", '“')
|
||||
l = l.replace("'", '’')
|
||||
l = l.replace("`", '‘')
|
||||
l = l.replace('---', '—')
|
||||
l = l.replace('--', '–')
|
||||
l = l.replace('\\\\', '<br />')
|
||||
l = l.replace('\_', '_')
|
||||
l = l.replace('\#', '#')
|
||||
l = l.replace('\$', '$')
|
||||
l = l.replace('\ ', ' ')
|
||||
l = l.replace(r'\-', '')
|
||||
l = l.replace(r'\~n', 'ñ')
|
||||
l = l.replace(r'{\ldots}', '…')
|
||||
l = l.replace(r'\ldots', '…')
|
||||
l = l.replace(r'\copyright', '©')
|
||||
l = block1_re.sub(texsub, l)
|
||||
l = block2_re.sub(texsub, l)
|
||||
l = l.replace('{}', '')
|
||||
l = decor_re.sub(decorsub, l)
|
||||
|
||||
if not l:
|
||||
return
|
||||
if l[0] == '#':
|
||||
if l.startswith('#include'):
|
||||
include(l[9:] + '.tex')
|
||||
elif l.startswith('#chapimg'):
|
||||
chapimg = l[9:-1].split('{')
|
||||
elif l.startswith('#chapauth'):
|
||||
chapauth = l[10:]
|
||||
elif l.startswith('#chapter'):
|
||||
print('<h1 class="chapter">%s</h1>' % l[9:])
|
||||
if chapauth:
|
||||
print('<h2 class="author">by %s</h2>' % chapauth)
|
||||
chapauth = None
|
||||
if chapimg:
|
||||
art(chapimg[0], chapimg[1])
|
||||
chapimg = None
|
||||
elif l.startswith('#part'):
|
||||
print('<h1 class="part">%s</h1>' % l[6:])
|
||||
elif l.startswith('#illustration'):
|
||||
artist, title, url = l[14:].split('{')
|
||||
title = title[:-1]
|
||||
url = url[:-1]
|
||||
art(artist, url, title)
|
||||
elif l.startswith('#section*'):
|
||||
print('<h2 class="section">%s</h2>' % l[10:])
|
||||
else:
|
||||
print('<--! %s -->' % l)
|
||||
elif l[0] == '\\':
|
||||
what = l[1:5].lower()
|
||||
if what in ('bigs', 'vfil'):
|
||||
print('<br class="bigskip"/>')
|
||||
elif what == 'newp':
|
||||
print('<br class="pagebreak"/>')
|
||||
elif what == 'noin':
|
||||
print(l[10:])
|
||||
elif what in ('hbox',
|
||||
'inde',
|
||||
'tabl',
|
||||
'appe',
|
||||
'page',
|
||||
'list'):
|
||||
pass
|
||||
elif l[1:9] == 'maketitl':
|
||||
print('<h1>Horrors 2</h1>')
|
||||
print('<h2>The Something Awful Forums</h2>')
|
||||
else:
|
||||
print('================= %r' % what)
|
||||
elif display:
|
||||
print('%s%s' % (pfx, l))
|
||||
|
||||
def include(fn):
|
||||
if fn == 'praise.tex':
|
||||
return
|
||||
f = open(fn)
|
||||
|
||||
for l in f:
|
||||
outline(l)
|
||||
|
||||
f = open('horrors2.ltx')
|
||||
|
||||
# skip LaTeX crap
|
||||
for l in f:
|
||||
if l.startswith('\\begin{document'):
|
||||
break
|
||||
|
||||
for l in f:
|
||||
outline(l)
|
||||
|
Loading…
Reference in New Issue