Skip to content

Commit 51188a9

Browse files
committed
pdfmaker
1 parent 477325e commit 51188a9

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

nix/configuration.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -775,6 +775,7 @@ in {
775775
neovim
776776
vibe
777777
qute
778+
(import ./pdfmaker.nix)
778779
(import ./vidmaker.nix)
779780
(import ./clipmaker.nix)
780781
(import ./bar.nix {inherit pkgs;})

nix/pdfmaker.nix

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ in
1212
1313
TMP="$(mktemp -d)"
1414
WORK="$TMP/processed.md"
15+
HEADER="$TMP/header.tex"
16+
17+
echo '\usepackage{graphicx}' > "$HEADER"
18+
1519
cp "$INPUT" "$WORK"
1620
1721
LINKS=$(sed -n 's/.*(\(http[^)]*\)).*/\1/p' "$INPUT" | sort -u)
@@ -22,16 +26,16 @@ in
2226
PDF="$TMP/qr_$i.pdf"
2327
2428
qrencode -o "$PNG" -s 3 -m 1 "$URL"
25-
2629
magick "$PNG" "$PDF"
2730
2831
ESCAPED=$(printf '%s\n' "$URL" | sed -e 's/[\/&]/\\&/g')
29-
sed -i "s|($ESCAPED)|($ESCAPED)\n\n![]($PDF){ width=2cm }|g" "$WORK"
32+
33+
sed -i "s|($ESCAPED)|($ESCAPED)\n\n\\\\begin{center}\n\\\\includegraphics[width=2cm]{$PDF}\n\\\\end{center}\n|g" "$WORK"
3034
3135
i=$((i+1))
3236
done
3337
34-
pandoc "$WORK" --standalone --pdf-engine=xelatex -o "$OUTPUT"
38+
pandoc "$WORK" --standalone --pdf-engine=xelatex --include-in-header="$HEADER" -o "$OUTPUT"
3539
'';
3640

3741
runtimeInputs = with pkgs; [

0 commit comments

Comments
 (0)