-
Notifications
You must be signed in to change notification settings - Fork 172
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
It should be possible to register an instance in the javaConverterRegistry #932
Comments
Agreed, we might want to add this too. asciidoctor.convert(document, OptionsBuilder.options()
.option('credentials-path', '/path/to/credentials.json'').backend('googleslides') And then in the Converter: @Override
String convert(ContentNode node, String transform, Map<Object, Object> opts) {
String credentials = node.getDocument().getOptions().get('credentials-path')
...
} I think this solution would also have some advantages in multithreaded environments when different threads/contexts would require different credentials. |
Thanks Robert for your reply. Another alternative would be to retrieve the Document (and therefore the options) from the constructor. I didn't try but reading the Ruby code I believe that Asciidoctor (Ruby) passes the Document as an options when the converter is instantiated/created (see lib/asciidoctor/document.rb#L1128-L1144) So in theory, the following should work: class GoogleSlidesConverter extends AbstractConverter {
public GoogleSlidesConverter(String backend, Map<Object, Object> opts) {
String credentials = ((Document) opts.get("document")).getOptions().get("credentials-path")
}
} |
Yes, that should work too. |
This ticket is stale but still open. It would be helpful to have a functional interface |
Asciidoctor (Ruby) allows to register both class and instance. Registering an instance can be useful when you want to pass additional options.
Consider the following example:
In this example, the converter needs a credentials file to authenticate with the Google Slides API.
The text was updated successfully, but these errors were encountered: