Skip to content

Commit

Permalink
Merge pull request #226 from mskyaxl/main
Browse files Browse the repository at this point in the history
[#191] included Asciidoctor Kroki into the docker image
  • Loading branch information
dduportal authored Nov 7, 2021
2 parents 7857b1c + f7c9e98 commit 5bde1fa
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 3 deletions.
6 changes: 4 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ ARG asciidoctor_mathematical_version=0.3.5
ARG asciidoctor_revealjs_version=4.1.0
ARG kramdown_asciidoc_version=2.0.0
ARG asciidoctor_bibtex_version=0.8.0
ARG asciidoctor_kroki_version=0.5.0

ENV ASCIIDOCTOR_VERSION=${asciidoctor_version} \
ASCIIDOCTOR_CONFLUENCE_VERSION=${asciidoctor_confluence_version} \
Expand All @@ -21,8 +22,8 @@ ENV ASCIIDOCTOR_VERSION=${asciidoctor_version} \
ASCIIDOCTOR_MATHEMATICAL_VERSION=${asciidoctor_mathematical_version} \
ASCIIDOCTOR_REVEALJS_VERSION=${asciidoctor_revealjs_version} \
KRAMDOWN_ASCIIDOC_VERSION=${kramdown_asciidoc_version} \
ASCIIDOCTOR_BIBTEX_VERSION=${asciidoctor_bibtex_version}

ASCIIDOCTOR_BIBTEX_VERSION=${asciidoctor_bibtex_version} \
ASCIIDOCTOR_KROKI_VERSION=${asciidoctor_kroki_version}

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Minimal image with asciidoctor
Expand Down Expand Up @@ -125,6 +126,7 @@ RUN apk add --no-cache --virtual .rubymakedepends \
tilt \
text-hyphen \
"asciidoctor-bibtex:${ASCIIDOCTOR_BIBTEX_VERSION}" \
"asciidoctor-kroki:${ASCIIDOCTOR_KROKI_VERSION}" \
&& apk del -r --no-cache .rubymakedepends

# Installing Python dependencies for additional functionality
Expand Down
3 changes: 3 additions & 0 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
:ASCIIDOCTOR_REVEALJS_VERSION: 4.1.0
:KRAMDOWN_ASCIIDOC_VERSION: 2.0.0
:ASCIIDOCTOR_BIBTEX_VERSION: 0.8.0
:ASCIIDOCTOR_KROKI_VERSION: 0.5.0
= Asciidoctor Docker Container
:source-highlighter: coderay

Expand All @@ -32,6 +33,8 @@ This Docker image provides:
* Source highlighting using http://rouge.jneen.net[Rouge], https://rubygems.org/gems/coderay[CodeRay] or https://pygments.org/[Pygments]
* https://github.com/asciidoctor/asciidoctor-confluence[Asciidoctor Confluence] {ASCIIDOCTOR_CONFLUENCE_VERSION}
* https://github.com/asciidoctor/asciidoctor-bibtex[Asciidoctor Bibtex] {ASCIIDOCTOR_BIBTEX_VERSION}
* https://github.com/Mogztter/asciidoctor-kroki[Asciidoctor Kroki] {ASCIIDOCTOR_KROKI_VERSION}


This image uses Alpine Linux {ALPINE_VERSION} as base image.

Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ This Docker image provides:

- [Asciidoctor Bibtex](https://github.com/asciidoctor/asciidoctor-bibtex) 0.8.0

This image uses Alpine Linux 3.13.6 as base image.
- [Asciidoctor Kroki](https://github.com/Mogztter/asciidoctor-kroki) 0.5.0

This image uses Alpine Linux 3.13.5 as base image.

## How to use it

Expand Down
18 changes: 18 additions & 0 deletions tests/asciidoctor.bats
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,24 @@ teardown() {
[ "$(echo ${output} | grep -c -i error)" -eq 0 ]
}

@test "We can generate an HTML document with a diagram with asciidoctor-kroki as backend" {
run docker run -t --rm \
-v "${BATS_TEST_DIRNAME}":/documents/ \
"${DOCKER_IMAGE_NAME_TO_TEST}" \
asciidoctor -D /documents/tmp -r asciidoctor-kroki \
/documents/fixtures/sample-with-diagram.adoc

# Even when in ERROR with the module, asciidoctor return 0 because a document
# has been generated
[ "${status}" -eq 0 ]

echo "-- Output of command:"
echo "${output}"
echo "--"

[ "$(echo ${output} | grep -c -i error)" -eq 0 ]
}

@test "Bakoma Fonts are installed to render correctly the square root from asciidoctor-mathematical" {
docker run -t --rm "${DOCKER_IMAGE_NAME_TO_TEST}" apk info font-bakoma-ttf
}
Expand Down
60 changes: 60 additions & 0 deletions updatecli/updatecli.d/Mogztter-kroki.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
---
title: "Bump Asciidoctor-Kroki version"
sources:
getAsciidoctorKrokiVersion:
kind: githubRelease
name: "Get the latest Asciidoctor-Kroki version"
spec:
owner: "Mogztter"
repository: "asciidoctor-kroki"
token: "{{ requiredEnv .github.token }}"
username: "{{ .github.username }}"
versionFilter:
kind: regex
pattern: 'ruby-*'
transformers:
- trimPrefix: "ruby-v"
conditions:
testDockerfileArgVersion:
name: "Does the Dockerfile have an ARG instruction which key is asciidoctor_kroki_version?"
kind: dockerfile
spec:
file: Dockerfile
instruction:
keyword: "ARG"
matcher: "asciidoctor_kroki_version"
targets:
updateHarnessEnvAsciidoctorKrokiVersion:
name: "Update the key ASCIIDOCTOR_KROKI_VERSION in the test harness env_vars.yml file"
kind: yaml
sourceID: getAsciidoctorKrokiVersion
spec:
file: "tests/env_vars.yml"
key: "ASCIIDOCTOR_KROKI_VERSION"
scm:
github:
user: "{{ .github.user }}"
email: "{{ .github.email }}"
owner: "{{ requiredEnv .github.owner }}"
repository: "{{ requiredEnv .github.repository }}"
token: "{{ requiredEnv .github.token }}"
username: "{{ .github.username }}"
branch: "{{ .github.branch }}"
updateDockerfileArgVersion:
name: "Update the value of ARG asciidoctor_kroki_version in the Dockerfile"
sourceID: getAsciidoctorKrokiVersion
kind: dockerfile
spec:
file: Dockerfile
instruction:
keyword: "ARG"
matcher: "asciidoctor_kroki_version"
scm:
github:
user: "{{ .github.user }}"
email: "{{ .github.email }}"
owner: "{{ requiredEnv .github.owner }}"
repository: "{{ requiredEnv .github.repository }}"
token: "{{ requiredEnv .github.token }}"
username: "{{ .github.username }}"
branch: "{{ .github.branch }}"

0 comments on commit 5bde1fa

Please sign in to comment.