Open ysb33r opened 5 years ago
I really want to move people away from the stylesheet factory because it's not really maintained except for producing the default stylesheet. And that build is likely going to moved into core.
Better would be to integrate with the following themes that extend from the default stylesheet: https://github.com/darshandsoni/asciidoctor-skins
Conceptually a DSL like this might work:
plugins {
id 'org.asciidoctor.jvm.convert' version '1.2.3'
id 'org.asciidoctor.html-skins' version '1.2.3'
}
asciidoctor {
htmlskin {
skin 'clear'
}
}
(It should also be possible to use the org.asciidoctor.js.convert
plugin instead of the org.asciidoctor.jvm.convert
task)
A possible implementation:
htmlskin
extension is added to all org.asciidoctor.gradle.jvm.AsciidoctorTask
and org.asciidoctor.gradle.js.nodejs.AsciidoctorTask
instances.asciidoctorj
or asciidoctorjs
task extension. The attributeProvider will add stylesheet
attribute, but only if a value is actually set for htmlskins.skin
.resources
will have an additional copySpec added, to copy the appropriate CSS files.pdfThemes
a project extension will be added to take care of downloading the skins. In most cases this will not be need to be set unless the script author want to point to another repo or commit identifierIt can be a great feature
My only concern is that it's seem different to pdfThemes. Maybe a similar syntax to pdf. Something as:
htmlThemes{
local 'myname', {
styleDir=file('....')
styleName='bot-orange'
}
}
asciidoctor{
theme 'myname'
}
FYI, as of Asciidoctor PDF beta.1, it's now pdf-theme and pdf-themesdir. (We're dropping the term style in this context).
This part is easy
htmlThemes{
local 'myname', {
styleDir=file('....')
styleName='bot-orange'
}
}
and it will be there, but this is not
asciidoctor {
theme 'myname'
}
The reason is that at this point in time I would prefer to inject this as a task extension when the plugin is applied. If the above is to be supported I have to build support directly into the org.asciidoctor.gradle.jvm.AsciidoctorTask
and org.asciidoctor.gradle.js.nodejs.AsciidoctorTask
. It will also mean that instead of a separate plugin, htmlThemes
will be available whenever org.asciidoctor.js.convert
org.asciidoctor.jvm.convert` plugin is applied.
Maybe the latter alternative is feasible, I have just not been convinced whether this is better.
FYI, as of Asciidoctor PDF beta.1, it's now pdf-theme and pdf-themesdir. (We're dropping the term style in this context).
@mojavelinux See #438
https://github.com/asciidoctor/asciidoctor-stylesheet-factoryAs per @mojavelinux recommendation integrate with https://github.com/darshandsoni/asciidoctor-skins