Compare commits
2 commits
7fdbc77a7f
...
2580b1a498
Author | SHA1 | Date | |
---|---|---|---|
2580b1a498 | |||
b585819c7b |
11 changed files with 101 additions and 88 deletions
|
@ -1,14 +1,19 @@
|
||||||
FROM docker.io/ldericher/autodoc:diagram
|
FROM docker.io/ldericher/autodoc:diagram
|
||||||
|
|
||||||
# source: https://stackoverflow.com/a/39420880
|
RUN set -ex; \
|
||||||
COPY pdfa /opt/pdfa
|
\
|
||||||
|
# source: https://stackoverflow.com/a/39420880
|
||||||
# install TeXoffice
|
ln -s \
|
||||||
COPY --chown=root:root \
|
/workspaces/lev-templates/deploy/pdfa \
|
||||||
texoffice \
|
/opt/ \
|
||||||
/opt/texlive/texdir/texmf-dist/tex/latex/texoffice
|
; \
|
||||||
|
# install TeXoffice
|
||||||
RUN /opt/texlive/texdir/bin/default/texconfig rehash
|
ln -s \
|
||||||
|
/workspaces/lev-templates/deploy/texoffice \
|
||||||
# install lenaisten directory
|
/opt/texlive/texdir/texmf-dist/tex/latex/texoffice \
|
||||||
COPY --chown=root:root lenaisten /opt/lenaisten
|
; \
|
||||||
|
# install lenaisten directory
|
||||||
|
ln -s \
|
||||||
|
/workspaces/lev-templates/src/lenaisten \
|
||||||
|
/opt/lenaisten \
|
||||||
|
;
|
||||||
|
|
|
@ -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.
|
// 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
2
.gitattributes
vendored
|
@ -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
|
*.pdf filter=lfs diff=lfs merge=lfs -text
|
||||||
*.png filter=lfs diff=lfs merge=lfs -text
|
*.png filter=lfs diff=lfs merge=lfs -text
|
64
src/lenaisten/lev-templates.mk
Normal file
64
src/lenaisten/lev-templates.mk
Normal 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))
|
|
@ -1,97 +1,39 @@
|
||||||
#%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 suffixSubst,$(mdFiles),prot.md,pdf,$(suffixPub))
|
pdfFilesPub := $(call mdSuffix,$(suffixPub).pdf)
|
||||||
texFilesPub := $(call suffixSubst,$(mdFiles),prot.md,tex,$(suffixPub))
|
texFilesPub := $(call mdSuffix,$(suffixPub).tex)
|
||||||
|
|
||||||
pdfFilesInt := $(call suffixSubst,$(mdFiles),prot.md,pdf,$(suffixInt))
|
pdfFilesInt := $(call mdSuffix,$(suffixInt).pdf)
|
||||||
texFilesInt := $(call suffixSubst,$(mdFiles),prot.md,tex,$(suffixInt))
|
texFilesInt := $(call mdSuffix,$(suffixInt).tex)
|
||||||
|
|
||||||
.PHONY: all pdf pdfPub pdfInt tex texPub texInt
|
.PHONY: all autodoc
|
||||||
all: pdf
|
all: pdf tex
|
||||||
|
autodoc: pdf
|
||||||
|
|
||||||
pdf: pdfPub pdfInt
|
.PHONY: pdf tex
|
||||||
pdfPub: $(pdfFilesPub)
|
pdf: $(pdfFilesPub) $(pdfFilesInt)
|
||||||
pdfInt: $(pdfFilesInt)
|
tex: $(texFilesPub) $(texFilesInt)
|
||||||
|
|
||||||
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,-,$@)
|
python3 /opt/lenaisten/redact.py $< | $(call md2pdfa,-,lev-protokoll,$@)
|
||||||
|
|
||||||
%$(suffixInt).pdf: %.prot.md lev-shorthands.sty
|
%$(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
|
# tex
|
||||||
|
|
||||||
%$(suffixPub).tex: %.prot.md lev-shorthands.sty
|
%$(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
|
%$(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,$@)
|
||||||
|
|
Loading…
Reference in a new issue