Skip to content

Commit 947c711

Browse files
committed
Add Asciidoctor Web PDF
1 parent a609624 commit 947c711

File tree

5 files changed

+159
-2
lines changed

5 files changed

+159
-2
lines changed

Diff for: Dockerfile

+12-2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ ARG asciidoctor_revealjs_version=4.1.0
1212
ARG kramdown_asciidoc_version=2.0.0
1313
ARG asciidoctor_bibtex_version=0.8.0
1414
ARG asciidoctor_kroki_version=0.5.0
15+
ARG asciidoctor_web_pdf_version=1.0.0-alpha.14
16+
ARG asciidoctor_kroki_npm_version=0.15.4
1517

1618
ENV ASCIIDOCTOR_VERSION=${asciidoctor_version} \
1719
ASCIIDOCTOR_CONFLUENCE_VERSION=${asciidoctor_confluence_version} \
@@ -23,7 +25,9 @@ ENV ASCIIDOCTOR_VERSION=${asciidoctor_version} \
2325
ASCIIDOCTOR_REVEALJS_VERSION=${asciidoctor_revealjs_version} \
2426
KRAMDOWN_ASCIIDOC_VERSION=${kramdown_asciidoc_version} \
2527
ASCIIDOCTOR_BIBTEX_VERSION=${asciidoctor_bibtex_version} \
26-
ASCIIDOCTOR_KROKI_VERSION=${asciidoctor_kroki_version}
28+
ASCIIDOCTOR_KROKI_VERSION=${asciidoctor_kroki_version} \
29+
ASCIIDOCTOR_WEB_PDF_VERSION=${asciidoctor_web_pdf_version} \
30+
ASCIIDOCTOR_KROKI_NPM_VERSION=${asciidoctor_kroki_npm_version}
2731

2832
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
2933
# Minimal image with asciidoctor
@@ -100,7 +104,8 @@ RUN apk add --no-cache \
100104
tzdata \
101105
unzip \
102106
which \
103-
font-noto-cjk
107+
font-noto-cjk \
108+
nodejs
104109

105110
# Installing Ruby Gems for additional functionality
106111
RUN apk add --no-cache --virtual .rubymakedepends \
@@ -142,6 +147,11 @@ RUN apk add --no-cache --virtual .pythonmakedepends \
142147
seqdiag \
143148
&& apk del -r --no-cache .pythonmakedepends
144149

150+
# Installing Nodejs dependencies for additional functionality
151+
RUN npm install --global @asciidoctor/core \
152+
asciidoctor-pdf@${ASCIIDOCTOR_WEB_PDF_VERSION} \
153+
asciidoctor-kroki@${ASCIIDOCTOR_KROKI_NPM_VERSION}
154+
145155
COPY --from=build-haskell root/.cabal/bin/erd /bin/
146156

147157
WORKDIR /documents

Diff for: README.adoc

+22
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@
1010
:KRAMDOWN_ASCIIDOC_VERSION: 2.0.0
1111
:ASCIIDOCTOR_BIBTEX_VERSION: 0.8.0
1212
:ASCIIDOCTOR_KROKI_VERSION: 0.5.0
13+
:ASCIIDOCTOR_WEB_PDF_VERSION: 1.0.0-alpha.14
14+
ifdef::env-github[]
15+
:tip-caption: :bulb:
16+
:note-caption: :information_source:
17+
:important-caption: :heavy_exclamation_mark:
18+
:caution-caption: :fire:
19+
:warning-caption: :warning:
20+
endif::[]
1321
= Asciidoctor Docker Container
1422
:source-highlighter: coderay
1523

@@ -34,6 +42,7 @@ This Docker image provides:
3442
* https://github.com/asciidoctor/asciidoctor-confluence[Asciidoctor Confluence] {ASCIIDOCTOR_CONFLUENCE_VERSION}
3543
* https://github.com/asciidoctor/asciidoctor-bibtex[Asciidoctor Bibtex] {ASCIIDOCTOR_BIBTEX_VERSION}
3644
* https://github.com/Mogztter/asciidoctor-kroki[Asciidoctor Kroki] {ASCIIDOCTOR_KROKI_VERSION}
45+
* https://github.com/Mogztter/asciidoctor-web-pdf[Asciidoctor Web PDF] {ASCIIDOCTOR_WEB_PDF_VERSION}
3746

3847

3948
This image uses Alpine Linux {ALPINE_VERSION} as base image.
@@ -111,6 +120,19 @@ asciidoctor-revealjs -a revealjsdir=https://cdnjs.cloudflare.com/ajax/libs/revea
111120
docker run --rm -v $(pwd):/documents/ asciidoctor/docker-asciidoctor asciidoctor-pdf index.adoc
112121
----
113122

123+
* To convert files with Asciidoctor Web PDF:
124+
+
125+
[source, bash]
126+
----
127+
# 1. generate a PDF document from basic example
128+
asciidoctor-web-pdf document.adoc
129+
# Generate the file `document.pdf`
130+
131+
# 2. generate an PDF document with a diagram
132+
asciidoctor-web-pdf --require asciidoctor-kroki document-with-diagram.adoc
133+
# Generate the file `document-with-diagram.pdf`
134+
----
135+
114136
== How to contribute / do it yourself?
115137

116138
=== Requirements

Diff for: README.md

+13
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ This Docker image provides:
2828

2929
- [Asciidoctor Kroki](https://github.com/Mogztter/asciidoctor-kroki) 0.5.0
3030

31+
- [Asciidoctor Web PDF](https://github.com/Mogztter/asciidoctor-web-pdf) 1.0.0-alpha.14
32+
3133
This image uses Alpine Linux 3.13.5 as base image.
3234

3335
## How to use it
@@ -71,6 +73,17 @@ You can find several examples below.
7173

7274
docker run --rm -v $(pwd):/documents/ asciidoctor/docker-asciidoctor asciidoctor-pdf index.adoc
7375

76+
- To convert files with Asciidoctor Web PDF:
77+
78+
# 1. generate a PDF document from basic example
79+
asciidoctor-web-pdf document.adoc
80+
# Generate the file `document.pdf`
81+
82+
# 2. generate an PDF document with a diagram
83+
asciidoctor-web-pdf --require asciidoctor-kroki document-with-diagram.adoc
84+
# Generate the file `document-with-diagram.pdf`
85+
86+
7487
## How to contribute / do it yourself?
7588

7689
### Requirements

Diff for: tests/asciidoctor.bats

+22
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ ASCIIDOCTOR_REVEALJS_VERSION=4.1.0
1313
KRAMDOWN_ASCIIDOC_VERSION=2.0.0
1414
ASCIIDOCTOR_BIBTEX_VERSION=0.8.0
1515
ASCIIDOCTOR_KROKI_VERSION=0.5.0
16+
ASCIIDOCTOR_WEB_PDF_VERSION=1.0.0-alpha.14
1617
DOCKER_IMAGE_NAME_TO_TEST="${IMAGE_NAME:-asciidoctor}"
1718

1819
clean_generated_files() {
@@ -48,6 +49,12 @@ teardown() {
4849
| grep "${ASCIIDOCTOR_PDF_VERSION}"
4950
}
5051

52+
@test "asciidoctor-web-pdf is installed and in version ${ASCIIDOCTOR_WEB_PDF_VERSION}" {
53+
docker run -t --rm "${DOCKER_IMAGE_NAME_TO_TEST}" asciidoctor-web-pdf -v \
54+
| grep "Asciidoctor Web PDF" | grep "${ASCIIDOCTOR_VERSION}" \
55+
| grep "${ASCIIDOCTOR_WEB_PDF_VERSION}"
56+
}
57+
5158
@test "asciidoctor-revealjs is callable without error" {
5259
docker run -t --rm "${DOCKER_IMAGE_NAME_TO_TEST}" asciidoctor-revealjs -v \
5360
| grep "${ASCIIDOCTOR_REVEALJS_VERSION}"
@@ -120,6 +127,13 @@ teardown() {
120127
/documents/fixtures/basic-example.adoc
121128
}
122129

130+
@test "We can generate a PDF document from basic example(Asciidoctor Web PDF)" {
131+
docker run -t --rm \
132+
-v "${BATS_TEST_DIRNAME}":/documents/ \
133+
"${DOCKER_IMAGE_NAME_TO_TEST}" \
134+
asciidoctor-web-pdf -D /documents/tmp /documents/fixtures/basic-example.adoc
135+
}
136+
123137
@test "We can generate an FB2 document from basic example without errors/warnings" {
124138

125139
docker run -t --rm \
@@ -285,6 +299,14 @@ teardown() {
285299
/documents/fixtures/samples-syntax-highlight/*.adoc
286300
}
287301

302+
@test "We can generate PDF documents with different syntax-colored codes(Asciidoctor Web PDF)" {
303+
docker run -t --rm \
304+
-v "${BATS_TEST_DIRNAME}":/documents/ \
305+
"${DOCKER_IMAGE_NAME_TO_TEST}" \
306+
asciidoctor-web-pdf -D /documents/tmp \
307+
/documents/fixtures/samples-syntax-highlight/*.adoc
308+
}
309+
288310
@test "We can convert a Markdown file to an AsciiDoc file" {
289311
docker run -t --rm \
290312
-v "${BATS_TEST_DIRNAME}":/documents/ \

Diff for: updatecli/updatecli.d/asciidoctor-web-pdf.yml

+90
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
---
2+
title: "Bump Asciidoctor-Web-PDF version"
3+
4+
scms:
5+
default:
6+
kind: github
7+
spec:
8+
user: "{{ .github.user }}"
9+
email: "{{ .github.email }}"
10+
owner: "{{ requiredEnv .github.owner }}"
11+
repository: "{{ requiredEnv .github.repository }}"
12+
token: "{{ requiredEnv .github.token }}"
13+
username: "{{ .github.username }}"
14+
branch: "{{ .github.branch }}"
15+
16+
sources:
17+
latestVersion:
18+
kind: githubRelease
19+
name: "Get the latest Asciidoctor-Web-PDF version"
20+
spec:
21+
owner: "Mogztter"
22+
repository: "asciidoctor-web-pdf"
23+
token: "{{ requiredEnv .github.token }}"
24+
username: "{{ .github.username }}"
25+
versionFilter:
26+
kind: latest
27+
transformers:
28+
- trimPrefix: "v"
29+
30+
conditions:
31+
testDockerfileArgVersion:
32+
name: "Does the Dockerfile have an ARG instruction which key is asciidoctor_web_pdf_version?"
33+
kind: dockerfile
34+
spec:
35+
file: Dockerfile
36+
instruction:
37+
keyword: "ARG"
38+
matcher: "asciidoctor_web_pdf_version"
39+
testVersionInReadme:
40+
name: "Does the README.adoc have a variable asciidoctor_web_pdf_version"
41+
kind: file
42+
spec:
43+
file: README.adoc
44+
matchPattern: '(?m:^:ASCIIDOCTOR_WEB_PDF_VERSION:.*)'
45+
testVersionInTestHarness:
46+
name: "Does the test harness have variable ASCIIDOCTOR_WEB_PDF_VERSION"
47+
kind: file
48+
spec:
49+
file: tests/asciidoctor.bats
50+
matchPattern: '(?m:^ASCIIDOCTOR_WEB_PDF_VERSION=.*)'
51+
52+
targets:
53+
updateDockerfile:
54+
name: "Update the value of ARG asciidoctor_web_pdf_version in the Dockerfile"
55+
kind: dockerfile
56+
spec:
57+
file: Dockerfile
58+
instruction:
59+
keyword: "ARG"
60+
matcher: "asciidoctor_web_pdf_version"
61+
scmID: default
62+
updateTestHarness:
63+
name: "Update the key ASCIIDOCTOR_WEB_PDF_VERSION in the test harness"
64+
kind: file
65+
spec:
66+
file: tests/asciidoctor.bats
67+
matchPattern: '(?m:^ASCIIDOCTOR_WEB_PDF_VERSION=.*)'
68+
content: 'ASCIIDOCTOR_WEB_PDF_VERSION={{ source `latestVersion` }}'
69+
scmID: default
70+
updateReadme:
71+
name: "Update the key ASCIIDOCTOR_WEB_PDF_VERSION in the README.adoc file"
72+
kind: file
73+
spec:
74+
file: README.adoc
75+
matchPattern: '(?m:^:ASCIIDOCTOR_WEB_PDF_VERSION:.*)'
76+
content: ':ASCIIDOCTOR_WEB_PDF_VERSION: {{ source `latestVersion` }}'
77+
scmID: default
78+
79+
pullrequests:
80+
default:
81+
kind: github
82+
scmID: default
83+
targets:
84+
- updateDockerfile
85+
- updateTestHarness
86+
- updateReadme
87+
spec:
88+
labels:
89+
- chore
90+
- dependencies

0 commit comments

Comments
 (0)