diff options
author | Rangi <35663410+Rangi42@users.noreply.github.com> | 2019-06-17 07:29:30 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-17 07:29:30 -0400 |
commit | f1bab45624a3a2d5f6bf5b63e912382de0a30abd (patch) | |
tree | a119b4a04697bba53c0f9617283ed9a467fc6236 /tools/toc.py | |
parent | fbc2c55cdb2f18a933af3daf9294750f254c23a5 (diff) | |
parent | 7e84f7240328af68723f8419d5079daea32cf21d (diff) |
Merge pull request #638 from mid-kid/master
beep boop
Diffstat (limited to 'tools/toc.py')
-rwxr-xr-x | tools/toc.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/tools/toc.py b/tools/toc.py index 8ff50be94..13b75ae1c 100755 --- a/tools/toc.py +++ b/tools/toc.py @@ -17,6 +17,7 @@ valid_toc_headings = {'## TOC', '##TOC'} TocItem = namedtuple('TocItem', ['name', 'anchor', 'level']) punctuation_regexp = re.compile(r'[^\w\- ]+') +specialchar_regexp = re.compile(r'[⅔]+') def name_to_anchor(name): # GitHub's algorithm for generating anchors from headings @@ -24,6 +25,7 @@ def name_to_anchor(name): anchor = name.strip().lower() # lowercase anchor = re.sub(punctuation_regexp, '', anchor) # remove punctuation anchor = anchor.replace(' ', '-') # replace spaces with dash + anchor = re.sub(specialchar_regexp, '', anchor) # remove misc special chars return anchor def get_toc_index(lines): |