def pygal_parser(preprocessor, tag, markup):
    """ Simple pygal parser """
    # Find JSON payload
    data = loads(markup)
    if tag == 'pygal' and data is not None:
        # Run generation of chart
        output = run_pygal(data)
        # Return embedded SVG image
        return '<div class="pygal" style="text-align: center;"><embed type="image/svg+xml" src=%s style="max-width:1000px"/></div>' % output

    else:
        raise ValueError('Error processing input. \nExpected syntax: {0}'.format(SYNTAX))
Simple pygal parser