#!/usr/bin/env python
#
# Produce XML box diagrams from .dia files that use constant-width symbols.

import sys, re

text = sys.stdin.read()

text = re.sub("#.*\n", "", text)

text = text.replace(r"/", r"&boxdr;")
text = text.replace("\\", r"&boxur;")
text = text.replace(r"|", r"&boxv;")
text = text.replace(r"-", r"&boxh;")
text = text.replace(r"=", r"&boxhu;")
text = text.replace(r"+", r"&boxvh;")

for ch in ("a", "b", "c"):
    text = text.replace("_"+ch, "<emphasis> " + ch + "</emphasis>")

sys.stdout.write("<screen>\n")
sys.stdout.write(text)
sys.stdout.write("</screen>\n")
