AsciiDoc으로 작성된 문서를 PDF로 변환
5346 단어 PDFasciidocasciidoctor
개요
AsciiDoc으로 작성된 문서를 PDF 파일로 변환하는 설정에 대한 참고 사항.
환경
상세
디렉토리 구성
│
├ gradle
│ │
│ └ wrapper .. asciidoctorビルド用jar
│
├ src
│ ├ themes
│ │ │
│ │ ├ custom-theme.yml .. pdfのstyle設定用ファイル
│ │ │
│ │ └ logo.png .. ロゴ画像
│ │
│ └ index.adoc
│
├ build.gradle .. asciidoctorビルド設定ファイル
│
├ gradlew .. asciidoctorビルド実行exe(unix系統用)
│
└ gradlew.bat .. asciidoctorビルド実行exe(windows系統用)
│
├ gradle
│ │
│ └ wrapper .. asciidoctorビルド用jar
│
├ src
│ ├ themes
│ │ │
│ │ ├ custom-theme.yml .. pdfのstyle設定用ファイル
│ │ │
│ │ └ logo.png .. ロゴ画像
│ │
│ └ index.adoc
│
├ build.gradle .. asciidoctorビルド設定ファイル
│
├ gradlew .. asciidoctorビルド実行exe(unix系統用)
│
└ gradlew.bat .. asciidoctorビルド実行exe(windows系統用)
src
폴더 아래의 adoc이 빌드됨 빌드 설정
build.gradle
buildscript {
ext {
asciiDoctorGradlePluginVersion = "1.5.7"
asciidoctorjDiagramVersion = "1.5.8"
asciidoctorjPdfVersion = "1.5.0-alpha.15"
}
repositories {
jcenter()
}
dependencies {
classpath("org.asciidoctor:asciidoctor-gradle-plugin:${asciiDoctorGradlePluginVersion}")
classpath("org.asciidoctor:asciidoctorj-diagram:${asciidoctorjDiagramVersion}")
classpath("org.asciidoctor:asciidoctorj-pdf:${asciidoctorjPdfVersion}")
}
}
apply plugin: 'org.asciidoctor.convert'
apply plugin: 'org.asciidoctor.gradle.asciidoctor'
asciidoctor {
dependsOn 'clean'
requires = ['asciidoctor-diagram'] // asciidoctor-diagram の利用設定
backends = ['html5', 'pdf'] // htmlとpdfファイルを出力する設定
sourceDir = file('src') // ビルド対象のファイルを置くフォルダ
outputDir = file('build') // ビルド後のファイルが出力されるフォルダ
separateOutputDirs = false
}
wrapper {
gradleVersion = '5.6'
}
defaultTasks 'asciidoctor'
PDF 스타일 설정(custom-theme.yml)
샘플 문서(index.adoc)
index.adoc
:data-uri:
:pdf-style: ./themes/custom-theme.yml
:title-logo-image: image:./themes/logo.png[]
:toc: left
:sectnums:
:chapter-label:
:toclevels: 2
:toc-title: 目次
:figure-caption: 図
= タイトル
== TEST1
=== TEST2
==== TEST3
* 設定で目次や段落を自動的に作ってくれる
* toclevelsを2にしているため2段落(x.x)までの表題で目次が作成される
==== UML
* UMLの出力テスト
:imagesdir: /build
[plantuml, test-uml]
----
@startuml
Alice -> Bob: Authentication Request
Bob --> Alice: Authentication Response
Alice -> Bob: Another authentication Request
Alice <-- Bob: another authentication Response
@enduml
----
요약
사내에서만 운용하는 사양서라면 HTML이라도 문제 없지만,
고객에게 납품하면 아무래도 그렇게 할 수 없게 된다.
그럴 때 asciidoctorj-pdf
를 사용하면 PDF로 변환할 수 있기 때문에 편리하다고 생각한다.
사양서 등의 문서도 버전 관리하기 쉬운 텍스트 기반의 문서로 작성할 수 있다면
이력 관리 등 하기 쉽기 때문에 그렇게 되면 좋다고 생각한다.
Reference
이 문제에 관하여(AsciiDoc으로 작성된 문서를 PDF로 변환), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://qiita.com/nkk777dev/items/e09e980e17c15c3732fb
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
Reference
이 문제에 관하여(AsciiDoc으로 작성된 문서를 PDF로 변환), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/nkk777dev/items/e09e980e17c15c3732fb텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)