调整版本并做测试

This commit is contained in:
2026-02-27 17:10:54 +08:00
parent fa673138f6
commit 31be9d0e97
77 changed files with 679 additions and 25 deletions

View File

@@ -0,0 +1,38 @@
#!/usr/bin/env python3.9
# -*- coding: utf-8 -*-
"""
JFinal RenderDirective - Render Directive
"""
from ...Directive import Directive
from ...Env import Env
from ...stat.Scope import Scope
class RenderDirective(Directive):
"""Render directive for template rendering"""
def exec(self, env: Env, scope: Scope, writer) -> None:
"""
Execute render directive
Args:
env: Template environment
scope: Execution scope
writer: Output writer
"""
# Simplified implementation
if self.expr_list:
# Get template name
template_name = self.expr_list.eval(scope)
if template_name:
# Get engine from env
from ...Engine import Engine
engine = Engine.use()
# Render template
template = engine.get_template(str(template_name))
template.render(scope.get_data(), writer)
def __repr__(self) -> str:
return "RenderDirective()"