Compare commits

...

52 commits
v0.3 ... master

Author SHA1 Message Date
0612070b66 Merge branch 'hotfix/0.9.1' 2025-10-02 13:40:42 +00:00
778e2d79d7 various small fixes
- pdftools: `mkpdfa` invocation
- pdftools: `PDFA_def.ps` location
- use sRGB by default for better compatibility
2025-10-02 13:40:28 +00:00
2298ab3365 Merge branch 'release/0.9.0' 2025-10-02 14:09:03 +02:00
8375be93c6 add "pdftools.mk" 2025-10-02 14:08:17 +02:00
5ac0d47553 Merge tag 'v0.8.2' into develop
include update for tlmgr
2025-05-06 10:34:23 +00:00
b7e1f15406 Merge branch 'release/0.8.2' 2025-05-06 10:33:57 +00:00
eda145186d update tlmgr 2025-05-06 10:33:23 +00:00
c8931beff6 Merge tag 'v0.8.1' into develop
unchanged
2024-11-22 17:56:59 +01:00
a0ee58674a Merge branch 'release/0.8.1' 2024-11-22 17:56:30 +01:00
e91526f326 CI fix "diagram" build 2024-11-22 17:55:33 +01:00
b5537a78af add twemojis support 2024-11-22 17:48:49 +01:00
df42f0965d Merge tag 'v0.8.0' into develop 2024-11-22 17:33:34 +01:00
4d4b418e63 Merge branch 'release/0.8.0' 2024-11-22 17:27:25 +01:00
5119a9596b Merge branch 'feature/diagram' into develop 2024-11-22 17:20:05 +01:00
2aa936e917 CI 2024-11-22 17:19:52 +01:00
5b8786fb33 experimental alpine support for diagram feature (sometimes hangs?) 2024-11-19 01:48:10 +01:00
91699e95ca puppeteer configuration 2024-11-19 01:01:12 +01:00
f3219e9477 merge changes from workstation "Mustafa":
- add ubuntu libraries
- remove unused Makefile
2024-11-18 23:33:28 +01:00
dd96c4852b ubuntu base variant 2024-11-18 20:16:54 +01:00
bca8809396 Merge tag 'v0.7.1' into develop
Add kpfonts lastpage latexmk
2024-04-23 01:25:58 +02:00
bbec02ddcc Merge branch 'release/0.7.1' 2024-04-23 01:25:36 +02:00
49fe0ebda0 add some TeXlive content 2024-04-23 01:25:21 +02:00
e485a4fe67 Merge tag 'v0.7.0' into develop
include gs command
2024-02-29 23:27:24 +01:00
667b3fde95 Merge branch 'release/0.7.0' 2024-02-29 23:27:08 +01:00
7009b2f634 add ghostscript package 2024-02-29 23:27:06 +01:00
9128c11796 Merge tag 'v0.6.0' into develop
Use pandoc/extra instead of ldericher/pandocker
2024-01-08 22:49:23 +01:00
ebabff7725 Merge branch 'release/0.6.0' 2024-01-08 22:48:44 +01:00
ea086a6a3a update documentation 2024-01-08 22:48:12 +01:00
5ee2197f18 use /docs instead of /data 2024-01-08 22:46:08 +01:00
da0c61dd92 "make shell" 2024-01-08 22:40:36 +01:00
7cc5d4a2c4 "eisvogel" example 2024-01-08 22:40:05 +01:00
9103180c36 remove root compose file for a Makefile; move Dockerfile; adjust drone file 2024-01-08 18:24:50 +01:00
b2d93d7283 slight change to example 2024-01-08 17:34:51 +01:00
b67d392fff switch base image to "pandoc/extra" 2024-01-08 17:26:53 +01:00
c8228dd312 Merge tag 'v0.5.0' into develop
Drone CI
2021-09-23 00:40:40 +02:00
f3421123af Merge branch 'release/0.5.0' 2021-09-23 00:40:28 +02:00
1d6ee3bb79 CI docker context 2021-09-22 23:52:56 +02:00
d48fa8563e CI 2021-09-22 23:46:26 +02:00
e47e37de4e Format 2021-09-22 23:46:26 +02:00
e32e0b2ce9 useless volume 2020-07-22 14:51:13 +02:00
4d7f1b14c3 Merge tag 'v0.4.1' into develop
Fix undefined g_verbose
2020-02-18 19:33:29 +01:00
0a1abf90a7 Merge branch 'hotfix/0.4.1' 2020-02-18 19:31:43 +01:00
e309f12ea8 default value for "verbosity" argument 2020-02-18 19:31:37 +01:00
e0e51d4b8d Merge tag 'v0.4' into develop
cli argument support
2020-02-18 10:43:07 +01:00
18958c3448 Merge branch 'release/0.4' 2020-02-18 10:42:21 +01:00
56db54e11a autodoc default parameters 2020-02-18 10:42:11 +01:00
661e94aa13 better CLI options 2020-02-18 09:19:17 +01:00
0022106d97 Add "do_build_watch" 2020-02-18 08:30:52 +01:00
76aa31c0c6 Add "do_${build_system}_all" and "do_build_all" 2020-02-18 08:29:57 +01:00
078cafdc39 move build folder 2020-02-18 08:29:08 +01:00
1c8ef992f1 plugin loading bug (globs) 2019-09-24 16:31:50 +02:00
f9d0075f12 Merge tag 'v0.3' into develop
Pluggable build systems
2019-09-24 15:06:53 +02:00
26 changed files with 565 additions and 190 deletions

35
.drone.yml Normal file
View file

@ -0,0 +1,35 @@
---
kind: pipeline
name: default
steps:
- name: default
image: plugins/docker
settings:
repo: ldericher/autodoc
username:
from_secret: DOCKER_USERNAME
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
View file

@ -0,0 +1 @@
*.icc filter=lfs diff=lfs merge=lfs -text

57
Dockerfile.alpine Normal file
View 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
View 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;

View file

@ -1,12 +1,14 @@
# autodoc
[![Build Status](https://github.drone.yavook.de/api/badges/ldericher/autodoc/status.svg)](https://github.drone.yavook.de/ldericher/autodoc)
[`autodoc`](https://github.com/ldericher/autodoc) is a simple [CI](https://en.wikipedia.org/wiki/Continuous_integration) system optimized for document creation.
In general, any file-sharing solution -- preferably on top of `docker-compose` -- can be made into an automatic document distribution system by adding an `autodoc` instance.
## 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/)
@ -16,7 +18,7 @@ The `autodoc` image [available on Docker Hub](https://hub.docker.com/r/ldericher
```bash
docker run --rm -it \
--volume "${PWD}":/docs \
--volume "${PWD}:/docs" \
--user "$(id -u):$(id -g)" \
ldericher/autodoc
```
@ -56,7 +58,6 @@ services:
- documents:/opt/autodoc
autodoc:
restart: always
image: ldericher/autodoc
user: "UID:GID"
volumes:

View file

@ -1,9 +0,0 @@
FROM ldericher/pandocker:latest
RUN apt-get update && apt-get -y install \
inotify-tools \
&& rm -rf /var/lib/apt/lists/*
COPY usr /usr
CMD ["autodoc"]

View file

@ -1,37 +0,0 @@
#!/bin/bash
#
# hard globals
#
g_bin="$(readlink -f "$(which "$0")")"
g_lib=${g_bin/"bin"/"lib"}
declare -a g_build_systems
declare -A g_build_systems_glob
#
# load base program
#
source "${g_lib}/globals"
source "${g_lib}/logging"
source "${g_lib}/plugins/"*".sh"
source "${g_lib}/handle_inotify"
#
# MAIN
#
echo "Booting '${g_bin}' in '${g_watchroot}'."
# setup inotify:
# -mrq monitor, recursive, quiet
# -e events
# --format %e eventlist csv, %w workdir, %f filename
inotifywait -mrq \
-e create -e delete -e moved_to -e close_write \
--format '%e %w%f' \
"${g_watchroot}" | \
\
while read NOTIFICATION; do
do_handle ${NOTIFICATION}
done

View file

@ -1,4 +0,0 @@
#!/bin/bash
# $WATCHROOT (default: ".")
g_watchroot="$(readlink -f "${1:-.}")"

View file

@ -1,72 +0,0 @@
#!/bin/bash
# process an inotify event
do_handle() { # $FLAGS $OBJECT
# extract params
local flags="$1"
shift 1
local dir="$(dirname "$*")"
local object="$(basename "$*")"
if [[ "${flags}" =~ "ISDIR" ]]; then
# object refers to directory
local dir="${dir}/${object}"
local object="."
fi
# start using toolchain
logline_append "'${object}': '${flags}' in '${dir}'."
do_compile "${dir}" "${object}"
logline_flush
}
# compile an OBJECT using build instructions found in DIRectory
do_compile() { # $DIR $OBJECT $DONE
# extract params
local dir="$1"
local object="$2"
local done="${3:-0}"
# build systems
for build_system in ${g_build_systems[@]}; do
do_build_system "${dir}" "${object}" "${build_system}" \
&& local done="1"
done
# never leave $g_watchroot
if [ "${dir}" != "${g_watchroot}" ]; then
# search parent dir for more build instructions
do_compile "$(dirname "${dir}")" "${object}" "${done}"
elif [ "${done}" == "0" ]; then
# hit $g_watchroot
logline_append "Not a source file."
fi
}
# use given BUILD_SYSTEM to process an OBJECT from a DIRectory
do_build_system() { # $DIR $OBJECT $BUILD_SYSTEM
# extract params
local dir="$1"
local object="$2"
local build_system="$3"
# not done yet
local result=1
# get glob pattern for plugin
for glob in ${g_build_systems_glob[${build_system}]}; do
# match glob in directory
for file in "${dir}"/${glob}; do
# check file readability
if [ -r "${file}" ]; then
# actually call into build system
logline_append "Found '${file}':"
do_${build_system} "${dir}" "${object}" "$(basename "${file}")" \
&& local result=0
fi
done
done
return ${result}
}

View file

@ -1,45 +0,0 @@
#!/bin/bash
# plugin name
g_build_systems+=(make)
# build instruction file globs for this plugin
g_build_systems_glob[make]="Makefile *.mk"
# compile using bare make command
do_make() { # $DIR $OBJECT $MAKEFILE
# extract params
local dir="$1"
local object="$2"
local makefile="$3"
# check Makefile 'source pattern'
local srcpat="$(grep -E "^#%SRCPAT%" "${dir}/${makefile}" | tail -n 1 | sed -r "s/^#%SRCPAT%\s+//")"
if [ -z "${srcpat}" ]; then
logline_append "Empty source pattern, check '#%SRCPAT%' annotation!"
return 1
elif [[ "${object}" =~ ${srcpat} ]]; then
# check for autodoc target
local target="$(grep -E "^autodoc:" "${dir}/${makefile}" | sed -r "s/:.*$//")"
if [ -z "${target}" ]; then
logline_append "Running 'make'!"
else
logline_append "Making '${target}'!"
fi
# actually run "make" and save (truncated) output
local makelog="$(make --no-print-directory -C "${dir}" -f "${makefile}" -j ${target})"
logline_append "$(echo "${makelog}" | head -n 10 | sed 's/$/;/g' | tr '\n' ' ' | sed 's/ *$//')"
logline_append "Done."
else
logline_append "SRCPAT '${srcpat}' mismatch."
return 1
fi
return 0
}

View file

@ -1,19 +0,0 @@
version: "2"
volumes:
phyLinux-home:
services:
autodoc:
restart: "no"
image: ldericher/autodoc
build:
context: ./build
command: "bash"
volumes:
- "${PWD}/build/usr/local/bin/autodoc:/usr/local/bin/autodoc:ro"
- "${PWD}/build/usr/local/lib/autodoc:/usr/local/lib/autodoc:ro"
- "${PWD}/examples:/docs"

1
examples/eisvogel/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
*.pdf

View 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

View file

@ -0,0 +1 @@
https://raw.githubusercontent.com/Wandmalfarbe/pandoc-latex-template/master/examples/basic-example/document.md

View file

@ -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!}
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!

11
src/diagram.lua.patch Normal file
View 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

45
src/usr/local/bin/autodoc Executable file
View file

@ -0,0 +1,45 @@
#!/bin/bash
#
# hard globals
#
g_bin="$(readlink -f "$(which "$0")")"
g_lib=${g_bin/"bin"/"lib"}
#
# load base program
#
source "${g_lib}/globals"
source "${g_lib}/logging"
source "${g_lib}/main"
for plugin in "${g_lib}/plugins/"*".sh"; do
source "${plugin}"
done
#
# MAIN
#
# show debug info
if [ ${g_verbose} -eq 1 ]; then
logline_append "Variables:"
logline_append "build:${g_build}"
logline_append "watch:${g_watch}"
logline_append "root:${g_root}"
logline_flush
fi
if [ ${g_build} -eq 1 ]; then
echo "Building everything in '${g_root}'."
do_build_all
fi
if [ ${g_watch} -eq 1 ]; then
echo "Watching '${g_root}'."
do_build_watch
fi
echo "Done."

View file

@ -0,0 +1,68 @@
#!/bin/bash
# array of available build systems
declare -a g_build_systems
# map of file globs for build systems
declare -A g_build_systems_glob
# map of annotation patterns for build systems
declare -A g_build_systems_annotations
# simple help page
do_show_help() {
echo "Usage: ${0} [-h?bwv] [-r ROOT] [ROOT]"
echo
echo "Options:"
echo " -h, -? Show this help and exit"
echo " -b Build ROOT directory on startup"
echo " -w Keep watching ROOT directory for changes"
echo " -v Verbose output"
echo " -r ROOT Set ROOT directory"
echo
echo "ROOT directory can be set via '-r' argument or positionally."
echo "If ROOT directory is undefined, it defaults to the current working directory."
exit 0
}
# reset in case getopts has been used previously in the shell
OPTIND=1
# initialize variables
g_build=0
g_watch=0
g_verbose=0
g_root=""
while getopts "h?bwvr:" opt; do
case "$opt" in
h|\?)
do_show_help
;;
b)
g_build=1
;;
w)
g_watch=1
;;
v)
g_verbose=1
;;
r)
g_root="${OPTARG}"
;;
esac
done
# default to help
[ ${g_build} -eq 0 ] && [ ${g_watch} -eq 0 ] && [ ${g_verbose} -eq 0 ] && do_show_help
# shift off getopts parsed options
shift $((OPTIND-1))
[ "${1:-}" = "--" ] && shift
# if g_root undefined by getopt,
[ -z "${g_root:-}" ] && g_root="$1"
# get actual $ROOT directory (default: ".")
g_root="$(readlink -f "${g_root:-.}")"

View file

@ -0,0 +1,146 @@
#!/bin/bash
# process an inotify event
do_handle_inotify() { # $FLAGS $OBJECT
# extract params
local flags="$1"
shift 1
local dir="$(dirname "$*")"
local object="$(basename "$*")"
if [[ "${flags}" =~ "ISDIR" ]]; then
# object refers to directory
local dir="${dir}/${object}"
local object="."
fi
# start using toolchain
logline_append "'${object}': '${flags}' in '${dir}'."
do_compile "${dir}" "${object}"
logline_flush
}
# compile an OBJECT using build instructions found in DIRectory
do_compile() { # $DIR $OBJECT $DONE
# extract params
local dir="$1"
local object="$2"
local done="${3:-0}"
# build systems
for build_system in ${g_build_systems[@]}; do
do_build_system "${dir}" "${build_system}" "${object}" \
&& local done="1"
done
# never leave $g_root
if [ "${dir}" != "${g_root}" ]; then
# search parent dir for more build instructions
do_compile "$(dirname "${dir}")" "${object}" "${done}"
elif [ "${done}" == "0" ]; then
# hit $g_root
logline_append "Not a source file."
fi
}
# check if defined source pattern matches OBJECT
do_check_srcpat() { # $DIR $BUILD_DESC $ANNOTATION $OBJECT
# extract params
local dir="$1"
local build_desc="$2"
local annotation="$3"
local object="$4"
# check 'source pattern'
local srcpat="$(grep -E "^${annotation}" "${dir}/${build_desc}" | tail -n 1 | sed -r "s/^${annotation}\s+//")"
if [ -z "${srcpat}" ]; then
# empty srcpat => fail
logline_append "Empty source pattern, check for '${annotation}' annotation!"
return 1
elif [ -z "${object}" ]; then
# empty object = "no specific object" => success
return 0
elif [[ "${object}" =~ ${srcpat} ]]; then
# nonempty object matches srcpat => success
return 0
else
# nonempty object does not match srcpat => fail
logline_append "SRCPAT '${srcpat}' mismatch."
return 1
fi
}
# use given BUILD_SYSTEM to process an OBJECT from a DIRectory
do_build_system() { # $DIR $BUILD_SYSTEM $OBJECT
# extract params
local dir="$1"
local build_system="$2"
local object="$3"
# not done yet
local result=1
# get glob patterns for plugin
for glob in ${g_build_systems_glob[${build_system}]}; do
# match each glob in directory
for file in "${dir}"/${glob}; do
# check file readability
if [ -r "${file}" ]; then
# actually call into build system
logline_append "Found '${file}':"
local file="$(basename "${file}")"
do_${build_system} "${dir}" "${file}" "${object}" \
&& local result=0
fi
done
done
return ${result}
}
# force build using all systems
do_build_all() { #
# build systems
for build_system in ${g_build_systems[@]}; do
echo "Build system '${build_system}'."
for glob in ${g_build_systems_glob[${build_system}]}; do
# match each glob recursively
find "${g_root}" -iname "${glob}" | \
while read file; do
if [ -r "${file}" ]; then
# force call into build system
logline_append "Found '${file}':"
local dir="$(dirname "${file}")"
local file="$(basename "${file}")"
do_${build_system}_all "${dir}" "$(basename "${file}")"
logline_flush
fi
done
done
done
}
do_build_watch() { #
# setup inotify:
# -mrq monitor, recursive, quiet
# -e events
# --format %e eventlist csv, %w workdir, %f filename
inotifywait -mrq \
-e create -e delete -e moved_to -e close_write \
--format '%e %w%f' \
"${g_root}" | \
\
while read NOTIFICATION; do
do_handle_inotify ${NOTIFICATION}
done
}

View file

@ -0,0 +1,57 @@
#!/bin/bash
# plugin name
g_build_systems+=(make)
# build instruction file globs for this plugin
g_build_systems_glob[make]="Makefile *.mk"
# srcpat annotation prefix for this plugin
g_build_systems_annotations[make]='#%SRCPAT%'
# try to compile file OBJECT
do_make() { # $DIR $OBJECT $MAKEFILE
# extract params
local dir="$1"
local makefile="$2"
local object="$3"
# only run if "object" is source file
if do_check_srcpat "${dir}" "${makefile}" "${g_build_systems_annotations[make]}" "${object}"; then
do_run_make "${dir}" "${makefile}"
fi
}
# try running make for MAKEFILE inside DIRectory
do_make_all() { # $DIR $MAKEFILE
# extract params
local dir="$1"
local makefile="$2"
# only run if "makefile" is relevant for autodoc
if do_check_srcpat "${dir}" "${makefile}" "${g_build_systems_annotations[make]}" ""; then
do_run_make "${dir}" "${makefile}"
fi
}
# actually run GNU Make with MAKEFILE inside DIRectory
do_run_make() { # $DIR $MAKEFILE
# extract params
local dir="$1"
local makefile="$2"
# check for autodoc target
local target="$(grep -E "^autodoc:" "${dir}/${makefile}" | sed -r "s/:.*$//")"
if [ -z "${target}" ]; then
logline_append "Running 'make'!"
else
logline_append "Making '${target}'!"
fi
# actually run "make" and save (truncated) output
local makelog="$(make --no-print-directory -C "${dir}" -f "${makefile}" -j ${target})"
logline_append "$(echo "${makelog}" | head -n 10 | sed 's/$/;/g' | tr '\n' ' ' | sed 's/ *$//')"
logline_append "Done."
}

View 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

Binary file not shown.

View 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

Binary file not shown.

View file

@ -0,0 +1,3 @@
{
"args": [ "--no-sandbox" ]
}