← 返回
未分类 中文

Iflow Template Toolkit

Dependency-free template engine with variable substitution, conditionals, loops, and multi-language support for iFlow skills.
无依赖的模板引擎,支持变量替换、条件判断、循环和多语言,适用于 iFlow 技能。
sylvanxiao sylvanxiao 来源
未分类 clawhub v1.0.0 1 版本 100000 Key: 无需
★ 0
Stars
📥 316
下载
💾 0
安装
1
版本
#latest

概述

iFlow Template Toolkit

Description

A simple, dependency-free template and internationalization toolkit for iFlow skills. Provides template rendering with variable substitution, conditionals, and loops, plus multi-language support.

Installation

# Clone or copy to your skills directory
openclaw skills install iflow-template-toolkit

Usage

Template Engine

from iflow_template_toolkit import TemplateEngine, render_template

# Quick render from string
result = render_template("Hello {{name}}!", {"name": "World"})
# Output: "Hello World!"

# Using TemplateEngine class
engine = TemplateEngine("./templates")
result = engine.render_file("config.md", {
    "project_name": "my-project",
    "team_size": 5
})

Template Syntax

Variables:

Hello {{name}}!
Project: {{project_name}}

Conditionals:

{% if status == "active" %}
Status is active
{% elif status == "pending" %}
Status is pending
{% else %}
Status unknown
{% endif %}

Loops:

{% for item in items %}
- {{item}} ({{index1}})
{% endfor %}

Internationalization

from iflow_template_toolkit import Translator, t, init_translator

# Initialize with translations
init_translator({
    'en': {'greeting': 'Hello', 'farewell': 'Goodbye'},
    'zh': {'greeting': '你好', 'farewell': '再见'}
}, default_lang='en')

# Translate
t('greeting')           # "Hello"
t('greeting', lang='zh')  # "你好"

# With interpolation
t('welcome', name='John')  # "Welcome, John!" (if translation is "Welcome, {name}!")

Features

FeatureDescription
----------------------
Variable Substitution{{variable}} syntax
Conditionals{% if %}...{% elif %}...{% else %}...{% endif %}
Loops{% for item in items %}...{% endfor %}
Comparison==, !=, in, not in operators
Loop Variablesindex, index1, first, last
Multi-languageJSON-based translation files
FallbackFalls back to default language

Requirements

  • Python 3.6+
  • No external dependencies

File Structure

iflow-template-toolkit/
├── src/
│   ├── __init__.py
│   ├── template_engine.py
│   ├── i18n/
│   │   ├── __init__.py
│   │   ├── translator.py
│   │   └── langs/
│   │       ├── en.json
│   │       └── zh.json
│   └── templates/
├── tests/
├── SKILL.md
└── README.md

Version

1.0.0

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-05-07 09:02 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

dev-programming

CodeConductor.ai

larsonreever
AI驱动平台,提供快速全栈开发、智能体、工作流自动化及低代码AI集成的可扩展产品创建。
★ 72 📥 181,714
dev-programming

Github

steipete
使用 `gh` CLI 与 GitHub 交互,通过 `gh issue`、`gh pr`、`gh run` 和 `gh api` 管理议题、PR、CI 运行及高级查询。
★ 677 📥 326,915
ai-agent

Auto Create AI Team

sylvanxiao
自动创建并配置AI团队结构,支持单、双或自定义模式,集成MCP和OpenClaw服务。
★ 0 📥 664