初始提交,未完全测试

This commit is contained in:
2026-02-27 14:37:10 +08:00
parent 76c0f469be
commit e270f02073
68 changed files with 5886 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
#!/usr/bin/env python3.9
# -*- coding: utf-8 -*-
"""
JFinal CallDirective - Call Directive
"""
from ...Directive import Directive
from ...Env import Env
from ...stat.Scope import Scope
class CallDirective(Directive):
"""Call directive for calling template functions"""
def exec(self, env: Env, scope: Scope, writer) -> None:
"""
Execute call directive
Args:
env: Template environment
scope: Execution scope
writer: Output writer
"""
if self.expr_list:
# Get function name
function_name = self.expr_list.eval(scope)
if function_name:
# Get function from env
func = env.get_function(str(function_name))
if func:
# Call function
func.exec(env, scope, writer)
def __repr__(self) -> str:
return "CallDirective()"