Skip to content

dongzhigang13305312738-art/paper-skills / complete-example

complete-example

Verified

当用户明确要求"填充示例内容""生成示例""补充 LaTeX 示例"时使用。AI 增强版 LaTeX 示例智能生成器,实现 AI 与硬编码的有机融合:AI 做"语义理解"(分析章节主题、推理资源相关性、生成连贯叙述),硬编码做"结构保护"(格式验证、哈希校验、访问控制)。

scripts/template_renderer.py

View on GitHub
"""
Safe LaTeX template renderer.

We intentionally do NOT use Python's `str.format()` because LaTeX contains many
literal `{...}` which would be interpreted as format placeholders and crash.

Supported placeholders:
- `{{key}}`   -> value
- `{{{key}}}` -> `{value}` (wrap with one pair of braces)
"""

from __future__ import annotations

from typing import Any, Dict
import re


_TRIPLE_RE = re.compile(r"\{\{\{([a-zA-Z0-9_]+)\}\}\}")
_DOUBLE_RE = re.compile(r"\{\{([a-zA-Z0-9_]+)\}\}")


def render_template(template: str, values: Dict[str, Any]) -> str:
    def triple_sub(m: re.Match) -> str:
        key = m.group(1)
        if key not in values:
            raise KeyError(key)
        return "{" + str(values[key]) + "}"

    def double_sub(m: re.Match) -> str:
        key = m.group(1)
        if key not in values:
            raise KeyError(key)
        return str(values[key])

    out = _TRIPLE_RE.sub(triple_sub, template)
    out = _DOUBLE_RE.sub(double_sub, out)
    return out

slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."Stars: 198kUpdated Claude CodeCodexVerifiedInstall
ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt.Stars: 194kUpdated Claude CodeCodexVerifiedInstall