-
Notifications
You must be signed in to change notification settings - Fork 149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Asciidoctor Web PDF #244
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,9 @@ 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 | ||
ARG nodejs_version=16.14.0-r0 | ||
ARG asciidoctor_web_pdf_version=1.0.0-alpha.14 | ||
ARG asciidoctor_kroki_npm_version=0.15.4 | ||
|
||
ENV ASCIIDOCTOR_VERSION=${asciidoctor_version} \ | ||
ASCIIDOCTOR_CONFLUENCE_VERSION=${asciidoctor_confluence_version} \ | ||
|
@@ -23,7 +26,10 @@ ENV ASCIIDOCTOR_VERSION=${asciidoctor_version} \ | |
ASCIIDOCTOR_REVEALJS_VERSION=${asciidoctor_revealjs_version} \ | ||
KRAMDOWN_ASCIIDOC_VERSION=${kramdown_asciidoc_version} \ | ||
ASCIIDOCTOR_BIBTEX_VERSION=${asciidoctor_bibtex_version} \ | ||
ASCIIDOCTOR_KROKI_VERSION=${asciidoctor_kroki_version} | ||
ASCIIDOCTOR_KROKI_VERSION=${asciidoctor_kroki_version} \ | ||
NODEJS_VERSION=${nodejs_version} \ | ||
ASCIIDOCTOR_WEB_PDF_VERSION=${asciidoctor_web_pdf_version} \ | ||
ASCIIDOCTOR_KROKI_NPM_VERSION=${asciidoctor_kroki_npm_version} | ||
|
||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # | ||
# Minimal image with asciidoctor | ||
|
@@ -100,7 +106,8 @@ RUN apk add --no-cache \ | |
tzdata \ | ||
unzip \ | ||
which \ | ||
font-noto-cjk | ||
font-noto-cjk \ | ||
nodejs | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK, let me try it. I do not know how to do it(the updatecli manifest), give me some time. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No problem: it is not very well documented on the contributing section so there is no strong expectations. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I updated the code. But it is not the final work. Give me some time. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I updated the code to add a test case and manifest for Node.js. Please check it. If it has some errors, please help me to update it. I tried to build it many times but it always threw errors. Please help me to check the additional size resulting with this change. Thanks. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. WDYT about using a Multi stage build with the official NodeJS image (instead of instaling the nodejs package) in which you install the NPM packages, and you retrieve only the required directories/files (explained in https://medium.com/geekculture/how-to-install-a-specific-node-js-version-in-an-alpine-docker-image-3edc1c2c64be for a "pure" NodeJS installation). It would allow faster builds (node js / npm run in parallel of the rest), and a fixed controlled version of nodejs. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let me try it. |
||
|
||
# Installing Ruby Gems for additional functionality | ||
RUN apk add --no-cache --virtual .rubymakedepends \ | ||
|
@@ -142,6 +149,11 @@ RUN apk add --no-cache --virtual .pythonmakedepends \ | |
seqdiag \ | ||
&& apk del -r --no-cache .pythonmakedepends | ||
|
||
# Installing Nodejs dependencies for additional functionality | ||
RUN npm install --global @asciidoctor/core \ | ||
asciidoctor-pdf@${ASCIIDOCTOR_WEB_PDF_VERSION} \ | ||
asciidoctor-kroki@${ASCIIDOCTOR_KROKI_NPM_VERSION} | ||
|
||
COPY --from=build-haskell root/.cabal/bin/erd /bin/ | ||
|
||
WORKDIR /documents | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,15 @@ | |
:KRAMDOWN_ASCIIDOC_VERSION: 2.0.0 | ||
:ASCIIDOCTOR_BIBTEX_VERSION: 0.8.0 | ||
:ASCIIDOCTOR_KROKI_VERSION: 0.5.0 | ||
:NODEJS_VERSION: 16.14.0 | ||
:ASCIIDOCTOR_WEB_PDF_VERSION: 1.0.0-alpha.14 | ||
ifdef::env-github[] | ||
:tip-caption: :bulb: | ||
:note-caption: :information_source: | ||
:important-caption: :heavy_exclamation_mark: | ||
:caution-caption: :fire: | ||
:warning-caption: :warning: | ||
endif::[] | ||
dduportal marked this conversation as resolved.
Show resolved
Hide resolved
|
||
= Asciidoctor Docker Container | ||
:source-highlighter: coderay | ||
|
||
|
@@ -34,6 +43,7 @@ This Docker image provides: | |
* 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} | ||
* https://github.com/Mogztter/asciidoctor-web-pdf[Asciidoctor Web PDF] {ASCIIDOCTOR_WEB_PDF_VERSION} -- This is an unofficial project. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @mojavelinux I add the description: |
||
|
||
|
||
This image uses Alpine Linux {ALPINE_VERSION} as base image. | ||
|
@@ -111,6 +121,19 @@ asciidoctor-revealjs -a revealjsdir=https://cdnjs.cloudflare.com/ajax/libs/revea | |
docker run --rm -v $(pwd):/documents/ asciidoctor/docker-asciidoctor asciidoctor-pdf index.adoc | ||
---- | ||
|
||
* To convert files with Asciidoctor Web PDF: | ||
+ | ||
[source, bash] | ||
---- | ||
# 1. generate a PDF document from basic example | ||
asciidoctor-web-pdf document.adoc | ||
dduportal marked this conversation as resolved.
Show resolved
Hide resolved
|
||
# Generate the file `document.pdf` | ||
|
||
# 2. generate an PDF document with a diagram | ||
asciidoctor-web-pdf --require asciidoctor-kroki document-with-diagram.adoc | ||
# Generate the file `document-with-diagram.pdf` | ||
---- | ||
|
||
== How to contribute / do it yourself? | ||
|
||
=== Requirements | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,6 +28,8 @@ This Docker image provides: | |
|
||
- [Asciidoctor Kroki](https://github.com/Mogztter/asciidoctor-kroki) 0.5.0 | ||
|
||
- [Asciidoctor Web PDF](https://github.com/Mogztter/asciidoctor-web-pdf) 1.0.0-alpha.14 -- This is an unofficial project. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @mojavelinux I add the description: |
||
|
||
This image uses Alpine Linux 3.13.5 as base image. | ||
|
||
## How to use it | ||
|
@@ -71,6 +73,17 @@ You can find several examples below. | |
|
||
docker run --rm -v $(pwd):/documents/ asciidoctor/docker-asciidoctor asciidoctor-pdf index.adoc | ||
|
||
- To convert files with Asciidoctor Web PDF: | ||
|
||
# 1. generate a PDF document from basic example | ||
asciidoctor-web-pdf document.adoc | ||
# Generate the file `document.pdf` | ||
|
||
# 2. generate an PDF document with a diagram | ||
asciidoctor-web-pdf --require asciidoctor-kroki document-with-diagram.adoc | ||
# Generate the file `document-with-diagram.pdf` | ||
|
||
|
||
## How to contribute / do it yourself? | ||
|
||
### Requirements | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
--- | ||
title: "Bump Asciidoctor-Web-PDF version" | ||
|
||
scms: | ||
default: | ||
kind: github | ||
spec: | ||
user: "{{ .github.user }}" | ||
email: "{{ .github.email }}" | ||
owner: "{{ requiredEnv .github.owner }}" | ||
repository: "{{ requiredEnv .github.repository }}" | ||
token: "{{ requiredEnv .github.token }}" | ||
username: "{{ .github.username }}" | ||
branch: "{{ .github.branch }}" | ||
|
||
sources: | ||
latestVersion: | ||
kind: githubRelease | ||
name: "Get the latest Asciidoctor-Web-PDF version" | ||
spec: | ||
owner: "Mogztter" | ||
repository: "asciidoctor-web-pdf" | ||
token: "{{ requiredEnv .github.token }}" | ||
username: "{{ .github.username }}" | ||
versionFilter: | ||
kind: latest | ||
transformers: | ||
- trimPrefix: "v" | ||
|
||
conditions: | ||
testDockerfileArgVersion: | ||
name: "Does the Dockerfile have an ARG instruction which key is asciidoctor_web_pdf_version?" | ||
kind: dockerfile | ||
spec: | ||
file: Dockerfile | ||
instruction: | ||
keyword: "ARG" | ||
matcher: "asciidoctor_web_pdf_version" | ||
testVersionInReadme: | ||
name: "Does the README.adoc have a variable asciidoctor_web_pdf_version" | ||
kind: file | ||
spec: | ||
file: README.adoc | ||
matchPattern: '(?m:^:ASCIIDOCTOR_WEB_PDF_VERSION:.*)' | ||
testVersionInTestHarness: | ||
name: "Does the test harness have variable ASCIIDOCTOR_WEB_PDF_VERSION" | ||
kind: file | ||
spec: | ||
file: tests/asciidoctor.bats | ||
matchPattern: '(?m:^ASCIIDOCTOR_WEB_PDF_VERSION=.*)' | ||
|
||
targets: | ||
updateDockerfile: | ||
name: "Update the value of ARG asciidoctor_web_pdf_version in the Dockerfile" | ||
kind: dockerfile | ||
spec: | ||
file: Dockerfile | ||
instruction: | ||
keyword: "ARG" | ||
matcher: "asciidoctor_web_pdf_version" | ||
scmID: default | ||
updateTestHarness: | ||
name: "Update the key ASCIIDOCTOR_WEB_PDF_VERSION in the test harness" | ||
kind: file | ||
spec: | ||
file: tests/asciidoctor.bats | ||
matchPattern: '(?m:^ASCIIDOCTOR_WEB_PDF_VERSION=.*)' | ||
content: 'ASCIIDOCTOR_WEB_PDF_VERSION={{ source `latestVersion` }}' | ||
scmID: default | ||
updateReadme: | ||
name: "Update the key ASCIIDOCTOR_WEB_PDF_VERSION in the README.adoc file" | ||
kind: file | ||
spec: | ||
file: README.adoc | ||
matchPattern: '(?m:^:ASCIIDOCTOR_WEB_PDF_VERSION:.*)' | ||
content: ':ASCIIDOCTOR_WEB_PDF_VERSION: {{ source `latestVersion` }}' | ||
scmID: default | ||
|
||
pullrequests: | ||
default: | ||
kind: github | ||
scmID: default | ||
targets: | ||
- updateDockerfile | ||
- updateTestHarness | ||
- updateReadme | ||
spec: | ||
labels: | ||
- chore | ||
- dependencies |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
--- | ||
title: "Bump Node.js version" | ||
|
||
scms: | ||
default: | ||
kind: github | ||
spec: | ||
user: "{{ .github.user }}" | ||
email: "{{ .github.email }}" | ||
owner: "{{ requiredEnv .github.owner }}" | ||
repository: "{{ requiredEnv .github.repository }}" | ||
token: "{{ requiredEnv .github.token }}" | ||
username: "{{ .github.username }}" | ||
branch: "{{ .github.branch }}" | ||
|
||
sources: | ||
latestVersion: | ||
kind: githubRelease | ||
name: "Get the latest Node.js version" | ||
spec: | ||
owner: "nodejs" | ||
repository: "node" | ||
token: "{{ requiredEnv .github.token }}" | ||
username: "{{ .github.username }}" | ||
versionFilter: | ||
kind: semver | ||
# As per https://nodejs.org/en/about/releases/, the LTS line for nodejs is v16.x.y. Semantic version fixes the major version and get the latest minor . patch | ||
pattern: ~16 | ||
transformers: | ||
- trimPrefix: "v" | ||
|
||
conditions: | ||
testDockerfileArgVersion: | ||
name: "Does the Dockerfile have an ARG instruction which key is nodejs_version?" | ||
kind: dockerfile | ||
spec: | ||
file: Dockerfile | ||
instruction: | ||
keyword: "ARG" | ||
matcher: "nodejs_version" | ||
testVersionInReadme: | ||
name: "Does the README.adoc have a variable NODEJS_VERSION" | ||
kind: file | ||
spec: | ||
file: README.adoc | ||
matchPattern: '(?m:^:NODEJS_VERSION:.*)' | ||
testVersionInTestHarness: | ||
name: "Does the test harness have variable NODEJS_VERSION" | ||
kind: file | ||
spec: | ||
file: tests/asciidoctor.bats | ||
matchPattern: '(?m:^NODEJS_VERSION=.*)' | ||
|
||
targets: | ||
updateDockerfile: | ||
name: "Update the value of ARG nodejs_version in the Dockerfile" | ||
kind: dockerfile | ||
spec: | ||
file: Dockerfile | ||
instruction: | ||
keyword: "ARG" | ||
matcher: "nodejs_version" | ||
scmID: default | ||
updateTestHarness: | ||
name: "Update the key NODEJS_VERSION in the test harness" | ||
kind: file | ||
spec: | ||
file: tests/asciidoctor.bats | ||
matchPattern: '(?m:^NODEJS_VERSION=.*)' | ||
content: 'NODEJS_VERSION={{ source `latestVersion` }}' | ||
scmID: default | ||
updateReadme: | ||
name: "Update the key NODEJS_VERSION in the README.adoc file" | ||
kind: file | ||
spec: | ||
file: README.adoc | ||
matchPattern: '(?m:^:NODEJS_VERSION:.*)' | ||
content: ':NODEJS_VERSION: {{ source `latestVersion` }}' | ||
scmID: default | ||
|
||
pullrequests: | ||
default: | ||
kind: github | ||
scmID: default | ||
targets: | ||
- updateDockerfile | ||
- updateTestHarness | ||
- updateReadme | ||
spec: | ||
labels: | ||
- chore | ||
- dependencies |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is the reason to add this element (since kroki is already installed)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Asciidoctor Kroki has two versions: for Ruby and for Node.js. Asciidoctor Kroki for Ruby was installed. But Asciidoctor Kroki for Node.js is not installed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotcha, thanks for the explanation! In that case we'll have to track the version of this component as well with an updatecli manifest :) (yea it's cumbersome but the goal is ensure that control what is inside this image to avoid supply chain issues)