Skip to content

Commit

Permalink
Merge pull request #173 from PreTeXtBook/update-core
Browse files Browse the repository at this point in the history
Update core
  • Loading branch information
StevenClontz authored Oct 29, 2021
2 parents 2da3536 + b50ad4e commit 910230f
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 19 deletions.
16 changes: 10 additions & 6 deletions pretext/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,15 +224,16 @@ def build(self,target_name,webwork=False,diagrams=False,diagrams_format='default
else:
log.warning(f"Destorying directory {target.output_dir()} to clean previously built files.")
shutil.rmtree(target.output_dir())
#if custom xsl, copy it into a temporary directory (different from the building temporary directory)
custom_xsl = None
if target.xsl_path() is not None:
temp_xsl_dir = tempfile.mkdtemp()
log.info(f'Building with custom xsl {target.xsl_path()} specified in project.ptx')
utils.copy_fix_xsl(target.xsl_path(), temp_xsl_dir)
custom_xsl = os.path.join(temp_xsl_dir, os.path.basename(target.xsl_path()))
#build in temporary directory so ptxcore doesn't complain
with tempfile.TemporaryDirectory() as temp_dir:
log.info(f"Preparing to build into a temporary directory.")
# copy custom xsl if used
custom_xsl = None
if target.xsl_path() is not None:
log.info(f'Building with custom xsl {target.xsl_path()} specified in project.ptx')
utils.copy_fix_xsl(target.xsl_path(), temp_dir)
custom_xsl = os.path.join(temp_dir, os.path.basename(target.xsl_path()))
#build targets:
if webwork:
# prepare params; for now assume only server is passed
Expand Down Expand Up @@ -293,6 +294,9 @@ def build(self,target_name,webwork=False,diagrams=False,diagrams_format='default
log.info(f"\nCopying successful build from {temp_dir} into {target.output_dir()}.")
shutil.copytree(temp_dir,target.output_dir(),dirs_exist_ok=True)
log.info(f"\nSuccess! Run `pretext view {target.name()}` to see the results.\n")
# remove temporary xsl directory if it was created:
if os.path.exists(temp_xsl_dir):
shutil.rmtree(temp_xsl_dir)

def publish(self,target_name,commit_message="Update to PreTeXt project source."):
target = self.target(target_name)
Expand Down
2 changes: 1 addition & 1 deletion pretext/static/CORE_COMMIT
Original file line number Diff line number Diff line change
@@ -1 +1 @@
95c1b7d4dbfc03c746d5a367b516cc79cd55c1c5
4b2af9a0bd70957803ca9146841021f6147e4520
8 changes: 4 additions & 4 deletions templates/article/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ output
generated-assets

# error logs
.error-schema.log
error-schema.log
.error-syntax.log
error-syntax.log
.error_schema.log
error_schema.log
.error_syntax.log
error_syntax.log
8 changes: 4 additions & 4 deletions templates/book/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ output
generated-assets

# error logs
.error-schema.log
error-schema.log
.error-syntax.log
error-syntax.log
.error_schema.log
error_schema.log
.error_syntax.log
error_syntax.log
8 changes: 4 additions & 4 deletions templates/hello/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ output
generated-assets

# error logs
.error-schema.log
error-schema.log
.error-syntax.log
error-syntax.log
.error_schema.log
error_schema.log
.error_syntax.log
error_syntax.log

0 comments on commit 910230f

Please sign in to comment.