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 loading of pdf themes from jar files #598

Closed
svenreimers opened this issue Sep 30, 2016 · 3 comments
Closed

Allow loading of pdf themes from jar files #598

svenreimers opened this issue Sep 30, 2016 · 3 comments
Assignees
Milestone

Comments

@svenreimers
Copy link

Seems that theme files can not be loaded from custom jar files or the classpath in general (correct me if I am wrong).

Having this feature allows for simpler redistribution and reusage, if asciidoctor is embedded in e.g. a test reporting engine.

@mojavelinux
Copy link
Member

mojavelinux commented Oct 1, 2016

This issue is a duplicate of / in the same spirit as #420. In that issue you can find a link to a Gradle plugin that @fwilhe created that allows themes to be loaded from git repository until there's a formal solution in place in Asciidoctor PDF.

My position is that the converter is not yet ready to take this formal step, so the Gradle plugin is a good immediate / temporary solution. The theme engine is still stabilizing, so I don't really want themes to rely on loading behavior at this point. We may still need to change things around in the design to accommodate that use case properly. But we will.

@mchmielarz
Copy link

Hi, did you make some progress with this issue?

@mojavelinux
Copy link
Member

mojavelinux commented Sep 16, 2019

Asciidoctor PDF (running in a JVM) can read a file if it begins with uri:classloader:. So it should be possible to set the pdf-theme to a value that uses this prefix.

So here's what you do:

  • Create a folder named themes
  • Add the file my-theme.yml to this folder
  • Populate the contents with:
    extends: default
    base:
      font-color: #ff0000
    
  • jar that folder up as themes.jar
  • add that jar to the classpath
  • set pdf-theme as follows: -a pdf-theme=uri:classloader:themes/my-theme.yml

Voila! You've loaded a theme from a jar file.

Outside of this, I believe this is a Gradle or Maven plugin issue.

@mojavelinux mojavelinux added this to the support milestone Sep 16, 2019
@mojavelinux mojavelinux self-assigned this Sep 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants