import os import sys if len(sys.argv) < 2: print('Usage: python convert_raw.py [file]', file=sys.stderr) sys.exit(1) if not os.path.exists(sys.argv[1]): print('Please make sure that you have the file.') sys.exit(1) input_filename = sys.argv[1] style = ''' body { font-variant-ligatures: none; } pre { font-family: 'Courier New', Courier, monospace; } a { color: black; } .bottom-nav { position: sticky; bottom: 0px; background-color: white; text-align: right; } h3, h4 { margin: 0; } ''' preamble = f'''
\n') for line in source.split('\r\n'): f.write(line.replace('&', '&').replace('<', '<').replace('>', '>')) f.write('\n') f.write('\n\n') f.write('\n') f.write(postamble)