mirror of
https://github.com/ldericher/autodoc.git
synced 2025-12-06 15:43:01 +00:00
Compare commits
35 commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0612070b66 | |||
| 778e2d79d7 | |||
| 2298ab3365 | |||
| 8375be93c6 | |||
| 5ac0d47553 | |||
| b7e1f15406 | |||
| eda145186d | |||
| c8931beff6 | |||
| a0ee58674a | |||
| e91526f326 | |||
| b5537a78af | |||
| df42f0965d | |||
| 4d4b418e63 | |||
| 5119a9596b | |||
| 2aa936e917 | |||
| 5b8786fb33 | |||
| 91699e95ca | |||
| f3219e9477 | |||
| dd96c4852b | |||
| bca8809396 | |||
| bbec02ddcc | |||
| 49fe0ebda0 | |||
| e485a4fe67 | |||
| 667b3fde95 | |||
| 7009b2f634 | |||
| 9128c11796 | |||
| ebabff7725 | |||
| ea086a6a3a | |||
| 5ee2197f18 | |||
| da0c61dd92 | |||
| 7cc5d4a2c4 | |||
| 9103180c36 | |||
| b2d93d7283 | |||
| b67d392fff | |||
| c8228dd312 |
17 changed files with 235 additions and 34 deletions
27
.drone.yml
27
.drone.yml
|
|
@ -3,14 +3,33 @@ kind: pipeline
|
||||||
name: default
|
name: default
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: docker
|
- name: default
|
||||||
image: plugins/docker
|
image: plugins/docker
|
||||||
settings:
|
settings:
|
||||||
repo: ldericher/autodoc
|
repo: ldericher/autodoc
|
||||||
context: src
|
|
||||||
dockerfile: src/Dockerfile
|
|
||||||
auto_tag: true
|
|
||||||
username:
|
username:
|
||||||
from_secret: DOCKER_USERNAME
|
from_secret: DOCKER_USERNAME
|
||||||
password:
|
password:
|
||||||
from_secret: DOCKER_PASSWORD
|
from_secret: DOCKER_PASSWORD
|
||||||
|
auto_tag: true
|
||||||
|
dockerfile: Dockerfile.alpine
|
||||||
|
target: stage-base
|
||||||
|
|
||||||
|
- name: diagram
|
||||||
|
image: plugins/docker
|
||||||
|
settings:
|
||||||
|
repo: ldericher/autodoc
|
||||||
|
username:
|
||||||
|
from_secret: DOCKER_USERNAME
|
||||||
|
password:
|
||||||
|
from_secret: DOCKER_PASSWORD
|
||||||
|
auto_tag: true
|
||||||
|
auto_tag_suffix: diagram
|
||||||
|
dockerfile: Dockerfile.ubuntu
|
||||||
|
target: stage-diagram
|
||||||
|
|
||||||
|
- name: parallelism provider
|
||||||
|
image: alpine
|
||||||
|
depends_on:
|
||||||
|
- default
|
||||||
|
- diagram
|
||||||
|
|
|
||||||
1
.gitattributes
vendored
Normal file
1
.gitattributes
vendored
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
*.icc filter=lfs diff=lfs merge=lfs -text
|
||||||
57
Dockerfile.alpine
Normal file
57
Dockerfile.alpine
Normal file
|
|
@ -0,0 +1,57 @@
|
||||||
|
FROM pandoc/extra:latest AS stage-base
|
||||||
|
|
||||||
|
RUN set -ex; \
|
||||||
|
\
|
||||||
|
apk add --no-cache \
|
||||||
|
bash \
|
||||||
|
ghostscript \
|
||||||
|
inotify-tools \
|
||||||
|
make \
|
||||||
|
patch \
|
||||||
|
; \
|
||||||
|
\
|
||||||
|
tlmgr update --self; \
|
||||||
|
\
|
||||||
|
tlmgr install \
|
||||||
|
kpfonts \
|
||||||
|
lastpage \
|
||||||
|
latexmk \
|
||||||
|
twemojis \
|
||||||
|
;
|
||||||
|
|
||||||
|
COPY src/usr /usr
|
||||||
|
|
||||||
|
RUN set -ex; \
|
||||||
|
\
|
||||||
|
cp /usr/share/ghostscript/lib/PDFA_def.ps /usr/local/share/autodoc/; \
|
||||||
|
patch -d /usr/local/share/autodoc < /usr/local/share/autodoc/PDFA_def.ps.patch; \
|
||||||
|
rm /usr/local/share/autodoc/PDFA_def.ps.patch;
|
||||||
|
|
||||||
|
WORKDIR /docs
|
||||||
|
ENTRYPOINT ["autodoc"]
|
||||||
|
CMD ["-bw"]
|
||||||
|
|
||||||
|
FROM stage-base AS stage-diagram
|
||||||
|
|
||||||
|
ENV PUPPETEER_CACHE_DIR="/usr/local/share/puppeteer/cache" \
|
||||||
|
PUPPETEER_EXECUTABLE_PATH="/usr/bin/chromium-browser" \
|
||||||
|
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD="true"
|
||||||
|
|
||||||
|
COPY src/diagram.lua.patch /usr/local/src/autodoc/diagram.lua.patch
|
||||||
|
|
||||||
|
RUN set -ex; \
|
||||||
|
\
|
||||||
|
apk add --no-cache \
|
||||||
|
chromium \
|
||||||
|
npm \
|
||||||
|
; \
|
||||||
|
\
|
||||||
|
npm install --global @mermaid-js/mermaid-cli; \
|
||||||
|
# rm -rf /root/.cache/puppeteer; \
|
||||||
|
\
|
||||||
|
wget \
|
||||||
|
--output-document='/usr/local/share/pandoc/filters/diagram.lua' \
|
||||||
|
'https://raw.githubusercontent.com/pandoc-ext/diagram/refs/heads/main/_extensions/diagram/diagram.lua' \
|
||||||
|
; \
|
||||||
|
patch /usr/local/share/pandoc/filters/diagram.lua < /usr/local/src/autodoc/diagram.lua.patch; \
|
||||||
|
rm /usr/local/src/autodoc/diagram.lua.patch;
|
||||||
64
Dockerfile.ubuntu
Normal file
64
Dockerfile.ubuntu
Normal file
|
|
@ -0,0 +1,64 @@
|
||||||
|
FROM pandoc/extra:latest-ubuntu AS stage-base
|
||||||
|
|
||||||
|
RUN set -ex; \
|
||||||
|
\
|
||||||
|
deluser --remove-home ubuntu; \
|
||||||
|
\
|
||||||
|
apt-get update; apt-get install --no-install-recommends --yes \
|
||||||
|
ghostscript \
|
||||||
|
inotify-tools \
|
||||||
|
make \
|
||||||
|
patch \
|
||||||
|
; rm -rf /var/lib/apt/lists/*; \
|
||||||
|
\
|
||||||
|
tlmgr update --self; \
|
||||||
|
\
|
||||||
|
tlmgr install \
|
||||||
|
kpfonts \
|
||||||
|
lastpage \
|
||||||
|
latexmk \
|
||||||
|
twemojis \
|
||||||
|
;
|
||||||
|
|
||||||
|
COPY src/usr /usr
|
||||||
|
|
||||||
|
RUN set -ex; \
|
||||||
|
\
|
||||||
|
cp /usr/share/ghostscript/10.02.1/lib/PDFA_def.ps /usr/local/share/autodoc/; \
|
||||||
|
patch -d /usr/local/share/autodoc < /usr/local/share/autodoc/PDFA_def.ps.patch; \
|
||||||
|
rm /usr/local/share/autodoc/PDFA_def.ps.patch;
|
||||||
|
|
||||||
|
WORKDIR /docs
|
||||||
|
ENTRYPOINT ["autodoc"]
|
||||||
|
CMD ["-bw"]
|
||||||
|
|
||||||
|
FROM stage-base AS stage-diagram
|
||||||
|
|
||||||
|
ENV PUPPETEER_CACHE_DIR="/usr/local/share/puppeteer/cache"
|
||||||
|
|
||||||
|
COPY src/diagram.lua.patch /usr/local/src/autodoc/diagram.lua.patch
|
||||||
|
|
||||||
|
RUN set -ex; \
|
||||||
|
\
|
||||||
|
apt-get update; apt-get install --no-install-recommends --yes \
|
||||||
|
libasound2t64 \
|
||||||
|
libatk1.0-0t64 \
|
||||||
|
libatk-bridge2.0-0t64 \
|
||||||
|
libgbm1 \
|
||||||
|
libnss3 \
|
||||||
|
libxcomposite1 \
|
||||||
|
libxdamage1 \
|
||||||
|
libxfixes3 \
|
||||||
|
libxkbcommon0 \
|
||||||
|
libxrandr2 \
|
||||||
|
npm \
|
||||||
|
; rm -rf /var/lib/apt/lists/*; \
|
||||||
|
\
|
||||||
|
npm install --global @mermaid-js/mermaid-cli; \
|
||||||
|
\
|
||||||
|
wget \
|
||||||
|
--output-document='/usr/local/share/pandoc/filters/diagram.lua' \
|
||||||
|
'https://raw.githubusercontent.com/pandoc-ext/diagram/refs/heads/main/_extensions/diagram/diagram.lua' \
|
||||||
|
; \
|
||||||
|
patch /usr/local/share/pandoc/filters/diagram.lua < /usr/local/src/autodoc/diagram.lua.patch; \
|
||||||
|
rm /usr/local/src/autodoc/diagram.lua.patch;
|
||||||
|
|
@ -8,7 +8,7 @@ In general, any file-sharing solution -- preferably on top of `docker-compose` -
|
||||||
|
|
||||||
## Quick Start Guide using Docker
|
## Quick Start Guide using Docker
|
||||||
|
|
||||||
The `autodoc` image [available on Docker Hub](https://hub.docker.com/r/ldericher/autodoc) is based on [pandocker](https://hub.docker.com/r/ldericher/pandocker) providing Ubuntu's TeXlive `LaTeX` and `pandoc` in a simple box.
|
The `autodoc` image [available on Docker Hub](https://hub.docker.com/r/ldericher/autodoc) is based on [pandoc/extra](https://hub.docker.com/r/pandoc/extra) providing TeXlive `LaTeX` and `pandoc` in a container.
|
||||||
|
|
||||||
01. Install [Docker CE](https://docs.docker.com/install/)
|
01. Install [Docker CE](https://docs.docker.com/install/)
|
||||||
|
|
||||||
|
|
@ -18,7 +18,7 @@ The `autodoc` image [available on Docker Hub](https://hub.docker.com/r/ldericher
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker run --rm -it \
|
docker run --rm -it \
|
||||||
--volume "${PWD}":/docs \
|
--volume "${PWD}:/docs" \
|
||||||
--user "$(id -u):$(id -g)" \
|
--user "$(id -u):$(id -g)" \
|
||||||
ldericher/autodoc
|
ldericher/autodoc
|
||||||
```
|
```
|
||||||
|
|
@ -58,7 +58,6 @@ services:
|
||||||
- documents:/opt/autodoc
|
- documents:/opt/autodoc
|
||||||
|
|
||||||
autodoc:
|
autodoc:
|
||||||
restart: always
|
|
||||||
image: ldericher/autodoc
|
image: ldericher/autodoc
|
||||||
user: "UID:GID"
|
user: "UID:GID"
|
||||||
volumes:
|
volumes:
|
||||||
|
|
|
||||||
|
|
@ -1,16 +0,0 @@
|
||||||
version: "2"
|
|
||||||
|
|
||||||
services:
|
|
||||||
autodoc:
|
|
||||||
restart: "no"
|
|
||||||
|
|
||||||
image: ldericher/autodoc
|
|
||||||
build:
|
|
||||||
context: ./src
|
|
||||||
|
|
||||||
command: "bash"
|
|
||||||
|
|
||||||
volumes:
|
|
||||||
- "${PWD}/src/usr/local/bin/autodoc:/usr/local/bin/autodoc:ro"
|
|
||||||
- "${PWD}/src/usr/local/lib/autodoc:/usr/local/lib/autodoc:ro"
|
|
||||||
- "${PWD}/examples:/docs"
|
|
||||||
1
examples/eisvogel/.gitignore
vendored
Normal file
1
examples/eisvogel/.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
*.pdf
|
||||||
8
examples/eisvogel/Makefile
Normal file
8
examples/eisvogel/Makefile
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
#%SRCPAT% \.url$
|
||||||
|
|
||||||
|
.PHONY: all
|
||||||
|
all: eisvogel.pdf
|
||||||
|
|
||||||
|
.PHONY: eisvogel.pdf
|
||||||
|
eisvogel.pdf: document.md.url
|
||||||
|
wget -O- '$(file < $<)' | pandoc -s -f markdown -t latex -o $@ --template eisvogel
|
||||||
1
examples/eisvogel/document.md.url
Normal file
1
examples/eisvogel/document.md.url
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
https://raw.githubusercontent.com/Wandmalfarbe/pandoc-latex-template/master/examples/basic-example/document.md
|
||||||
|
|
@ -15,7 +15,7 @@ Behold, for there is jumbled mess ahead!
|
||||||
|
|
||||||
With the default HTML template, this does not translate: \textsl{Have some \LaTeX, too!}
|
With the default HTML template, this does not translate: \textsl{Have some \LaTeX, too!}
|
||||||
Some math is fine with HTML: $x=5$, some other is not: $\sqrt{x}=2$.
|
Some math is fine with HTML: $x=5$, some other is not: $\sqrt{x}=2$.
|
||||||
However, both of these are fixable!
|
However, both of these work with the `--webtex` switch for pandoc!
|
||||||
|
|
||||||
Code blocks? Sure!
|
Code blocks? Sure!
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
FROM ldericher/pandocker:latest
|
|
||||||
|
|
||||||
RUN set -ex; \
|
|
||||||
apt-get update && apt-get -y install \
|
|
||||||
inotify-tools \
|
|
||||||
; rm -rf /var/lib/apt/lists/*;
|
|
||||||
|
|
||||||
COPY usr /usr
|
|
||||||
|
|
||||||
CMD ["autodoc", "-bw"]
|
|
||||||
11
src/diagram.lua.patch
Normal file
11
src/diagram.lua.patch
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
--- diagram.lua
|
||||||
|
+++ diagram.lua
|
||||||
|
@@ -158,7 +158,7 @@
|
||||||
|
write_file(infile, code)
|
||||||
|
pipe(
|
||||||
|
self.execpath or 'mmdc',
|
||||||
|
- {"--pdfFit", "--input", infile, "--output", outfile},
|
||||||
|
+ {"--pdfFit", "--puppeteerConfigFile", "/usr/local/share/puppeteer/config.json", "--input", infile, "--output", outfile},
|
||||||
|
''
|
||||||
|
)
|
||||||
|
return read_file(outfile), mime_type
|
||||||
11
src/usr/local/share/autodoc/PDFA_def.ps.patch
Normal file
11
src/usr/local/share/autodoc/PDFA_def.ps.patch
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
--- PDFA_def.ps
|
||||||
|
+++ PDFA_def.ps
|
||||||
|
@@ -9,7 +9,7 @@
|
||||||
|
/DOCINFO pdfmark
|
||||||
|
|
||||||
|
% Define an ICC profile :
|
||||||
|
-/ICCProfile (srgb.icc) % Customise
|
||||||
|
+/ICCProfile (/usr/local/share/autodoc/sRGB.icc) % Customise
|
||||||
|
def
|
||||||
|
|
||||||
|
[/_objdef {icc_PDFA} /type /stream /OBJ pdfmark
|
||||||
BIN
src/usr/local/share/autodoc/compatibleWithAdobeRGB1998.icc
(Stored with Git LFS)
Normal file
BIN
src/usr/local/share/autodoc/compatibleWithAdobeRGB1998.icc
(Stored with Git LFS)
Normal file
Binary file not shown.
46
src/usr/local/share/autodoc/pdftools.mk
Normal file
46
src/usr/local/share/autodoc/pdftools.mk
Normal file
|
|
@ -0,0 +1,46 @@
|
||||||
|
#############
|
||||||
|
# FUNCTIONS #
|
||||||
|
#############
|
||||||
|
|
||||||
|
PDFTOOLS_GSFLAGS := \
|
||||||
|
-sDEVICE=pdfwrite \
|
||||||
|
-dNOOUTERSAVE \
|
||||||
|
-dNOPAUSE \
|
||||||
|
-dQUIET \
|
||||||
|
-dBATCH
|
||||||
|
|
||||||
|
pdftools_pdfcat = gs \
|
||||||
|
$(PDFTOOLS_GSFLAGS) \
|
||||||
|
-sPAPERSIZE=a4 \
|
||||||
|
-dFIXEDMEDIA \
|
||||||
|
-dPDFFitPage \
|
||||||
|
-dCompatibilityLevel=1.7 \
|
||||||
|
-dPDFSETTINGS=/ebook \
|
||||||
|
-sOutputFile=$(2) \
|
||||||
|
$(1)
|
||||||
|
|
||||||
|
pdftools_mkpdfa = gs \
|
||||||
|
$(PDFTOOLS_GSFLAGS) \
|
||||||
|
-dPDFA=$(1) \
|
||||||
|
-sColorConversionStrategy=RGB \
|
||||||
|
-dPDFACompatibilityPolicy=1 \
|
||||||
|
--permit-file-read=/usr/local/share/autodoc/ \
|
||||||
|
-sOutputFile=$(3) \
|
||||||
|
/usr/local/share/autodoc/PDFA_def.ps \
|
||||||
|
$(2)
|
||||||
|
|
||||||
|
############
|
||||||
|
# PATTERNS #
|
||||||
|
############
|
||||||
|
|
||||||
|
# convert PDF to PDF/A-2B
|
||||||
|
%_pdfa2.pdf: %.pdf
|
||||||
|
$(call pdftools_mkpdfa,2,$<,$@)
|
||||||
|
|
||||||
|
# convert PDF to PDF/A-3B
|
||||||
|
%_pdfa3.pdf: %.pdf
|
||||||
|
$(call pdftools_mkpdfa,3,$<,$@)
|
||||||
|
|
||||||
|
# convert PDF to PDF/A (default variant 3B)
|
||||||
|
%_pdfa.pdf: %.pdf
|
||||||
|
$(call pdftools_mkpdfa,3,$<,$@)
|
||||||
BIN
src/usr/local/share/autodoc/sRGB.icc
(Stored with Git LFS)
Normal file
BIN
src/usr/local/share/autodoc/sRGB.icc
(Stored with Git LFS)
Normal file
Binary file not shown.
3
src/usr/local/share/puppeteer/config.json
Normal file
3
src/usr/local/share/puppeteer/config.json
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"args": [ "--no-sandbox" ]
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue