feat: Add build.sh/dev.sh with LANG arg

This commit is contained in:
c c 2026-09-11 12:04:24 +02:00
commit 262afbb425
5 changed files with 32 additions and 12 deletions

View file

@ -1241,12 +1241,12 @@ x
endstream
endobj
315 0 obj
<</Creator(Typst 0.15.1)/ModDate(D:20260910122044+02'00)/CreationDate(D:20260910122044+02'00)>>
<</Creator(Typst 0.15.1)/ModDate(D:20260911111821+02'00)/CreationDate(D:20260911111821+02'00)>>
endobj
316 0 obj
<</Length 996/Type/Metadata/Subtype/XML>>
stream
<?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?><x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="xmp-writer"><rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"><rdf:Description rdf:about="" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:xmp="http://ns.adobe.com/xap/1.0/" xmlns:xmpMM="http://ns.adobe.com/xap/1.0/mm/" xmlns:xmpTPg="http://ns.adobe.com/xap/1.0/t/pg/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" ><xmp:CreatorTool>Typst 0.15.1</xmp:CreatorTool><dc:language><rdf:Bag><rdf:li>en</rdf:li></rdf:Bag></dc:language><xmp:ModifyDate>2026-09-10T12:20:44+02:00</xmp:ModifyDate><xmp:CreateDate>2026-09-10T12:20:44+02:00</xmp:CreateDate><xmpTPg:NPages>8</xmpTPg:NPages><dc:format>application/pdf</dc:format><xmpMM:InstanceID>jAfoPMgY5G7aMlUjnGImJQ==</xmpMM:InstanceID><xmpMM:DocumentID>jAfoPMgY5G7aMlUjnGImJQ==</xmpMM:DocumentID><xmpMM:RenditionClass>proof</xmpMM:RenditionClass><pdf:PDFVersion>1.7</pdf:PDFVersion></rdf:Description></rdf:RDF></x:xmpmeta><?xpacket end="r"?>
<?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?><x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="xmp-writer"><rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"><rdf:Description rdf:about="" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:xmp="http://ns.adobe.com/xap/1.0/" xmlns:xmpMM="http://ns.adobe.com/xap/1.0/mm/" xmlns:xmpTPg="http://ns.adobe.com/xap/1.0/t/pg/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" ><xmp:CreatorTool>Typst 0.15.1</xmp:CreatorTool><dc:language><rdf:Bag><rdf:li>en</rdf:li></rdf:Bag></dc:language><xmp:ModifyDate>2026-09-11T11:18:21+02:00</xmp:ModifyDate><xmp:CreateDate>2026-09-11T11:18:21+02:00</xmp:CreateDate><xmpTPg:NPages>8</xmpTPg:NPages><dc:format>application/pdf</dc:format><xmpMM:InstanceID>VkAfYY0Sdfg4RWJhs1teCg==</xmpMM:InstanceID><xmpMM:DocumentID>VkAfYY0Sdfg4RWJhs1teCg==</xmpMM:DocumentID><xmpMM:RenditionClass>proof</xmpMM:RenditionClass><pdf:PDFVersion>1.7</pdf:PDFVersion></rdf:Description></rdf:RDF></x:xmpmeta><?xpacket end="r"?>
endstream
endobj
317 0 obj
@ -1573,7 +1573,7 @@ xref
0000092468 00000 n
0000093541 00000 n
trailer
<</Size 318/Root 317 0 R/Info 315 0 R/ID[(jAfoPMgY5G7aMlUjnGImJQ==)(jAfoPMgY5G7aMlUjnGImJQ==)]>>
<</Size 318/Root 317 0 R/Info 315 0 R/ID[(VkAfYY0Sdfg4RWJhs1teCg==)(VkAfYY0Sdfg4RWJhs1teCg==)]>>
startxref
93745
%%EOF

View file

@ -5,8 +5,19 @@ basedir="$(realpath "$basedir")"
cd "$basedir"
name="$(basename "$(pwd)")"
if ! typst compile --root .. ./main.typ ./"$name".pdf; then
echo "Failed to compile $name/main.typ. Please fix errors and run me again."
# Check if we want to run against a certain translation
if [ $# -lt 1 ]; then
echo "Please specify the language you want to build (eg. fr)"
exit 1
fi
TARGETLANG="$1"
SOURCEFILE="main.${TARGETLANG}.typ"
TARGETFILE="$name".$TARGETLANG.pdf
TARGETFILEBOOK="$name".${TARGETLANG}-book.pdf
if ! typst compile --root .. ./"$SOURCEFILE" ./"$TARGETFILE"; then
echo "Failed to compile "$name"/"$SOURCEFILE". Please fix errors and run me again."
exit 1
fi
@ -18,7 +29,7 @@ if ! command -v pdfbook2; then
fi
t="$(mktemp --suffix=.pdf)"
typst compile --input format=booklet --root .. ./main.typ "$t"
typst compile --input format=booklet --root .. ./"$SOURCEFILE" "$t"
# Need to be in the folder there for it to work, otherwise it
# tries to rename from current partition to /tmp which of course fails
@ -30,6 +41,5 @@ cd "$parent"
pdfbook2 --paper=a4paper "$t" --no-crop --outer-margin=0 --inner-margin=0 --top-margin=0 --bottom-margin=0
cd "$basedir"
newFinalFile="$name"-book.pdf
cp "$newFile" "$newFinalFile"
echo "Booklet available in $newFinalFile"
cp "$newFile" "$TARGETFILEBOOK"
echo "Booklet available in $TARGETFILEBOOK"

View file

@ -3,13 +3,23 @@
cd "$(dirname "$0")"
name="$(basename "$(pwd)")"
# Check if we want to run against a certain translation
if [ $# -lt 1 ]; then
echo "Please specify the language you want to build (eg. fr)"
exit 1
fi
TARGETLANG="$1"
SOURCEFILE="main.${TARGETLANG}.typ"
t="$(mktemp --suffix=.pdf)"
if ! typst compile --root .. ./main.typ "$t"; then
echo "Failed to compile $name/main.typ. Please fix errors and run me again."
if ! typst compile --root .. ./"$SOURCEFILE" "$t"; then
echo "Failed to compile $name/"$SOURCEFILE". Please fix errors and run me again."
exit 1
fi
echo "Initial compilation successful. Now starting watch mode. Opening $t"
xdg-open "$t"
typst watch --root .. ./main.typ "$t"
typst watch --root .. ./"$SOURCEFILE" "$t"