Skip to content

Commit

Permalink
remove pymupdf options (#773)
Browse files Browse the repository at this point in the history
* prep cli for pymupdf switch from core

* fix formatting
  • Loading branch information
oscarlevin authored Jul 17, 2024
1 parent f3f28df commit a3788e7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions pretext/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -525,10 +525,10 @@ def build(
help="Generate all possible asset formats rather than just the defaults for the specified target.",
)
@click.option(
"--pymupdf",
"--non-pymupdf",
is_flag=True,
default=False,
help="Used to test new pyMuPDF method for generating svg and png.",
help="Used to revert to non-pymupdf (legacy) method for generating svg and png.",
)
@nice_errors
def generate(
Expand All @@ -537,7 +537,7 @@ def generate(
all_formats: bool,
only_changed: bool,
xmlid: Optional[str],
pymupdf: bool,
non_pymupdf: bool,
) -> None:
"""
Generate specified (or all) assets for the default target (first target in "project.ptx"). Asset "generation" is typically
Expand Down Expand Up @@ -574,7 +574,7 @@ def generate(
all_formats=all_formats,
only_changed=only_changed, # Unless requested, generate all assets, so don't check the cache.
xmlid=xmlid,
pymupdf=pymupdf,
non_pymupdf=non_pymupdf,
)
log.info("Finished generating assets.\n")
except ValidationError as e:
Expand Down
6 changes: 3 additions & 3 deletions pretext/project/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -736,15 +736,15 @@ def generate_assets(
all_formats: bool = False,
only_changed: bool = True,
xmlid: t.Optional[str] = None,
pymupdf: bool = False,
non_pymupdf: bool = False,
) -> None:
"""
Generates assets for the current target. Options:
- requested_asset_types: optional list of which assets to generate (latex-image, sagemath, asymptote, etc). Default will generate all asset types found in target.
- all_formats: boolean to decide whether the output format of the assets will be just those that the target format uses (default/False) or all possible output formats for that asset (True).
- only_changed: boolean. When True (default), function will only generate assets that have changed since last generation. When False, all assets will be built (hash table will be ignored).
- xmlid: optional string to specify the root of the subtree of the xml document to generate assets within.
- pymupdf: temporary boolean to test alternative image generation with pymupdf instead of external programs.
- non_pymupdf: temporary boolean to revert to legacy alternative image generation without pymupdf (and use old external programs).
"""
# If generate was not called for just webwork, ensure that the webwork representations file is present.
if requested_asset_types != ["webwork"] and requested_asset_types != [
Expand Down Expand Up @@ -939,7 +939,7 @@ def generate_assets(
dest_dir=self.generated_dir_abspath() / "latex-image",
outformat=outformat,
method=self.latex_engine,
pyMuPDF=pymupdf,
pyMuPDF=not (non_pymupdf),
)
successful_assets.append(("latex-image", id))
except Exception as e:
Expand Down

0 comments on commit a3788e7

Please sign in to comment.