Overriding stylesdir value in per-file attributes

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Overriding stylesdir value in per-file attributes

m52go
This post was updated on .
Hello -- I'm trying to apply a custom CSS file to a set of docs with a couple of subdirectories. I'm using the Asciidoctor Gradle Plugin (v1.5.7) plugin to do the batch conversion.

I set the following in build.gradle:

attributes
'stylesheet'        : 'custom.css',
'stylesdir'           : './css'

This works great for all docs in the root directory, but all docs in subdirectories throw a "stylesheet does not exist or cannot be read" during the build process.

So, I tried overriding the build.gradle setting in each subdirectory doc with something like the following:

:stylesdir: ../css
OR
:stylesdir: ../../css

...depending on how nested the doc file is.

But these per-file values are ignored!

They only seem to be acknowledged when there is no value specified in build.gradle, i.e., the only way I can get these styles applied to all docs is to not specify stylesdir in build.gradle and instead specify it in every single doc file.

I really don't like doing that, both because it's a little sloppy and because these docs are for an open-source project which anyone can contribute to, and we'd really rather not have per-file dependencies/quirks like this.

Any idea what I can try to avoid this? I've tried getting rid of the css/ directory (putting the css file in the root directory), setting the stylesdir as an option instead of an attribute, setting the stylesheet and stylesdir together in subdirectory docs, and a bunch of other things...nothing works.

Per-doc settings are always ignored when they're set in build.gradle—both for docs in the root directory AND docs in subdirectories

Any ideas what could be happening? Or is this how it's supposed to work?
Reply | Threaded
Open this post in threaded view
|

Re: Overriding stylesdir value in per-file attributes

mojavelinux
Administrator
If you want to be able to override an attribute in a document, you need to lower the precedence of the attribute assignment in the Gradle build file.


Cheers,

-Dan

On Wed, Oct 10, 2018 at 8:52 AM m52go [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Hello -- I'm trying to apply a custom CSS file to a set of docs with a couple of subdirectories. I'm using the Asciidoctor Gradle Plugin (v1.5.7) plugin to do the batch conversion.

I set the following in build.gradle:

attributes
'stylesheet'        : 'custom.css',
'stylesdir'           : './css'

This works great for all docs in the root directory, but all docs in subdirectories throw a "stylesheet does not exist or cannot be read" during the build process.

So, I tried overriding the build.gradle setting in each subdirectory doc with something like the following:

:stylesdir: ../css
OR
:stylesdir: ../../css

...depending on how nested the doc file is.

But these per-file values are ignored!

They only seem to be acknowledged when there is no value specified in build.gradle, i.e., the only way I can get these styles applied to all docs is to not specify stylesdir in build.gradle and instead specify it in every single doc file.

I really don't like doing that, both because it's a little sloppy and because these docs are for an open-source project which anyone can contribute to, and we'd really rather not have per-file dependencies/quirks like this.

Any idea what I can try to avoid this? I've tried getting rid of the css/ directory (putting the css file in the root directory), setting the stylesdir as an option instead of an attribute, setting the stylesheet and stylesdir together in subdirectory docs, and a bunch of other things...nothing works.

Per-doc settings are always ignored when they're set in build.gradle—both for docs in the root directory AND docs in subdirectories

Any ideas what could be happening?


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Overriding-stylesdir-value-in-per-file-attributes-tp6508.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML


--
Dan Allen | @mojavelinux | https://twitter.com/mojavelinux
Reply | Threaded
Open this post in threaded view
|

Re: Overriding stylesdir value in per-file attributes

m52go
Thank you so much Dan!! I had no idea about that. Works like a charm.