def replace_template_path(path):
    """ replace original template path with new dict """
    segments = path.split('.')
    module = '.'.join(segments[0:-1])
    name = segments[-1]
    if module == 'ipypublish.html.ipypublish':
        return {'module': 'ipypublish.templates.segments', 'file':
            'ipy-{0}.html-tplx.json'.format(name)}
    elif module == 'ipypublish.html.standard':
        return {'module': 'ipypublish.templates.segments', 'file':
            'std-{0}.html-tplx.json'.format(name)}
    elif module == 'ipypublish.latex.standard':
        return {'module': 'ipypublish.templates.segments', 'file':
            'std-{0}.latex-tpl.json'.format(name)}
    elif module == 'ipypublish.latex.ipypublish':
        return {'module': 'ipypublish.templates.segments', 'file':
            'ipy-{0}.latex-tpl.json'.format(name)}
    else:
        print('Warning: unknown template path: {}'.format(path))
        return {'module': module, 'file': '{0}.json'.format(name)}
