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

Automatically set stylesdir if style ends with .yml #1126

Closed
mojavelinux opened this issue Jul 3, 2019 · 2 comments
Closed

Automatically set stylesdir if style ends with .yml #1126

mojavelinux opened this issue Jul 3, 2019 · 2 comments
Assignees
Milestone

Comments

@mojavelinux
Copy link
Member

If the style is a path (indicated by the fact that it ends with .yml), automatically set the stylesdir to the directory of that path if not explicitly set.

For example, the following command:

asciidoctor-pdf -a pdf-style=/path/to/my-theme.yml source.adoc

would set the stylesdir to /path/to.

By doing so, resources in the theme file, such as images, will automatically get resolved from this directory.

@mojavelinux mojavelinux self-assigned this Jul 3, 2019
@mojavelinux mojavelinux added this to the v1.5.0.beta.1 milestone Jul 3, 2019
@mojavelinux
Copy link
Member Author

Here's the logic to use:

  • if the style is not set, use the built-in default theme and set the stylesdir to the built-in stylesdir
  • if the style ends with .yml and stylesdir is set, resolve the theme relative to the stylesdir and keep the stylesdir as is
  • if the style ends with .yml and stylesdir is not set, use the theme at the path specified and set the stylesdir to the directory of that path
  • if the style does not end with .yml and stylesdir is set, append -theme.yml to the style value, resolve the theme relative to the stylesdir, and leave the stylesdir as is
  • if the style does not end with .yml and stylesdir is not set, append -theme.yml to the style value, resolve the theme relative to the built-in stylesdir, and set the stylesdir to the built-in stylesdir

@mojavelinux
Copy link
Member Author

Btw, we're also proposing to rename pdf-style / pdf-stylesdir to pdf-theme / pdf-themesdir. See #1127.

mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Jul 4, 2019
mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Jul 4, 2019
…ith .yml

- if pdf-style value ends with .yml, and pdf-stylesdir is not set, set pdf-stylesdir to directory of pdf-style value
- resolve extended themes relative to calculated value of pdf-stylesdir
mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Jul 4, 2019
…ith .yml

- if pdf-style value ends with .yml, and pdf-stylesdir is not set, set pdf-stylesdir to directory of pdf-style value
- resolve extended themes relative to calculated value of pdf-stylesdir
mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Jul 5, 2019
…ith .yml

- if pdf-style value ends with .yml, and pdf-stylesdir is not set, set pdf-stylesdir to directory of pdf-style value
- resolve extended themes relative to calculated value of pdf-stylesdir
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

1 participant