471,348 Members | 1,428 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,348 software developers and data experts.

Getting indented code snippets into blogger

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.

Sep 18 '07 #1
0 968

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

11 posts views Thread by Aurélien Géron | last post: by
2 posts views Thread by Ergobob | last post: by
3 posts views Thread by Spartanicus | last post: by
2 posts views Thread by - Steve - | last post: by
15 posts views Thread by Brady Love | last post: by
2 posts views Thread by Pete.Cloth | last post: by
5 posts views Thread by pauldepstein | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.