/asciidoctor-pdf-cjk-ext-gradle-examples

This repository contains a collection of sample projects that demonstrate numerous ways to use the Asciidoctor PDF CJK Ext Theme with Asciidoctor Gradle plugin in a Gradle project.

Primary LanguageShellOtherNOASSERTION

Asciidoctor PDF CJK Ext Theme Gradle Examples

This repository contains a collection of sample projects that demonstrate numerous ways to use the Asciidoctor PDF CJK Ext Theme with Asciidoctor Gradle plugin in a Gradle project.

The following content is translated into English by Google Translate.

Introduction

This projects is to show:

  • How to use Asciidoctor PDF CJK Ext Theme with Asciidoctor Gradle Plugin.

  • How to config Asciidoctor Gradle Plugin use Asciidoctor PDF 2.x

Getting the examples

Clone the example repository using git:

$ git clone https://github.com/life888888/asciidoctor-pdf-cjk-ext-gradle-examples

Example catalog

Important
Prepare

Please read Usage Type first.

And select one way to install something.

You can treat each project as a distinct module. Refer to the README file in each individual project to learn how to run it.

$ cd xxxx
$ ./gradlew clean asciidoctor

You can find the resulting pdf files in the build/docs/asciidocPdf directory of each project.

Warning
WARNING

Alternatively, you can optionally run all of examples at once using the following command from the repository root:

$ ./gradlew clean asciidoctor

While you can do this, I don’t recommend it.

Because it takes a long time to execute all at once.

In addition, some projects need to be installed according to specific types. See Usage Type.

Build processing will fail if certain types of packages are not pre-installed.

Suggested reading order for sample projects:

cjk-test-example

  1. Use Asciidoctor PDF CJK Ext Theme (select Usage Type to select one.)

    • 1.1 cjk-test-use-file-example

    • 1.2 cjk-test-use-jar-example

    • 1.3 cjk-test-use-maven-repo-example

Test - Display Chinese / Japanese fonts can display Regular, Bold, Italic, Bold Italic four styles normally.

cjk test 001

test - display special Unicode fonts, test Fallback settings

cjk test 002

test - show emoji fonts

cjk test 003

  1. Use custom theme with extends Asciidoctor PDF CJK Ext Theme (modify from asciidoctor-maven-examples/asciidoctor-pdf-with-theme-example)

    • 2.1 cjk-test-with-theme-use-file-example

    • 2.2 cjk-test-with-theme-use-jar-example

    • 2.3 cjk-test-with-theme-use-maven-repo-example

Compare the effect of applying Custom Theme and not applying Custom

Custom Theme plus cover image

cjk test theme 001

Custom Theme adds document-title to the header, and changes the title color to orange

cjk test theme 002

Custom Theme adds chapter-title and page-number to footer

cjk test theme 003

cjk-demo-example

  1. Use Asciidoctor PDF CJK Ext Theme (select Usage Type to select one.)

    • 1.1 cjk-demo-use-file-example

    • 1.2 cjk-demo-use-jar-example

    • 1.3 cjk-demo-use-maven-repo-example

  2. Use custom theme with extends Asciidoctor PDF CJK Ext Theme (modify from asciidoctor-maven-examples/asciidoctor-pdf-with-theme-example)

    • 2.1 cjk-demo-with-theme-use-file-example

    • 2.2 cjk-demo-with-theme-use-jar-example

    • 2.3 cjk-demo-with-theme-use-maven-repo-example

Comparison screen using the same font (Noto Sans) and different themes (default-ext-XXX, default-XXX, XXX)

asciidoctor pdf cjk ext themes 1

Comparison screen with different fonts (Noto Sans, Noto Sans, Noto Serif), same theme (default-ext-XXX)

asciidoctor pdf cjk ext fonts 1

manual-example

Without setting any pdf-theme, Asciidoctor PDF will use the default theme and the font used is NotoSerif.

manual example fonts

  1. Use Asciidoctor PDF CJK Ext Theme (select Usage Type to select one.)

    • 2.1 manual-use-file-example

    • 2.2 manual-use-jar-example

    • 2.3 manual-use-maven-repo-example

After setting asciidoctor-pdf-cjk-ext theme, the font used will be NotoXXXCJK.
  1. Use custom theme with extends Asciidoctor PDF CJK Ext Theme (modify from https://github.com/asciidoctor/asciidoctor-maven-examples/asciidoctor-pdf-with-theme-example)

    • 3.1 manual-with-theme-example

    • 3.2 manual-with-theme-use-file-example

    • 3.3 manual-with-theme-use-jar-example

Shared Adoc files example

pdf-cjk-ext-adocs-examples

Cantains asciidoc (.adoc) files, image files. This project is only used to share asciidoc (.adoc) files, image files inside.

All in one example

asciidoctor-pdf-cjk-ext-examples-all-in-one

Combine all examples in one project include adoc files. Independent of the asciidoctor-pdf-cjk-ext-gradle-examples project.

Its build.gradle file has a lot of comments that can make it difficult to read and understand.

So I divided this project into multiple projects, set them for different usage types, and removed all irrelevant annotations in build.gradle.

Mainly divided into use-file, use-jar, use-maven-repo And use asciidoctor-pdf-cjk-ext theme or use custome theme.

Custome theme is extends asciidoctor-pdf-cjk-ext theme.

UsageType asciidoctor-pdf-cjk-ext theme use custome theme

use-file

XXX-use-file-example

XXX-with-theme-use-file-example

use-jar

XXX-use-jar-example

XXX-with-theme-use-jar-example

use-maven-repo

XXX-use-maven-repo-example

XXX-with-theme-use-maven-repo-example

Major Change

Plugin Version

Change version to 3.3.2, Support Gradle 7.x.

plugins {
  id "org.asciidoctor.jvm.pdf" version "3.3.2"
  id "org.asciidoctor.jvm.gems" version "3.3.2"
}

Maven repositories

Change repositories to mavenCentral().

repositories {
    ruby.gems()
    mavenCentral()
}

Module Version

Change versions:

  • asciidoctorj: 2.5.6

  • pdf: 2.3.0

  • diagram: 2.2.3

asciidoctorPdf {
...
  asciidoctorj {
     modules {
       asciidoctorj {
         version "2.5.6"
        }
       pdf {
         version "2.3.0"
       }
       diagram {
         version "2.2.3"
       }
     }

JRuby Version

Change JRuby version to 9.3.8.0.

    attributes "build-gradle": file("build.gradle"),
        "jrubyVersion": "9.3.8.0",

Copyright © 2020 The life888888. Free use of this software is granted under the terms of the MIT License.

See the LICENSE.adoc file for details.

Third Party License

Most project is modify from asciidoctor-gradle-examples and asciidoctor-maven-examples .

See the LICENSE - AsciidoctorProject for details.