Lowercase redirect targets for sentence-case link text
This commit is contained in:
parent
3ba7eaefd0
commit
728020d342
2 changed files with 80 additions and 1 deletions
|
|
@ -205,7 +205,11 @@ def match_found(m: re.Match[str], q: str, linkto: str | None) -> str:
|
|||
if pos == 0 or m.string[pos - 1] == "\n":
|
||||
replacement = replacement[0].upper() + replacement[1:]
|
||||
if linkto:
|
||||
if linkto[0].isupper() and replacement[0] == linkto[0].lower():
|
||||
if (
|
||||
linkto[0].isupper()
|
||||
and replacement[0].islower()
|
||||
and not is_title_case(replacement)
|
||||
):
|
||||
linkto = linkto[0].lower() + linkto[1:]
|
||||
elif replacement[0].isupper():
|
||||
linkto = linkto[0].upper() + linkto[1:]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue