12345678910111213141516171819202122232425 |
- from typing import Union
- import urllib.parse
- def define_env(env):
- @env.macro
- def pageinfo(authors: Union[str, list[str]] = None, created: str = None, updated: str = None):
- parts = []
- if authors is not None:
- parts.append(", ".join(authors if isinstance(authors, list) else [ authors ]))
- if created is not None:
- parts.append("Created " + created)
- if updated is not None:
- parts.append("Updated " + updated)
- return "<br><small>" + " | ".join(parts) + "</small>"
- @env.macro
- def release(artist: str, album: str):
- query = f"{artist} - {album}"
- return f"{query} " + \
- f'<a class="release-link" rel="noopener noreferrer" href="https://odesli.co/?q={urllib.parse.quote(query)}"><img src="/assets/img/icons/odesli.png" alt="Odesli"></a></a>' + \
- f'<a class="release-link" rel="noopener noreferrer" href="https://youtube.com/results?q={urllib.parse.quote(query)}"><img src="/assets/img/icons/youtube.png" alt="YouTube"></a></a>' + \
- f'<a class="release-link" rel="noopener noreferrer" href="https://google.com/search?q={urllib.parse.quote(query)}"><img src="/assets/img/icons/google.png" alt="Google"></a>'
|