def initialize_jinja_env(cache_dir): jinja_env = jinja2.Environment( loader=jinja2.FileSystemLoader(TEMPLATES_DIR), # Bytecode cache is not concurrency-safe unless pre-cached: # if pre-cached this is read-only, but writing creates a race condition. bytecode_cache=jinja2.FileSystemBytecodeCache(cache_dir), keep_trailing_newline=True, # newline-terminate generated files lstrip_blocks=True, # so can indent control flow tags trim_blocks=True) jinja_env.filters.update({ 'blink_capitalize': capitalize, 'exposed': exposed_if, 'format_blink_cpp_source_code': format_blink_cpp_source_code, 'format_remove_duplicates': format_remove_duplicates, 'origin_trial_enabled': origin_trial_enabled_if, 'runtime_enabled': runtime_enabled_if, 'runtime_enabled_function': v8_utilities.runtime_enabled_function, 'secure_context': secure_context_if }) jinja_env.filters.update(constant_filters()) jinja_env.filters.update(method_filters()) return jinja_env
def initialize_jinja_env(cache_dir): jinja_env = jinja2.Environment( loader=jinja2.FileSystemLoader(templates_dir), # Bytecode cache is not concurrency-safe unless pre-cached: # if pre-cached this is read-only, but writing creates a race condition. bytecode_cache=jinja2.FileSystemBytecodeCache(cache_dir), keep_trailing_newline=True, # newline-terminate generated files lstrip_blocks=True, # so can indent control flow tags trim_blocks=True) jinja_env.filters.update({ 'blink_capitalize': capitalize, 'exposed': exposed_if, 'for_origin_trial_feature': for_origin_trial_feature, 'runtime_enabled': runtime_enabled_if, 'unique_by': unique_by, }) jinja_env.filters.update(attribute_filters()) jinja_env.filters.update(v8_interface.constant_filters()) jinja_env.filters.update(method_filters()) return jinja_env
def initialize_jinja_env(cache_dir): jinja_env = jinja2.Environment( loader=jinja2.FileSystemLoader(templates_dir), # Bytecode cache is not concurrency-safe unless pre-cached: # if pre-cached this is read-only, but writing creates a race condition. bytecode_cache=jinja2.FileSystemBytecodeCache(cache_dir), keep_trailing_newline=True, # newline-terminate generated files lstrip_blocks=True, # so can indent control flow tags trim_blocks=True) jinja_env.filters.update({ 'blink_capitalize': capitalize, 'exposed': exposed_if, 'for_origin_trial_feature': for_origin_trial_feature, 'runtime_enabled': runtime_enabled_if, 'unique_by': unique_by, }) jinja_env.filters.update(attribute_filters()) jinja_env.filters.update(v8_interface.constant_filters()) jinja_env.filters.update(method_filters()) return jinja_env
def initialize_jinja_env(cache_dir): jinja_env = jinja2.Environment( loader=jinja2.FileSystemLoader(TEMPLATES_DIR), # Bytecode cache is not concurrency-safe unless pre-cached: # if pre-cached this is read-only, but writing creates a race condition. bytecode_cache=jinja2.FileSystemBytecodeCache(cache_dir), keep_trailing_newline=True, # newline-terminate generated files lstrip_blocks=True, # so can indent control flow tags trim_blocks=True) jinja_env.filters.update({ 'blink_capitalize': capitalize, 'exposed': exposed_if, 'format_blink_cpp_source_code': format_blink_cpp_source_code, 'format_remove_duplicates': format_remove_duplicates, 'runtime_enabled': runtime_enabled_if, 'runtime_enabled_function': v8_utilities.runtime_enabled_function, 'secure_context': secure_context_if}) jinja_env.filters.update(constant_filters()) jinja_env.filters.update(method_filters()) return jinja_env