# forflo/PiFo

Pidgin message formatter
C TeX Makefile
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
 Failed to load latest commit information. markup_tests screencast screenshots test .gitignore CHANGELOG COPYING LICENSE Makefile README.md TODO.md pifo.c pifo.h pifo_generator.c pifo_generator.h pifo_util.c pifo_util.h

# Description

PiFo is a plugin for the chat program pidgin It enables you to render various latex markups and procedural graphics code embedded into your normal conversation.

You can

• highlight your sourcecode using the listings package for LaTeX,
• display some maths using the amsmath packages,
• generate neat looking graphivz graphs from dot code,
• render extended markdown using pandoc or
• compile and view TikZ procedural graphics.

In a certain way, you could think of PiFo as an integrated REPL for various markup and procedural graphics languages.

# Screencasts

Right now, there are two demos. The first demo shows formula rendering and code highlighting. The second shows the newest feature: Embedded graphvzi rendering :) You can watch the screencasts by clicking on the thumbnails.

# Prerequisites

• The pidgin header files (needed to compile the plugin)
• A LaTex-Distribution (preferably TeXlive)
• dvipng (command line utility)
• latex (command line utility)
• The graphviz suite
• ImageMagic (especially the convert utility)
• Poppler

# Usage in detail

You can markup some of your text via the following construct (embedded into your normal conversation)

[normal conversation text]
\command{your formula, dot code or whatever}


If a command is detected, it'll be dispatched to one of the rendering backends and the result is displayed nicely enclosed by your surrounding text. Note, that you can use arbitrarily many of those commands in your messages!

Here is a list of examples. The shown code can be pasted directly into your conversation window.

## Graphivz dot

Display of graphviz dot code

Hey, look at following graph! \dot{digraph foo {a->a->a->a;}}


## Latex maths

Hey, i found out that I can create the set of natural
numbers by describing them inductively. I use the Axiom
\formula{\frac{}{n}} and the rule \formula{\frac{n}{n+1}}


## Sourcecode hightlighting

Use the following snippet for C programs

Not an iteration in C: \c{
int main(void){
return 0;
}
}


or use this one for highlighting haskell sources

I hate programming. Look: \haskell{
shaves :: Integer -> Integer -> Bool
1 shaves 1 = True
2 shaves 2 = False
0 shaves x = not (x shaves x)
_ shaves _ = False
}


the latter code is equivalent to latex code:

\usepackage{listings}
% [...] various other lstset
\begin{document}
\begin{lstlisting}
shaves :: Integer -> Integer -> Bool
1 shaves 1 = True
2 shaves 2 = False
0 shaves x = not (x shaves x)
_ shaves _ = False
\end{lstlisting}


## TikZ compilation

If you want to create TikZ graphics inside your conversation, you would want to paste the following snippet into your conversation.

\tikz{
\foreach \x in {0,...,9}
\draw (\x,0) circle (0.4);
}


this is equivalent to this LaTeX code

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\foreach \x in {0,...,9}
\draw (\x,0) circle (0.4);
\end{tikzpicture}


# Complete command list

Hiere is a list of all commands that will be recognized

• \bash{}
• \awk{}
• \c{}
• \cpluscplus{}
• \html{}
• \lua{}
• \make{}
• \octave{}
• \perl{}
• \python{}
• \ruby{}
• \vhdl{}
• \verilog{}
• \xml{}
• \dot{}
• \formula{}
• \markdown{}
• \tikz{}

\ada{} to \xml{} hightlights source code. \dot{} renders arbitrary graphiz dot code \formula{} can be used to display commonLateX math markup. \markdown{} enables you to use pandocs power right in pidgin and \tikz{} can compile and display the PGF graphics language.

# Important notes

This plugin uses various command line utilities and calls them in background in order to render the available markups depicted in chapter command list. Some markup languages like TeX are turing-complete, Which means, that it is, in general, not possible to decide which code-strings are malicious or not.

Actually, the commandline tools should only be called in a proper sandbox. This, however would requre a bit more work and I simply don't have the time right now and don't know exactly how to do that at this point of time. Patches are thus very welcome!

# Building and installation

To build and install :

You can compile the plugin using

$make  and install it with $ make install


This will install it in ~/.purple/plugins so that only the user who installed it can use it.

To install it for everybody on your computer,

$make$ su
# make install PREFIX="/path/to/pidgin" (this command as root user)


generally /path/to/pidgin is /usr or /usr/local. If you don't know the path then you can find out using

\$ whereis pidgin


and look for the part before "/lib/pidgin".