﻿#!/usr/bin/perl -w
use strict;
use warnings;
use utf8;
use open qw(:std :utf8);
use integer;
use Unicode::Normalize;


# Filter_4_00_Schummelskript.pl
# 2010-04-23
# Wolfgang Schmidle

# what does it do?
# input
# output


# text input

my @text;
while(<>) { push @text, $_; }


# go through the text

foreach (@text) {

	s!<div type="table" level="0" n="0"!<mgr!; # table
	s!<div type="table" style="it">!<mgr>!;
	s!<div type="toc" level="0" n="0"!<mgr!; # toc
	s!<div type="toc" style="it">!<mgr>!;
	s!<div type="index" level="0" n="0"!<mgr!; # index
	s!<div type="index" style="it">!<mgr>!;
	s!</div>!</mgr>!;

	s!^<q([ >])!<p$1!g; # blockquote
	s!^</q>!</p>!g;

#	s!<caption[ >]!!;
}


# text output

print @text;


# TO DO:
# ...
