Compare commits

..

2 commits

11 changed files with 101 additions and 88 deletions

View file

@ -1,14 +1,19 @@
FROM docker.io/ldericher/autodoc:diagram
# source: https://stackoverflow.com/a/39420880
COPY pdfa /opt/pdfa
# install TeXoffice
COPY --chown=root:root \
texoffice \
/opt/texlive/texdir/texmf-dist/tex/latex/texoffice
RUN /opt/texlive/texdir/bin/default/texconfig rehash
# install lenaisten directory
COPY --chown=root:root lenaisten /opt/lenaisten
RUN set -ex; \
\
# source: https://stackoverflow.com/a/39420880
ln -s \
/workspaces/lev-templates/deploy/pdfa \
/opt/ \
; \
# install TeXoffice
ln -s \
/workspaces/lev-templates/deploy/texoffice \
/opt/texlive/texdir/texmf-dist/tex/latex/texoffice \
; \
# install lenaisten directory
ln -s \
/workspaces/lev-templates/src/lenaisten \
/opt/lenaisten \
;

View file

@ -35,6 +35,8 @@
}
},
"postCreateCommand": "whoami; sudo /opt/texlive/texdir/bin/default/texconfig rehash",
// Set `remoteUser` to `root` to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode"

4
.gitattributes vendored
View file

@ -1,3 +1,3 @@
.devcontainer/pdfa/bin/* filter=lfs diff=lfs merge=lfs -text
deploy/pdfa/bin/* filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text

View file

@ -0,0 +1,64 @@
# compile markdown using pandoc
# params:
# 1: input file
# 2: pandoc template
# 3: output format
# 4: output file
compile_md = pandoc \
$(1) \
--standalone \
--from markdown \
--to $(3) \
--template $(2) \
--variable colorlinks:true \
--variable csquotes:true \
--variable hyperrefoptions:pdfa \
--variable lang:de-DE \
--output $(4)
GSFLAGS := \
-sDEVICE=pdfwrite \
-dNOOUTERSAVE \
-dNOPAUSE \
-dQUIET \
-dBATCH
# post-process and compress PDF files
# params:
# 1: input file
# 2: output file
postprocess_pdf = gs \
$(GSFLAGS) \
-sPAPERSIZE=a4 \
-dFIXEDMEDIA \
-dPDFFitPage \
-dCompatibilityLevel=1.7 \
-dPDFSETTINGS=/ebook \
-sOutputFile=$(2) \
$(1)
# convert PDF to PDF/A 2-b
# params:
# 1: input file
# 2: output file
convert_pdfa = /opt/pdfa/bin/gs-919-linux_x86_64 \
$(GSFLAGS) \
-dPDFA=2 \
-sProcessColorModel=DeviceRGB \
-dPDFACompatibilityPolicy=1 \
-sOutputFile=$(2) \
/opt/pdfa/PDFA_def.ps \
$(1)
# convert markdown to PDF
# params:
# 1: input file
# 2: pandoc template
# 3: output file
md2pdf = $(call compile_md,$(1),$(2),pdf,-) | $(call postprocess_pdf,-,$(3))
# convert markdown to PDF
# 1: input file
# 2: pandoc template
# 3: output file
md2pdfa = $(call md2pdf,$(1),$(2),-) | $(call convert_pdfa,-,$(3))

View file

@ -1,97 +1,39 @@
#%SRCPAT% \.prot\.md
############
# Settings #
############
include /opt/lenaisten/lev-templates.mk
suffixPub :=
suffixInt := _intern
###########
# Default #
###########
suffixSubst = $(patsubst %.$(2),%$(4).$(3),$(1))
mdFiles := $(wildcard *.prot.md)
mdSuffix = $(patsubst %.prot.md,%$(1),$(mdFiles))
pdfFilesPub := $(call suffixSubst,$(mdFiles),prot.md,pdf,$(suffixPub))
texFilesPub := $(call suffixSubst,$(mdFiles),prot.md,tex,$(suffixPub))
pdfFilesPub := $(call mdSuffix,$(suffixPub).pdf)
texFilesPub := $(call mdSuffix,$(suffixPub).tex)
pdfFilesInt := $(call suffixSubst,$(mdFiles),prot.md,pdf,$(suffixInt))
texFilesInt := $(call suffixSubst,$(mdFiles),prot.md,tex,$(suffixInt))
pdfFilesInt := $(call mdSuffix,$(suffixInt).pdf)
texFilesInt := $(call mdSuffix,$(suffixInt).tex)
.PHONY: all pdf pdfPub pdfInt tex texPub texInt
all: pdf
.PHONY: all autodoc
all: pdf tex
autodoc: pdf
pdf: pdfPub pdfInt
pdfPub: $(pdfFilesPub)
pdfInt: $(pdfFilesInt)
tex: texPub texInt
texPub: $(texFilesPub)
texInt: $(texFilesInt)
###########
# Recipes #
###########
compile_md = pandoc \
$(2) \
--standalone \
--from markdown \
--to $(1) \
--template lev-protokoll \
--variable colorlinks:true \
--variable csquotes:true \
--variable hyperrefoptions:pdfa \
--variable lang:de-DE \
--output $(3)
GSFLAGS := \
-sDEVICE=pdfwrite \
-dNOOUTERSAVE \
-dNOPAUSE \
-dQUIET \
-dBATCH
postprocess_pdf = gs \
$(GSFLAGS) \
-sPAPERSIZE=a4 \
-dFIXEDMEDIA \
-dPDFFitPage \
-dCompatibilityLevel=1.7 \
-dPDFSETTINGS=/ebook \
-sOutputFile=$(2) \
$(1)
convert_pdfa = /opt/pdfa/bin/gs-919-linux_x86_64 \
$(GSFLAGS) \
-dPDFA=2 \
-sProcessColorModel=DeviceRGB \
-dPDFACompatibilityPolicy=1 \
-sOutputFile=$(2) \
/opt/pdfa/PDFA_def.ps \
$(1)
md2pdf = $(call compile_md,pdf,$(1),-) | $(call postprocess_pdf,-,$(2))
md2pdfa = $(call md2pdf,$(1),-) | $(call convert_pdfa,-,$(2))
.PHONY: pdf tex
pdf: $(pdfFilesPub) $(pdfFilesInt)
tex: $(texFilesPub) $(texFilesInt)
# pdf
%$(suffixPub).pdf: %.prot.md lev-shorthands.sty
python3 /opt/lenaisten/redact.py $< | $(call md2pdfa,-,$@)
python3 /opt/lenaisten/redact.py $< | $(call md2pdfa,-,lev-protokoll,$@)
%$(suffixInt).pdf: %.prot.md lev-shorthands.sty
python3 /opt/lenaisten/redact.py -i $< | $(call md2pdfa,-,$@)
python3 /opt/lenaisten/redact.py --internal $< | $(call md2pdfa,-,lev-protokoll,$@)
# tex
%$(suffixPub).tex: %.prot.md lev-shorthands.sty
python3 /opt/lenaisten/redact.py $< | $(call compile_md,latex,-,$@)
python3 /opt/lenaisten/redact.py $< | $(call compile_md,-,lev-protokoll,latex,$@)
%$(suffixInt).tex: %.prot.md lev-shorthands.sty
python3 /opt/lenaisten/redact.py -i $< | $(call compile_md,latex,-,$@)
python3 /opt/lenaisten/redact.py --internal $< | $(call compile_md,-,lev-protokoll,latex,$@)