- Split monolithic build-preview.go into modular packages: tools.go (entry), cli/ (list/create/delete/preview commands), config/ (JSON loading), preview/ (rendering engine, funcs, locale) - Extract all template metadata into data/templates_config.json as single source of truth — no hardcoded template data in Go - Replace hand-rolled CLI parsing with github.com/urfave/cli/v2 - Add sensible defaults for --folder (../themes) and --config (./data/templates_config.json) — most commands now run bare - Add type-coercing gt/lt/ge/le template funcs for JSON float64 - Fix AppUrl to gitea.com matching official template convention - rendered.js now exports __REGISTRY__ and __PARAMS__ alongside __RENDERED__ — preview/index.html reads all from single source - Cross-validate all 11 template data contexts against official Gitea source (services/mailer/*.go + templates/mail/*.tmpl) - Update all docs (README, AGENTS, CONTRIBUTING, 5 languages) to reflect new CLI workflow with create scaffolding command Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2.1 KiB
2.1 KiB
コントリビューション — Gitea メールテンプレート
参加方法
新しいスタイルの追加
- ツールでスキャフォールド:
cd tools && go run . create <style-name>— 全11種類のメールタイプ用のプレースホルダ.tmplファイルを含む完全なディレクトリ構造を作成します themes/<style-name>/内の各.tmplファイルを独自デザインで編集- プレビューを再生成:
cd tools && go run . preview all(ビルドスクリプトがthemes/以下の全テーマを自動検出し、テーマセレクターも自動生成されます) - スクリーンショット付きで PR を提出
スタイルガイドライン
- 各スタイルに 全11種類のテンプレート を含める
- Gitea 組み込み関数のみ使用
- 翻訳キーは Gitea 公式ロケール (
mail.*) から .DisplayNameを使用しない (collaborator, transfer, release, workflow_run, assigned, default)- 600px 幅のメールクライアント向けにデザイン
- Gmail, Outlook, Apple Mail でテスト
バグレポート
- Go 変数が正しいか確認
- 翻訳キーが Gitea ロケールと一致するか確認
.DisplayNameが誤用されていないか確認- プレビューを再生成:
cd tools && go run . preview all - スタイル名とメールタイプを明記して issue を作成
開発セットアップ
ローカルプレビュー
- データを生成:
cd tools && go run . preview all preview/index.htmlをブラウザで開く- Modern, Gmail, Outlook, Raw source を切り替えて確認
結合テスト
Gitea にデプロイ: Site Administration > Configuration > Mailer > Send Test Email
コミット規約
style(<name>):— スタイルのテンプレート変更preview:— プレビューツールの変更tools:— Go ビルドスクリプトの変更docs:— ドキュメントと翻訳fix:— バグ修正project:— README, LICENSE, メタファイル
ライセンス
貢献により、MIT ライセンスに同意したものとみなします。