#!/bin/bash
location=`dirname $0`
echo "Running $0 at $location"
# Fixes issues described here among others
# https://github.com/michaeljones/breathe/issues/284
fix-missing-class-name()
{
    src='\(.*\)class '
    dst='\2class\1'
    sed -i "s@$src@$dst@g" $location/_build/html/*.html
}
fix-missing-struct-name()
{
    src='\(.*\)struct '
    dst='\2struct\1'
    sed -i "s@$src@$dst@g" $location/_build/html/*.html
}
fix-double-using-keyword()
{
    src='usingusing '
    dst='using '
    sed -i "s@$src@$dst@g" $location/_build/html/*.html
}
fix-do-not-repeat-type-in-member-using-declaration()
{
    src='using \(\([^:]*::\)*\)\([^ ]*\) = \([^<]*\)'
    dst='using \3 = \4'
    sed -i "s@$src@$dst@g" $location/_build/html/*.html
}
fix-do-not-repeat-type-in-member-using-declaration
fix-remove-double-class-name()
{
    # src='\([^&]*\)<\([^&]*\)>::'
    # dst='\1::'
    src='\([^<]*\)'
    dst=''
    sed -i "s@$src@$dst@g" $location/_build/html/*.html
}
fix-remove-straneous-typedefs()
{
    src='typedef '
    dst=''
    sed -i "s@$src@$dst@g" $location/_build/html/*.html
}
fix-remove-straneous-typedefs-2()
{
    src='= typedef '
    dst='= '
    sed -i "s@$src@$dst@g" $location/_build/html/*.html
}
fix-remove-straneous-typedefs-2
fix-remove-straneous-using-declarations()
{
    src='using template<>
'
    dst=''
    sed -i "s@$src@$dst@g" $location/_build/html/*.html
}
fix-remove-straneous-template-in-using-declarations-1()
{
    src='\(