Document in-battle move selection menu scrolling glitch

What a mouthful...
This commit is contained in:
mid-kid
2019-06-09 00:05:32 +02:00
parent c7fdf5f9ec
commit 54b87ecea8
2 changed files with 55 additions and 0 deletions

View File

@@ -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):