Compare commits

..

No commits in common. "2580b1a49888b32601b5d796f8b268226b806c22" and "7fdbc77a7f5231dde9d6a29dfa5ce2d5150b610a" have entirely different histories.

11 changed files with 88 additions and 101 deletions

View file

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

View file

@ -35,8 +35,6 @@
} }
}, },
"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. // Set `remoteUser` to `root` to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode" "remoteUser": "vscode"

2
.gitattributes vendored
View file

@ -1,3 +1,3 @@
deploy/pdfa/bin/* filter=lfs diff=lfs merge=lfs -text .devcontainer/pdfa/bin/* filter=lfs diff=lfs merge=lfs -text
*.pdf 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

@ -1,64 +0,0 @@
# 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,39 +1,97 @@
#%SRCPAT% \.prot\.md #%SRCPAT% \.prot\.md
include /opt/lenaisten/lev-templates.mk ############
# Settings #
############
suffixPub := suffixPub :=
suffixInt := _intern suffixInt := _intern
###########
# Default #
###########
suffixSubst = $(patsubst %.$(2),%$(4).$(3),$(1))
mdFiles := $(wildcard *.prot.md) mdFiles := $(wildcard *.prot.md)
mdSuffix = $(patsubst %.prot.md,%$(1),$(mdFiles))
pdfFilesPub := $(call mdSuffix,$(suffixPub).pdf) pdfFilesPub := $(call suffixSubst,$(mdFiles),prot.md,pdf,$(suffixPub))
texFilesPub := $(call mdSuffix,$(suffixPub).tex) texFilesPub := $(call suffixSubst,$(mdFiles),prot.md,tex,$(suffixPub))
pdfFilesInt := $(call mdSuffix,$(suffixInt).pdf) pdfFilesInt := $(call suffixSubst,$(mdFiles),prot.md,pdf,$(suffixInt))
texFilesInt := $(call mdSuffix,$(suffixInt).tex) texFilesInt := $(call suffixSubst,$(mdFiles),prot.md,tex,$(suffixInt))
.PHONY: all autodoc .PHONY: all pdf pdfPub pdfInt tex texPub texInt
all: pdf tex all: pdf
autodoc: pdf
.PHONY: pdf tex pdf: pdfPub pdfInt
pdf: $(pdfFilesPub) $(pdfFilesInt) pdfPub: $(pdfFilesPub)
tex: $(texFilesPub) $(texFilesInt) 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))
# pdf # pdf
%$(suffixPub).pdf: %.prot.md lev-shorthands.sty %$(suffixPub).pdf: %.prot.md lev-shorthands.sty
python3 /opt/lenaisten/redact.py $< | $(call md2pdfa,-,lev-protokoll,$@) python3 /opt/lenaisten/redact.py $< | $(call md2pdfa,-,$@)
%$(suffixInt).pdf: %.prot.md lev-shorthands.sty %$(suffixInt).pdf: %.prot.md lev-shorthands.sty
python3 /opt/lenaisten/redact.py --internal $< | $(call md2pdfa,-,lev-protokoll,$@) python3 /opt/lenaisten/redact.py -i $< | $(call md2pdfa,-,$@)
# tex # tex
%$(suffixPub).tex: %.prot.md lev-shorthands.sty %$(suffixPub).tex: %.prot.md lev-shorthands.sty
python3 /opt/lenaisten/redact.py $< | $(call compile_md,-,lev-protokoll,latex,$@) python3 /opt/lenaisten/redact.py $< | $(call compile_md,latex,-,$@)
%$(suffixInt).tex: %.prot.md lev-shorthands.sty %$(suffixInt).tex: %.prot.md lev-shorthands.sty
python3 /opt/lenaisten/redact.py --internal $< | $(call compile_md,-,lev-protokoll,latex,$@) python3 /opt/lenaisten/redact.py -i $< | $(call compile_md,latex,-,$@)