Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow optimizer to be specified using the :pdf_optimizer option #1785

Closed
mojavelinux opened this issue Oct 7, 2020 · 2 comments
Closed

Allow optimizer to be specified using the :pdf_optimizer option #1785

mojavelinux opened this issue Oct 7, 2020 · 2 comments
Assignees
Milestone

Comments

@mojavelinux
Copy link
Member

mojavelinux commented Oct 7, 2020

Currently, it's only possible to override the optimizer by implementing (or patching) the built-in Asciidoctor::PDF::Optimizer class (see README). Instead, it should be possible to pass a custom class or object to the API using the :pdf_optimizer option.

The interface for the Optimizer is:

class Optimizer
  def initialize quality, compatibility_level, compliance; end
  def optimize_file path; end
end

An alternative would be to allow the class to self register, similar to how the syntax highlighter adapters or converter work in core.

@graphitefriction graphitefriction added this to the v2.1.x milestone May 17, 2022
@mojavelinux mojavelinux modified the milestones: v2.1.x, v2.2.x Jun 21, 2022
@mojavelinux mojavelinux modified the milestones: v2.2.x, v2.3.x Jul 22, 2022
@mojavelinux mojavelinux modified the milestones: v2.3.x, v3.0.x Aug 16, 2022
@mojavelinux mojavelinux self-assigned this Sep 3, 2022
@mojavelinux
Copy link
Member Author

I'm going to create a separate issue for allowing new optimizers to be registered by name, then activated using the pdf-optimizer attribute. This issue will be repurposed to add the :pdf_optimizer option to the API.

@mojavelinux mojavelinux changed the title Allow optimizer to be pluggable Allow optimizer to be specified using the :pdf_optimizer option Sep 3, 2022
@mojavelinux
Copy link
Member Author

The :pdf_optimizer option expects either a class or an object that responds to the new method.

mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Sep 3, 2022
mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Sep 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants