Created
June 22, 2017 07:05
-
-
Save spookylukey/614d7aa26a4603ac0494e93be2f4db9e to your computer and use it in GitHub Desktop.
Make source code readable on forums that have poor support
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import sys | |
def fix_line(l): | |
if not l: | |
return l | |
if l[0] == " ": | |
# Non breaking: "\u00a0" - but munged by some browsers | |
# EM space: "\u2003" - not munged by browsers | |
# EN space: "\u2002" - not munged by browsers, approx normal char width | |
return "\u2002" + fix_line(l[1:]) | |
else: | |
return l | |
if __name__ == '__main__': | |
for l in sys.stdin.readlines(): | |
sys.stdout.write(fix_line(l)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment