Copyleft Games

Webchat pastebin tool

One of the most common external tools we use for chat is pastebins. With this task, you can write your own pastebin tightly integrated to our webchat.

The first trick is capturing pastes from the webchat input. Capture onpaste or similar event to detect pastes, test to see if they are multi-line, and if so the paste should instead be uploaded to a WSGI app on our servers and the returned XHTML-IM sent in its place.

Next, write that WSGI app which receives a pastebin. Use the Python package Pygments to highlight it and generate appropriate HTML and a thumbnail (SVG might be best, so long as it works - otherwise PNG). Save both to and return XHTML-IM that can be inserted into the chat to show the thumbnail linking to the full pastebin page.

This task requires both Javascript and Python experience.

When done, attach your work to this task.

Task tags

  • python
  • javascript

Students who completed this task


Task type

  • code Code
  • assessment Outreach / Research