aboutsummaryrefslogtreecommitdiff
path: root/llvm/docs/llvm_slug.py
blob: 9dd8b1cd3f1aacd3adb6f1f5040d3aac43f5c00b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# -*- coding: utf-8 -*-
#
# LLVM documentation anchor slug formatting

# Some of our markdown documentation numbers section titles
# This helpers is used by myst to remove that numbering from the anchor links.

from docutils.nodes import make_id


def make_slug(str):
    import re

    str = re.sub(r"^\s*(\w\.)+\w\s", "", str)
    str = re.sub(r"^\s*\w\.\s", "", str)
    return make_id(str)