Skip to content

Commit

Permalink
feat: allow projects to create their own ASCIIDOC templates
Browse files Browse the repository at this point in the history
  • Loading branch information
maihde committed Aug 7, 2022
1 parent 1ef397e commit 46968b0
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion scripts/generators/asciidoc_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,14 @@ def save_asciidoc(f, text):
# jinja2 setup


cur_dir = path.abspath(path.curdir)
local_dir = path.dirname(path.abspath(__file__))
TEMPLATE_DIR = path.join(local_dir, '../templates')
CUR_TEMPLATE_DIR = path.join(cur_dir, 'templates')
LOCAL_TEMPLATE_DIR = path.join(local_dir, '../templates')
if path.exists(CUR_TEMPLATE_DIR):
TEMPLATE_DIR = CUR_TEMPLATE_DIR
elif path.exists(LOCAL_TEMPLATE_DIR):
TEMPLATE_DIR = LOCAL_TEMPLATE_DIR
template_loader = jinja2.FileSystemLoader(searchpath=TEMPLATE_DIR)
template_env = jinja2.Environment(loader=template_loader, keep_trailing_newline=True)

Expand Down

0 comments on commit 46968b0

Please sign in to comment.