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 Jul 29, 2022
1 parent 6b09751 commit 77dfe53
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions scripts/generators/asciidoc_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,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 77dfe53

Please sign in to comment.