47 lines
2.4 KiB
Python
47 lines
2.4 KiB
Python
import numpy as np
|
|
from jinja2 import Environment, FileSystemLoader, select_autoescape
|
|
|
|
|
|
emojis = np.array([
|
|
"🍎", "🍏", "🍊", "🍋", "🍌", "🍉", "🍇", "🍓", "🍒", "🍑",
|
|
"🥭", "🍍", "🥥", "🥝", "🍅", "🍆", "🥑", "🥕", "🌽", "🥔",
|
|
"🍠", "🥐", "🥖", "🥨", "🥯", "🥞", "🧀", "🍖", "🍗", "🥚",
|
|
"🍔", "🍟", "🍕", "🌭", "🥪", "🌮", "🌯", "🍣", "🍤", "🍙",
|
|
"🍚", "🍜", "🍲", "🍛", "🍱", "🥟", "🍦", "🍧", "🍨", "🍩",
|
|
"🍪", "🎂", "🍰", "🧁", "🍫", "🍬", "🍭", "🍮", "☕", "🍵",
|
|
"🥤", "🧃", "🍷", "🍸", "🍹", "🍺", "🥂", "🥃", "🐶", "🐱",
|
|
"🐭", "🐹", "🐰", "🦊", "🐻", "🐼", "🐨", "🐯", "🦁", "🐮",
|
|
"🐷", "🐽", "🐴", "🦄", "🦓", "🦒", "🐘", "🦏", "🐪", "🐫",
|
|
"🐑", "🐐", "🐓", "🐔", "🐣", "🐤", "🐦", "🦅", "🦇", "🦉",
|
|
"🐺", "🐍", "🐢", "🦎", "🐙", "🦑", "🦐", "🦀", "🐡", "🐠",
|
|
"🐟", "🐬", "🐳", "🦈", "🐊", "🐅", "🐆", "🐾", "🦋", "🐞",
|
|
"🐝", "🐜", "🕷️", "🕸️", "🌸", "🌹", "🌺", "🌻", "🌼", "🌷",
|
|
"🌱", "🌲", "🌳", "🌴", "🌵", "🌾", "🌿", "🍀", "🍁", "🍂",
|
|
"🍃", "⭐", "🌟", "✨", "⚡️", "☄️", "☀️", "🌤️", "⛅", "🌥️",
|
|
"☁️", "🌦️", "🌧️", "⛈️", "🌩️", "❄️", "🌬️", "💨", "🌈", "☔",
|
|
"💧", "🌊", "🔥", "💥", "⛄", "🌋", "⛰️", "🏔️", "🏕️", "🏖️",
|
|
"🏜️", "🏝️", "🏞️", "🏟️", "🏠", "🏡", "🏢", "🏣", "🏤", "🏥",
|
|
"🏦", "🏨", "🏩", "🏪", "🏫", "🏬", "🏭", "🏯", "🏰", "⛪",
|
|
"⛩️", "🕌", "🕍", "🗿", "🎡", "🎢", "🎠", "🎪", "🎨", "🎬",
|
|
"🎤", "🎧", "🎼", "🎹", "🎺", "🎸", "🥁", "🎻", "🎮", "🎲"
|
|
])
|
|
|
|
def render_markdown_template(template_path, output_path, context: dict):
|
|
template_dir = template_path.parent
|
|
template_file = template_path.name
|
|
|
|
env = Environment(
|
|
loader=FileSystemLoader(template_dir),
|
|
autoescape=select_autoescape(['html', 'xml']),
|
|
trim_blocks=True,
|
|
lstrip_blocks=True
|
|
)
|
|
|
|
template = env.get_template(template_file)
|
|
rendered = template.render(**context)
|
|
|
|
with open(output_path, 'w') as f:
|
|
f.write(rendered)
|
|
|
|
print(f"Template rendered to {output_path}")
|