@register.filter
def restructuredparts(value, **overrides):
    """return the restructured text parts"""
    try:
        from docutils.core import publish_parts
    except __HOLE__:
        if settings.DEBUG:
            raise template.TemplateSyntaxError("Error in {% restructuredtext %} filter: The Python docutils library isn't installed.")
        return value
    else:
        docutils_settings = dict(getattr(settings, "RESTRUCTUREDTEXT_FILTER_SETTINGS", {}))
        docutils_settings.update(overrides)
        if "halt_level" not in docutils_settings:
            docutils_settings["halt_level"] = 6
        return publish_parts(source=value, writer_name="html4css1", settings_overrides=docutils_settings)
dataset/ETHPy150Open amarandon/smeuhsocial/apps/blog/templatetags/restructuredtext.py/restructuredparts