Added plugin_config() method

This commit is contained in:
Simon Willison 2018-08-28 01:35:21 -07:00
commit 0a14a4846b
No known key found for this signature in database
GPG key ID: 17E2DEA2588B7F52
6 changed files with 114 additions and 6 deletions

View file

@ -14,8 +14,8 @@ label_re = re.compile(r'\.\. _([^\s:]+):')
def get_headings(filename, underline="-"):
content = (docs_path / filename).open().read()
heading_re = re.compile(r'(\S+)\n\{}+\n'.format(underline))
return set(heading_re.findall(content))
heading_re = re.compile(r'(\w+)(\([^)]*\))?\n\{}+\n'.format(underline))
return set(h[0] for h in heading_re.findall(content))
def get_labels(filename):