in reply to using perl to convert to xml file

I'm not sure how these [[a]] things work, but if [[a]] corresponds to <a>, you can do
perl -pe 's/\[\[/</g; s/\]\]/>/g;' <infile >outfile
if it doesn't directly correspond to those tags, you can always translate the resulting XML using XML::Twig , XML::Simple or another XML processing module (or even XSLT).