(* Escapes and styles text on the clipboard to protect code snippets from forums that might mistake some characters as formating characters. *) do shell script "cat << EOT | pbcopy <pre style=\"border: 1px solid #ddd; padding-left: .75ex; padding-top: .25em; padding-bottom: .25em; margin-top: .5em; margin-bottom: .5em; margin-left: 1ex; max-width: 80ex; overflow: auto; font-size: 10px; font-family: Monaco, 'Courier New', Courier, monospace; color: #444; background: #eee; line-height: normal\">` pbpaste | perl -0777pe 's/([^[:alnum:][:space:]\\)\\(\\.\\/\\47\\44%,])/sprintf(\"&#%03d;\", ord($1))/eg; s/\\15\\12?|\\12/<br \\/>/g; s/ / /g' `</pre> EOT "
open esc-forum in the applescript editor