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

=========================
'''
blogspace.py
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(),
               l.rstrip())
=========================

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

- Paddy.

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to