#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: set sts=4 expandtab:
"""
debiandoc2dbk-unwrap - convert paragraphs which were comments back to comments

Copyright (C) 2011 Osamu Aoki, GPL2+

This works on sgml file FOO.en.sgml processed by:
$ editor FOO.en.sgml # remove incompatible comments
$ debiandoc2dbk-wrap <FOO.en.sgml >FOO-commet.en.sgml
$ debiandoc2dbk -1 FOO-commet.en.sgml
$ debiandoc2dbk-unwrap <FOO-commet.en.dbk >FOO.en.dbk
"""

import sys, os, re, string

VERSION = '1.0.1'

if __name__ == '__main__':

    line0=""
    for line in sys.stdin.readlines():
        line=line[0:-1]
        if line0 == "<para>" and line[0:17] == "=====COMMENT=====":
            print "<!--"
            line0 = line[17:]
        elif line0[-17:] == "=====TNEMMOC=====" and line == "</para>":
            if line0[0:-17] != "":
                print line0[0:-17]
            print "-->"
            line0 = ""
        elif line0 != "":
            print line0
            line0 = line
        else:
            line0 = line
    print line0


