Closed life888888 closed 1 year ago
I haven't tried it myself, but I guess you're looking for the custom extensions option described at https://asciidoctor.github.io/asciidoctor-gradle-plugin/development-3.x/user-guide/#asciidoctorj-extensions
YES , THANK YOU.
I am package my CJK TTF and theme (base on asciidoctor-pdf-2.x)
pdf-ext-notosans-cjk-tc.jar
.
├── data
│ ├── fonts
│ │ ├── LICENSE
│ │ ├── notosans-cjk-tc-bold_italic.ttf
│ │ ├── notosans-cjk-tc-bold.ttf
│ │ ├── notosans-cjk-tc-italic.ttf
│ │ └── notosans-cjk-tc-normal.ttf
│ └── themes
│ ├── default-ext-notosans-cjk-tc-pdf-1-theme.yml
│ ├── default-ext-notosans-cjk-tc-theme.yml
│ ├── default-notosans-cjk-tc-pdf-1-theme.yml
│ ├── default-notosans-cjk-tc-theme.yml
│ ├── LICENSE
│ ├── LICENSE-asciidoctor-pdf
│ ├── LICENSE-asciidoctor-pdf-cjk-kai_gen_gothic
│ ├── notosans-cjk-tc-pdf-1-theme.yml
│ └── notosans-cjk-tc-theme.yml
└── META-INF
└── MANIFEST.MF
And I installed my jar to my local Maven Repo (~/.m2)
mvn install:install-file \
-Dfile=pdf-ext-notosans-cjk-tc.jar \
-DgroupId=com.life888888.lab \
-DartifactId=pdf-ext-notosans-cjk-tc \
-Dversion=1.0.0 \
-Dpackaging=jar
Then I download asciidoctor-gradle-examples
asciidoctor-gradle-examples-master/asciidoc-to-pdf-example
and I change build.gradle
plugins {
id 'org.asciidoctor.jvm.pdf' version '3.3.0'
id 'org.asciidoctor.jvm.gems' version '3.3.0'
}
apply plugin: 'java'
version = '1.0.0-SNAPSHOT'
repositories {
jcenter()
ruby.gems()
//ADD NEW
mavenLocal()
}
//ADD NEW
configurations {
asciidoctorExt
}
dependencies {
asciidoctorGems 'rubygems:rouge:3.15.0'
//ADD NEW
//asciidoctorExt 'com.life888888.lab:pdf-ext-notoserif-cjk-tc:1.0.0'
asciidoctorExt 'com.life888888.lab:pdf-ext-notosans-cjk-tc:1.0.0'
}
asciidoctorPdf {
dependsOn asciidoctorGemsPrepare
baseDirFollowsSourceFile()
asciidoctorj {
//ADD NEW
modules {
asciidoctorj {
version '2.5.6'
configurations 'asciidoctorExt'
}
pdf {
version '2.3.0'
}
}
requires 'rouge'
attributes 'build-gradle': file('build.gradle'),
'sourcedir': project.sourceSets.main.java.srcDirs[0],
'endpoint-url': 'http://example.org',
'source-highlighter': 'rouge',
'imagesdir': './images',
'toc': 'left',
'icons': 'font',
'idprefix': '',
'idseparator': '-',
'scripts': 'cjk',
'pdf-fontsdir': 'uri:classloader:/data/fonts;GEM_FONTS_DIR;',
'pdf-themesdir': 'uri:classloader:/data/themes',
'pdf-theme': 'default-ext-notosans-cjk-tc'
}
}
// alias
task asciidoctor(dependsOn: asciidoctorPdf)
Now I can use asciidoctor-pdf 2.x and apply my jar (CJK fonts and themes)
THANK YOU AGAIN.
I am package some ttf and theme to a jar file (pdf-ext-notoserif-cjk-tc.jar) like this
I install this jar to my local maven
I can add this jar in maven pom.xml (asciidoctor-pdf-with-theme-example)
pom.xml.txt
I can successful , generate a PDF with CJK fonts and theme.
But , I can not add my pdf-ext-notoserif-cjk-tc.jar to gradle dependencies
https://github.com/asciidoctor/asciidoctor-gradle-examples/tree/master/asciidoc-to-pdf-example/build.gradle
build.gradle.txt
Then I run
I can find something , but I do not see my dependencies jar in AsciidoctorJ instance classpath.
SO, HOW TO ADD dependencies jar TO Gradle Task asciidoctorPdf with AsciidoctorJ instance classpath ???