Yes, if you want to call them that
----- Original message -----
So these are backreferences?
Important
You should try and view the HTML version of this message!
On Thu, 10 Dec 2009 10:46:05 -0600 Terry Brown <terry_...@yahoo.com> wrote:
> Hey - would it be cool to have an email system which lets you write > in rst and then sends both text (rst) and html forms...
Despite the fact y'all failed to chorus "Yes it would" ;-) I went ahead and set it up in Claws-mail
Add an rst-preview button to the Claws-mail compose window. It just runs a user command on the body text:
| rst2pyg >~/.tmp.html; x-www-browser ~/.tmp.html
rst2pyg is included below.
Add an indent button to the Claws-mail compose window. It just runs a user command on the selected text:
| sed 's/^/ /' |
Write rst2email, included below.
Use Send Later for messages you want to process, so rst2email can get at them in the queue directory.
You can get rst2email_pygments.py (as imported by both rst2email and rst2pyg) from my blog, it's the file at the end of this page.
#!/usr/bin/python """rst2email - look for messages in an email queue folder and add an html part by processing the text part as rst Terry Brown, terry_...@yahoo.com """ import email import mailbox from email.mime.text import MIMEText from docutils.core import publish_string # this import adds the sourcecode:: directive to rst import rst2email_pygments queue = "/home/tbrown/Mail/queue" mbox = mailbox.MH(queue, email.message_from_file) for msgkey in mbox.iterkeys(): # d = email.utils.parsedate(msg.get('Date')) msg = mbox[msgkey] if not msg.is_multipart(): txt = msg.get_payload() html = publish_string(txt, writer_name='html') part1 = MIMEText(txt, 'plain') part2 = MIMEText(html, 'html') part1["X-rst2email"] = "rst" part2["X-rst2email"] = "html" msg.set_type("multipart/alternative") msg.set_payload([]) msg.attach(part1) msg.attach(part2) mbox[msgkey] = msg else: txtpart = None htmlpart = None for part in msg.walk(): if part.get_content_type() == "text/plain": if txtpart: # can't handle more than one txtpart = None break txtpart = part if part.get_content_type() == "text/html": if htmlpart: # can't handle more than one htmlpart = None break htmlpart = part if txtpart and htmlpart and not txtpart.is_multipart(): htmlpart.set_payload( publish_string(txtpart.get_payload(), writer_name='html')) txtpart["X-rst2email"] = "rst" htmlpart["X-rst2email"] = "html" msg.set_type("multipart/alternative") mbox[msgkey] = msg
1 2 3 4 5 6 7 | #!/usr/bin/python from docutils.core import publish_string import rst2email_pygments import sys print publish_string(sys.stdin.read(), writer_name='html') |
Important
You should try and view the HTML version of this message!
> This kind of stuff makes me think html email is actually a somewhat
> tolerable concept.
Maybe :-) even as I wrote it it was more because I thought email
rendered (to html) from rst was cool, rather than that I think html
email is necessary. It's funny looking at postings in this list vs. my
main inbox, here very very few msgs have html parts, whereas in the
main inbox at least 50% do.
Did occur to me that it would probably be possibly to set up some
combination of unicode chrs and css which would render leo trees
nicely in an html email.
Cheers -Terry