소스 검색

Add script to check jinja syntax

master
jdongmo 4 년 전
부모
커밋
f5faadc302
1개의 변경된 파일18개의 추가작업 그리고 0개의 파일을 삭제
  1. +18
    -0
      files/check_jinja_syntax.py

+ 18
- 0
files/check_jinja_syntax.py 파일 보기

@@ -0,0 +1,18 @@
#!/usr/bin/env python3
# filename: check_jinja_syntax.py
import sys
import os
from jinja2 import Environment, FileSystemLoader

#for arg in sys.argv:
# print(arg)
env = Environment(loader=FileSystemLoader(sys.argv[1]))
#templates = []
#for x in env.list_templates():
# if x.endswith('.j2'):
# templates.append(x)
templates = [x for x in env.list_templates() if x.endswith('.j2')]
for template in templates:
print(template)
t = env.get_template(template)
env.parse(t)

불러오는 중...
취소
저장