diff options
| author | Christoph Schlosser <christoph@linux.com> | 2025-09-18 20:56:26 +0200 |
|---|---|---|
| committer | Christoph Schlosser <christoph@linux.com> | 2025-09-18 20:56:26 +0200 |
| commit | f2056d0a59cd7234610dd7da1ea2c3e2a4be0f00 (patch) | |
| tree | 4331dcad7f91cd9e038c8872977eb421f6aa08b0 /g2h/commit_page.py | |
| parent | 639b739a3fc69e8ae4476d8eca5393d221d3a0b8 (diff) | |
| download | git2hugo-f2056d0a59cd7234610dd7da1ea2c3e2a4be0f00.tar.gz | |
g2h: Use a different kind of email redaction
A bug in hugo, or it's markdown renderer shouldn't prevent using a more typical pattern.
Diffstat (limited to 'g2h/commit_page.py')
| -rw-r--r-- | g2h/commit_page.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/g2h/commit_page.py b/g2h/commit_page.py index a998417..03d74ab 100644 --- a/g2h/commit_page.py +++ b/g2h/commit_page.py @@ -2,18 +2,24 @@ import os from .page import Page +def _redact_local_segment(local_segment): + if len(local_segment) == 0: + return '' + if len(local_segment) < 6: + return local_segment[0] + '...' + return local_segment[:2] + '...' + def redact_email(email): if email is None or len(email) == 0: return '' if '@' not in email: - return email[0] + '...' + email[-1] + return _redact_local_segment(email) local, domain = email.split('@') - redacted_local = local[0] + '...' + local[-1] if len(local) > 0 else '' - redacted_domain = domain.replace('.', '...') + redacted_local = _redact_local_segment(local) - return redacted_local + '@' + redacted_domain + return redacted_local + '@' + domain class CommitPage(Page): def __init__(self, out_dir, name, commit, content_subdir): |