update template

This commit is contained in:
Laila van Reenen 2025-10-06 21:09:07 +02:00
parent 0732a9d82c
commit 421966bf9e
Signed by: LailaTheElf
GPG Key ID: 8A3EF0226518C12D
6 changed files with 61 additions and 80 deletions

View File

@ -1,10 +1,10 @@
MD_FILE="$1"
BASE_DIR="$(pwd)"
TEX_FILE="${BASE_DIR}/latex/$(basename "$MD_FILE" | sed -e 's/\.md$/.latex/')"
PDF_FILE="${BASE_DIR}/pdf/$(basename "$MD_FILE" | sed -e 's/\.md$/.pdf/')"
BUILD_DIR="${BASE_DIR}/build/$(basename "$MD_FILE" | sed -e 's/\.md$//')"
TEMP_MD_FILE="$BUILD_DIR/$(basename "$MD_FILE")"
TEMP_TEX_FILE="$BUILD_DIR/$(basename "$MD_FILE" | sed -e 's|md$|latex|')"
mkdir -p "$(dirname "$TEMP_MD_FILE")"
cp "$MD_FILE" "$TEMP_MD_FILE"
@ -14,11 +14,17 @@ function download_images() {
for line in $(grep '!\[.*\](https://.*\.png)' "$1" | sed -e 's/ /%20;/g')
do
src=$(echo "$line" | sed -e 's/^.*(//' -e 's/).*$//' -e 's/%20;/ /g')
echo "remote image found: $src"
echo "download remote image: $src"
mkdir -p "${BASE_DIR}/latex/images"
mkdir -p "${BASE_DIR}/pdf/images"
name=$(echo "$src" | sed -e 's|^.*/\([^/]*\)$|\1|')
curl "$src" > "${BASE_DIR}/latex/images/$name"
if [[ ! -f "${BASE_DIR}/pdf/images/$name" ]]
then
curl "$src" >"${BASE_DIR}/pdf/images/$name"
else
echo " image already exists"
fi
sed -i "$1" -e "s|$src|${BASE_DIR}/pdf/images/$name|"
done
echo "download done"
}
@ -28,15 +34,14 @@ do
md_src=$(echo "$line" | sed -e 's/^.*(//' -e 's/).*$//' -e 's/%20;/ /g')
echo "include found: $md_src"
download_images "$(pwd)$md_src"
cp "$(pwd)$md_src" "$BUILD_DIR/$(basename "$md_src")"
download_images "$BUILD_DIR/$(basename "$md_src")"
sed -i "$BUILD_DIR/$(basename "$md_src")" \
-e 's|\[toc\]||' \
-e 's|^\[parent\].*$||' \
-e 's|\[\([^]]*\)\](#\([^)]*\))|[\1](#\L\2)|' \
-e "s|https://live.kladjes.nl/uploads|${BASE_DIR}/latex/images|" \
-e "s|\`\`\`mermaid|\`\`\`{.mermaid loc=${BASE_DIR}/latex/images/$(basename "$md_src")}|"
-e "s|\`\`\`mermaid|\`\`\`{.mermaid loc=${BASE_DIR}/pdf/images/$(basename "$md_src")}|"
sed -i "$TEMP_MD_FILE" \
-e "s|^\!\[.*\]($md_src)\$|\`\`\`\\{.include shift-heading-level-by=1\\}\n$(basename "$md_src")\n\`\`\`|"
@ -46,23 +51,16 @@ done
download_images "$TEMP_MD_FILE"
sed -i "$TEMP_MD_FILE" \
-e 's|\[toc\]|\\tableofcontents|' \
-e 's|^\[parent\].*$||' \
-e 's|\[\([^]]*\)\](#\([^)]*\))|[\1](#\L\2)|' \
-e "s|https://live.kladjes.nl/uploads|${BASE_DIR}/latex/images|" \
-e "s|\`\`\`mermaid|\`\`\`{.mermaid loc=${BASE_DIR}/latex/images/$(basename "$MD_FILE")}|"
-e "s|\`\`\`mermaid|\`\`\`{.mermaid loc=${BASE_DIR}/pdf/images/$(basename "$MD_FILE")}|"
# -e 's|```\([^ \t]\)=|```\1 {linenumbers}|'
mkdir -p ${BASE_DIR}/latex/images/$(basename "$MD_FILE")
mkdir -p ${BASE_DIR}/pdf/images/$(basename "$MD_FILE")
cd "$BUILD_DIR"
pandoc \
pandoc --standalone \
--lua-filter=../../converters/include-files.lua \
--lua-filter=../../converters/headers.lua \
--to=latex \
-t latex --pdf-engine=xelatex \
--from=markdown+abbreviations \
--template "${BASE_DIR}/converters/template.latex" \
-o "$TEX_FILE" \
--dpi 300 \
-o "$PDF_FILE" \
"$(basename "$TEMP_MD_FILE")"
cd "$BASE_DIR"

View File

@ -1,7 +1,7 @@
\documentclass[11pt]{article}
\usepackage[a4paper, portrait, includehead, includefoot, margin=1.5cm]{geometry}
\usepackage[english]{babel}
\usepackage[$if(lang)$$lang$$else$dutch$endif$]{babel}
\usepackage{pdfpages}
@ -85,11 +85,12 @@ $endif$
\large
\lineskip .75em
\begin{tabular}{r l}
Auther: $for(auther)$& $auther.name$ <$auther.email$> \\
$if(lang)$Auther$else$Gemaakt door$endif$: $for(auther)$& $auther.name$ <$auther.email$> \\
$endfor$\\
Class code: & $class_code$ \\\\
Exported on: & \today
$if(class_code)$
$if(lang)$Class code$else$Vak code$endif$: & $class_code$ \\\\
$endif$
$if(lang)$Exported on$else$Ge\"exporteerd op$endif$: & \today
\end{tabular}
}
\end{titlepage}
@ -103,40 +104,38 @@ $endif$
\fancyfoot[CO]{\color{gray}\fontUbuntu }
\fancyfoot[RO]{\color{gray}\fontUbuntu \thepage}
$if(toc)$
\tableofcontents
$endif$
$if(lof)$
\listoffigures
$endif$
$if(lot)$
\listoftables
$endif$
$if(linestretch)$
\setstretch{$linestretch$}
$endif$
$body$
$if(nocite-ids)$
\nocite{$for(nocite-ids)$$it$$sep$, $endfor$}
$endif$
$if(natbib)$
$if(bibliography)$
$if(biblio-title)$
$if(has-chapters)$
\renewcommand\bibname{$biblio-title$}
$else$
\renewcommand\refname{$biblio-title$}
$endif$
$endif$
\bibliography{$for(bibliography)$$bibliography$$sep$,$endfor$}
% $if(nocite-ids)$
% \nocite{$for(nocite-ids)$$it$$sep$, $endfor$}
% $endif$
% $if(natbib)$
% $if(bibliography)$
% $if(biblio-title)$
% $if(has-chapters)$
% \renewcommand\bibname{$biblio-title$}
% $else$
% \renewcommand\refname{$biblio-title$}
% $endif$
% $endif$
% \bibliography{$for(bibliography)$$bibliography$$sep$,$endfor$}
$endif$
$endif$
$if(biblatex)$
\printbibliography$if(biblio-title)$[title=$biblio-title$]$endif$
% $endif$
% $endif$
% $if(biblatex)$
% \printbibliography$if(biblio-title)$[title=$biblio-title$]$endif$
$endif$
% $endif$
\end{document}

View File

@ -4,13 +4,13 @@ all: all_booklets all_docduments
all_docduments: prepare pdf/assambly_report.pdf pdf/c_report.pdf
all_booklets: prepare pdf/assambly_report.booklet.pdf pdf/c_report.booklet.pdf
prepare:
mkdir -p latex pdf
mkdir -p pdf
clean:
rm -r build latex
rm -r build
clean_all:
rm -r build latex pdf
rm -r build pdf
install_arch:
mkdir -p build/install
@ -58,27 +58,13 @@ install_ubuntu:
chmod 0775 /usr/share/fonts/roboto
chmod 0664 /usr/share/fonts/roboto/*
# =======================================
# === latex generation ==================
# =======================================
latex/assambly_report.latex: converters/mdToLatex.sh converters/template.latex report-1/*.md
mkdir -p build/assambly_report
bash converters/mdToLatex.sh report-1/assambly_report.md latex/assambly_report.latex
latex/c_report.latex: converters/mdToLatex.sh converters/template.latex report-2/*.md
mkdir -p build/c_report
bash converters/mdToLatex.sh report-2/c_report.md latex/c_report.latex
# =======================================
# === pdf generation ====================
# =======================================
pdf/assambly_report.pdf: latex/assambly_report.latex
cd build/assambly_report && xelatex ../../latex/assambly_report.latex
cd build/assambly_report && xelatex ../../latex/assambly_report.latex
cd build/assambly_report && xelatex ../../latex/assambly_report.latex
mv build/assambly_report/assambly_report.pdf pdf/assambly_report.pdf
pdf/assambly_report.pdf: converters/* report-1/*.md
mkdir -p build/assambly_report
bash converters/mdToLatex.sh report-1/assambly_report.md
pdf/assambly_report.booklet.pdf: converters/bookletify.latex pdf/assambly_report.pdf
mkdir -p build/assambly_report.booklet
@ -86,11 +72,9 @@ pdf/assambly_report.booklet.pdf: converters/bookletify.latex pdf/assambly_report
pdflatex -interaction=nonstopmode -output-directory="build/assambly_report.booklet" "build/assambly_report.booklet/bookletify.latex"
mv build/assambly_report.booklet/bookletify.pdf pdf/assambly_report.booklet.pdf
pdf/c_report.pdf: latex/c_report.latex
cd build/c_report && xelatex ../../latex/c_report.latex
cd build/c_report && xelatex ../../latex/c_report.latex
cd build/c_report && xelatex ../../latex/c_report.latex
mv build/c_report/c_report.pdf pdf/c_report.pdf
pdf/c_report.pdf: converters/* report-2/*.md
mkdir -p build/c_report
bash converters/mdToLatex.sh report-2/c_report.md
pdf/c_report.booklet.pdf: converters/bookletify.latex pdf/c_report.pdf
mkdir -p build/c_report.booklet

View File

@ -1,6 +1,8 @@
---
sub_title: "Real Time Systems 10"
class_code: "ELERTS10"
toc: true
lang: english
auther:
- name: "Finley van Reenen (0964590)"
email: "mail@lailatheelf.nl"
@ -9,8 +11,6 @@ auther:
# Assambly Report
[toc]
![](/report-1/assambly_assignments.md)
![](/report-1/week_1.2.md)

View File

@ -1,6 +1,8 @@
---
sub_title: "Real Time Systems 10"
class_code: "ELERTS10"
toc: true
lang: english
auther:
- name: "Finley van Reenen (0964590)"
email: "mail@lailatheelf.nl"
@ -9,8 +11,6 @@ auther:
# C Report
[toc]
![](/report-2/week_1.3.md)
![](/report-2/week_1.4.md)

View File

@ -440,7 +440,7 @@ int main(void)
> Now add initial delays (in systicks) to your tasks. Use an initial delay of 100, 200, 300, and 400 for green, orange, red, and blue respectively. Make use of a logic analyser to verify the timing.
When A task is created, in the version of [Assignment 3.6](#assignment-36), the following function is used:
When A task is created, in the version of [Assignment 3.6], the following function is used:
```c
bool addTask(void (*fn)(void), uint32_t counter)