Skip to content

Commit

Permalink
allow image url, rename logo to image
Browse files Browse the repository at this point in the history
  • Loading branch information
fcmsilva committed Jun 21, 2024
1 parent 60f3fa0 commit 181f22f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion authors/singlestore.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name="SingleStore"
title="Engineering Team"
logo="singlestore"
image="singlestore"
external=false
20 changes: 12 additions & 8 deletions resources/author-check.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/usr/bin/env python3
import os
import re
import sys
import tomllib


def error(msg):
print('ERROR:', msg, file=sys.stderr)
sys.exit(1)
Expand All @@ -24,13 +24,17 @@ def check_author(author_path):
if 'external' not in meta:
error(f'No `external` in `meta` section of {author_path}')

# Logo is optional, but if defined a corresponding image must exist
if 'logo' in meta:
logo_id = meta['logo']
logo_filename = f'{logo_id}.png'
logo_path = os.path.join('common/images/author-images', logo_filename)
if not os.path.isfile(logo_path):
error(f'Logo image does not exist at {logo_path} for {author_path}')
# Image is optional, but if defined a corresponding image must exist
# Image can either be a URL or a filename in common/images/author-images
if 'image' in meta:
img_reference = meta['image']
is_url = bool(re.match(r'^https?://', img_reference))

if (not is_url):
img_filename = f'{img_reference}.png'
img_path = os.path.join('common/images/author-images', img_filename)
if not os.path.isfile(img_path):
error(f'Author image does not exist at {img_path} for {author_path}')


if __name__ == '__main__':
Expand Down

0 comments on commit 181f22f

Please sign in to comment.