Getting indented code snippets into blogger

Paddy paddy3118 at
Tue Sep 18 09:12:51 CEST 2007

I got tired of Bloggers inadequate comment editor so wrote this for
transforming code snippets:

Turns leading spaces into HTML &nbsp tokens which shows
as correct indentation on Blogger comment fields
(and maybe other blogs).

Donald. 'Paddy' McCarthy Sept 2011
import fileinput, re

for l in fileinput.input():
  print re.sub(r'^(\s*)\s',
               lambda m: ' '*m.end(),

If you find it works on other blogs then please this thread.

- Paddy.

More information about the Python-list mailing list