link title to proposal
This commit is contained in:
@@ -8,12 +8,15 @@ from pathlib import Path
|
||||
|
||||
|
||||
CAMEL_CASE_RE = re.compile(r'(?<=[a-z])(?=[A-Z])')
|
||||
MARKDOWN_LINK_RE = re.compile(r'^\[(.*?)\]\([^)]*\)$')
|
||||
|
||||
|
||||
def read_title(markdown_path: Path) -> str:
|
||||
for line in markdown_path.read_text(encoding='utf-8').splitlines():
|
||||
if line.startswith('# '):
|
||||
return line[2:].strip()
|
||||
title = line[2:].strip()
|
||||
link_match = MARKDOWN_LINK_RE.match(title)
|
||||
return link_match.group(1) if link_match else title
|
||||
return markdown_path.stem
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user