rockyallen wrote
- Is there an existing way to do what I want?
- Is it of interest to anyone else?
You can always use the SPI interface (
http://asciidoctor.org/docs/asciidoctorj/#extension-spi). This involves adding your extension with the`ExtensionRegistry` file in a jar in the classpath of the ant context.
However, the SPI has some limitations, because it means playing with the classpath and this is not always easy.
If Ant allows to easily set the classpath for a task I don't see this is a major issue. If not, then your proposal can come handy.
rockyallen wrote
- Has someone else tried it?
- The above approach uses Ant to instantiate the extensions; is there a use case for implementing the other ExtensionRegistry.register methods (class and classnane)?
A similar discussion took place arround the maven integration some time ago, and I feel the pros/cons are the same here.
The advantage of defining extensions in maven's POM is to be able to play with them using profiles, other than that, the SPI approach is OK.
In my case, I needed to add some customization to documents only under certain conditions.
Here is the conversation:
https://github.com/asciidoctor/asciidoctor-maven-plugin/issues/146.
Let me know if you have any doubt about it.