jinja Evnironment

https://jinja.palletsprojects.com/en/master/api/#jinja2.Environment

class jinja2.Environment([options])

初始化參數

參數 描述
block_start_string The string marking the beginning of a block. Defaults to '{%'.
block_end_string The string marking the end of a block. Defaults to '%}'.
variable_start_string The string marking the beginning of a print statement. Defaults to '{{'.
variable_end_string The string marking the end of a print statement. Defaults to '}}'.
comment_start_string The string marking the beginning of a comment. Defaults to '{#'.
comment_end_string The string marking the end of a comment. Defaults to '#}'.
line_statement_prefix 自定義語句開頭,替代block_start_string
line_comment_prefix 自定義語句結尾,替代block_start_string
trim_blocks
lstrip_blocks
newline_sequence
keep_trailing_newline
extensions
optimized
undefined
finalize
autoescape
loader
cache_size
auto_reload
bytecode_cache
enable_async

對象方法

方法 描述
shared
sandboxed
filters
tests
globals
policies
code_generator_class
context_class
overlay([options])
undefined([hint, obj, name, exc])
add_extension(extension)
compile_expression(source, undefined_to_none=True)
compile_templates(target, extensions=None, filter_func=None, zip=‘deflated’, log_function=None, ignore_errors=True)
extend(**attributes)
from_string(source, globals=None, template_class=None)
get_or_select_template(template_name_or_list, parent=None, globals=None)
get_template(name, parent=None, globals=None)
join_path(template, parent)
list_templates(extensions=None, filter_func=None)
select_template(names, parent=None, globals=None)
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章