Skip to content

Latest commit

 

History

History
223 lines (175 loc) · 6.41 KB

UsageType.adoc

File metadata and controls

223 lines (175 loc) · 6.41 KB

asciidoctor-pdf-cjk-ext PDF THEME Usage Types

asciidoctor-pdf-cjk-ext PDF THEME supports 3 ways to use.

Supports 5 Language Code:

  • tc : Traditional Chinese

  • sc : Simplified Chinese

  • hk : Hong Kong

  • jp : Japanese

  • kr : Korean

Every Language supports 3 fonts:

  • Noto Sans CJK

  • Noto Sans Mono CJK

  • Noto Serif CJK

Type1 - Use as file

Run Command , ./install-zip-to-downloaded-resources-dir.sh xx

Please replace xx by your language code( EX: tc).

$ ./install-zip-to-downloaded-resources-dir.sh tc

It will install asciidoctor-pdf-cjk-ext THEME to downloaded-resources folder under your user home directory,

~/downloaded-resources or /home/YOUR-USERNAME/downloaded-resources

Add reference

Gradle

asciidoctorPdf {
...
  asciidoctorj {
...
    requires "rouge"

...
    attributes "build-gradle": file("build.gradle"),
        "jrubyVersion": "9.3.8.0",
        "toc": "",
...
        "pdf-fontsdir": "${System.getProperty("user.home")}/downloaded-resources/fonts;GEM_FONTS_DIR;",
        "pdf-themesdir": "${System.getProperty("user.home")}/downloaded-resources/themes",
        "pdf-theme": "default-ext-notosans-cjk-tc"

Type2 - Use as Jar file directly Without Maven installed

If you don’t have Maven installed, or don’t want to install asciidoctor-pdf-cjk-ext to your Maven Local Repo, you can choose this method.

Run Command , ./install-jar-to-libs-dir.sh xx

Please replace xx by your language code( EX: tc).

$ ./install-jar-to-libs-dir.sh tc

It will install asciidoctor-pdf-cjk-ext THEME to libs folder under your user home directory,

~/libs or /home/YOUR-USERNAME/libs

Add reference

Gradle

build.gradle
...
configurations {
    asciidoctorExt
}

dependencies {
  asciidoctorGems "rubygems:rouge:3.15.0"

  asciidoctorExt fileTree(dir: "${System.getProperty("user.home")}/libs", include: "*.jar")
}

asciidoctorPdf {
  dependsOn asciidoctorGemsPrepare

  baseDirFollowsSourceFile()

  asciidoctorj {
     modules {
       asciidoctorj {
         version "2.5.6"
         configurations "asciidoctorExt"
        }
...
        "pdf-fontsdir": "uri:classloader:/data/fonts;GEM_FONTS_DIR;",
        "pdf-themesdir": "uri:classloader:/data/themes",
        "pdf-theme": "default-ext-notoserif-cjk-tc"

Type3 - Use as Maven Local Repo, Need install Maven

Your machine needs to have Maven installed.

Run Command , ./install-jar-to-maven-local-repo.sh xx

Please replace xx by your language code( EX: tc).

$ ./install-jar-to-maven-local-repo.sh tc

It will install asciidoctor-pdf-cjk-ext THEME to your maven local repo.

~/.m2 or /home/YOUR-USERNAME/.m2

Add reference

Gradle

Please replace xx by your language code( EX: tc).

  • "com.life888888.lab:pdf-ext-notoserif-cjk-xx:0.1.0"

  • "com.life888888.lab:pdf-ext-notosansmono-cjk-xx:0.1.0"

  • "com.life888888.lab:pdf-ext-notosans-cjk-xx:0.1.0"

build.gradle
configurations {
    asciidoctorExt
}

dependencies {
 ...
   // * TC (Traditional Chinese)
   asciidoctorExt "com.life888888.lab:pdf-ext-notoserif-cjk-tc:0.1.0"
   asciidoctorExt "com.life888888.lab:pdf-ext-notosansmono-cjk-tc:0.1.0"
   asciidoctorExt "com.life888888.lab:pdf-ext-notosans-cjk-tc:0.1.0"
 ...
 }
  asciidoctorj {
     modules {
       asciidoctorj {
         ...
         configurations "asciidoctorExt"
        }
...
        "pdf-fontsdir": "uri:classloader:/data/fonts;GEM_FONTS_DIR;",
        "pdf-themesdir": "uri:classloader:/data/themes",
        "pdf-theme": "default-ext-notoserif-cjk-tc"

Maven

pom.xml
<plugins>
            <plugin>
                <groupId>org.asciidoctor</groupId>
                <artifactId>asciidoctor-maven-plugin</artifactId>
                <version>${asciidoctor.maven.plugin.version}</version>
                <dependencies>
                    <!-- tc (Traditional Chinese) -->
                    <!-- Font notoserif-cjk-tc -->
                    <dependency>
                        <groupId>com.life888888.lab</groupId>
                        <artifactId>pdf-ext-notoserif-cjk-tc</artifactId>
                        <version>0.1.0</version>
                    </dependency>
                    <!-- Font notosans-cjk-tc -->
                    <dependency>
                        <groupId>com.life888888.lab</groupId>
                        <artifactId>pdf-ext-notosans-cjk-tc</artifactId>
                        <version>0.1.0</version>
                    </dependency>
                    <!-- Font notosansmono-cjk-tc -->
                    <dependency>
                        <groupId>com.life888888.lab</groupId>
                        <artifactId>pdf-ext-notosansmono-cjk-tc</artifactId>
                        <version>0.1.0</version>
                    </dependency>
                    ...
                        <configuration>
                            <backend>pdf</backend>
                            <sourceDirectory>src/docs/asciidoc</sourceDirectory>
                            <sourceDocumentName>README-jp.adoc</sourceDocumentName>
                            <attributes>
                                <imagesdir>images</imagesdir>
                                <source-highlighter>rouge</source-highlighter>
                                <allow-uri-read/>
                                <icons>font</icons>
                                <pagenums/>
                                <toc/>
                                <idprefix/>
                                <idseparator>-</idseparator>
                                <!-- Fixes line wraps formatting inserting zero-width spaces (ZWSP) before CJ characters -->
                                <scripts>cjk</scripts>
                                <!-- Set asciidoctor-pdf-cjk-ext Japanese theme -->
                                <pdf-theme>default-ext-notosans-cjk-jp</pdf-theme>
                                <pdf-themesdir>uri:classloader:/data/themes</pdf-themesdir>
                                <pdf-fontsdir>uri:classloader:/data/fonts;GEM_FONTS_DIR;</pdf-fontsdir>
                            </attributes>
                        </configuration>