SEP 64: Redesign shortcodes

PENDING:

I want a better design for the shortcodes I use throughout the site.

The current “design” is captured in the regexes used to extract them:

    REF_LINK_RE = re.compile(r"!?\[([^\]]*?)\](\((.*?::)([^)]+)\))")
    REF_SLUG_RE = re.compile(r"(?<!`)(/bored)([a-zA-Z0-9]*)((?:#[^)\s]*)?)")
    REF_TITLE_RE = re.compile(r"(\{\{ *)(title::)([a-zA-Z0-9]*)( *(?:#[^}]*)?)( *\}\})")
    REF_CITE_RE = re.compile(r"(\{\{ *)(cite::)([a-zA-Z0-9]*)( *(?:#[^}]*)?)( *\}\})")
    REF_IMPT_RE = re.compile(
        r"(\{\{ *)((?:aside|import)::)([a-zA-Z0-9]*)( *(?:#[^}]*)?)( *\}\})"
    )

    text = page.content.get("plain")
    if text:
        text = replace_import_references(text, REF_IMPT_RE, merged_data, key, page)
        text = replace_cite_references(text, REF_CITE_RE, merged_data)
        text = replace_title_references(text, REF_TITLE_RE, merged_data)
        text = replace_slug_references(text, REF_SLUG_RE, merged_data)
        text = process_reference_links(text, REF_LINK_RE, merged_data, key)
        page.content["plain"] = text.strip()

For example, quote::$UID would be replaced with a quote embed of the provided uid.

I want a design that generalises better, provides more legibility and extensibility, and has support for parameters.

TLDR: @keyword(option="value") or something similar.

Core Idea: A single sigil, @, initiates a “function” with a clear name and parameters.

Syntax & Examples: