Quick fix to module loading when using fancy D&D sheets.

This commit is contained in:
Mark Wolfman
2021-08-05 14:38:24 -05:00
parent 1e6d877e7c
commit a1659873dc
3 changed files with 14 additions and 11 deletions
+4 -5
View File
@@ -99,10 +99,9 @@ used, sub-folders will also be parsed.
dungeon-sheets contains definitions for standard weapons and spells, dungeon-sheets contains definitions for standard weapons and spells,
so attack bonuses and damage can be calculated automatically. so attack bonuses and damage can be calculated automatically.
If you have the excellent *dndbook* LaTeX template, consider using the Consider using the ``-F`` option to include the excellent D&D 5e
``-F`` option to include this template for rendering spellbooks, druid template for rendering spellbooks, druid wild forms and features
wild forms and features pages: pages (https://github.com/rpgtex/DND-5e-LaTeX-Template).
https://github.com/rpgtex/DND-5e-LaTeX-Template
If you'd like a **step-by-step walkthrough** for creating a new If you'd like a **step-by-step walkthrough** for creating a new
character, just run ``create-character`` from a command line and a character, just run ``create-character`` from a command line and a
@@ -115,7 +114,7 @@ Content Descriptions
The descriptions of content elements (e.g. classes, spells, etc.) are The descriptions of content elements (e.g. classes, spells, etc.) are
included in docstrings. The descriptions should ideally conform to included in docstrings. The descriptions should ideally conform to
reStructured text. This allows certain formatting elements to be reStructured text. This allows certain formatting elements to be
properly parsed and rendered into LaTeX:: properly parsed and rendered into LaTeX or HTML::
class Scrying(Spell): class Scrying(Spell):
"""You can see and hear a particular creature you choose that is on """You can see and hear a particular creature you choose that is on
+1 -1
View File
@@ -1 +1 @@
0.16.0 0.16.1
+9 -5
View File
@@ -61,18 +61,22 @@ def create_latex_pdf(
tex_command_line = [ tex_command_line = [
"pdflatex", "pdflatex",
"--output-directory", "--output-directory",
output_dir, str(output_dir),
"-halt-on-error", "-halt-on-error",
"-interaction=nonstopmode", "-interaction=nonstopmode",
tex_file, str(tex_file),
] ]
environment = os.environ environment = os.environ
tex_env = environment.get('TEXINPUTS', '') tex_env = environment.get('TEXINPUTS', '')
module_directory = str(Path(__file__).parent) module_root = Path(__file__).parent / "modules/"
environment['TEXINPUTS'] = f".:{module_directory}/modules//:" + tex_env module_dirs = [module_root / mdir for mdir in ["DND-5e-LaTeX-Template"]]
log.debug(f"Loading additional modules from {module_dirs}.")
environment['TEXINPUTS'] = f".:{':'.join(str(d) for d in module_dirs)}:" + tex_env
passes = 2 if use_dnd_decorations else 1 passes = 2 if use_dnd_decorations else 1
log.debug(tex_command_line)
log.debug("LaTeX command: %s" % " ".join(tex_command_line))
log.debug("LaTeX environ: %s" % environment)
try: try:
for i in range(passes): for i in range(passes):
result = subprocess.run( result = subprocess.run(