update template
This commit is contained in:
		
							parent
							
								
									0732a9d82c
								
							
						
					
					
						commit
						421966bf9e
					
				| @ -1,10 +1,10 @@ | |||||||
| MD_FILE="$1" | MD_FILE="$1" | ||||||
| 
 | 
 | ||||||
| BASE_DIR="$(pwd)" | 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$//')" | BUILD_DIR="${BASE_DIR}/build/$(basename "$MD_FILE" | sed -e 's/\.md$//')" | ||||||
| TEMP_MD_FILE="$BUILD_DIR/$(basename "$MD_FILE")" | 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")" | mkdir -p "$(dirname "$TEMP_MD_FILE")" | ||||||
| 
 | 
 | ||||||
| cp "$MD_FILE" "$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') |     for line in $(grep '!\[.*\](https://.*\.png)' "$1" | sed -e 's/ /%20;/g') | ||||||
|     do |     do | ||||||
|         src=$(echo "$line" | sed -e 's/^.*(//' -e 's/).*$//' -e 's/%20;/ /g') |         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|') |         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 |     done | ||||||
|     echo "download done" |     echo "download done" | ||||||
| } | } | ||||||
| @ -28,15 +34,14 @@ do | |||||||
|     md_src=$(echo "$line" | sed -e 's/^.*(//' -e 's/).*$//' -e 's/%20;/ /g') |     md_src=$(echo "$line" | sed -e 's/^.*(//' -e 's/).*$//' -e 's/%20;/ /g') | ||||||
|     echo "include found: $md_src" |     echo "include found: $md_src" | ||||||
| 
 | 
 | ||||||
|     download_images "$(pwd)$md_src" |  | ||||||
| 
 |  | ||||||
|     cp "$(pwd)$md_src" "$BUILD_DIR/$(basename "$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")" \ |     sed -i "$BUILD_DIR/$(basename "$md_src")" \ | ||||||
|         -e 's|\[toc\]||' \ |         -e 's|\[toc\]||' \ | ||||||
|         -e 's|^\[parent\].*$||' \ |         -e 's|^\[parent\].*$||' \ | ||||||
|         -e 's|\[\([^]]*\)\](#\([^)]*\))|[\1](#\L\2)|' \ |         -e "s|\`\`\`mermaid|\`\`\`{.mermaid loc=${BASE_DIR}/pdf/images/$(basename "$md_src")}|" | ||||||
|         -e "s|https://live.kladjes.nl/uploads|${BASE_DIR}/latex/images|" \ |  | ||||||
|         -e "s|\`\`\`mermaid|\`\`\`{.mermaid loc=${BASE_DIR}/latex/images/$(basename "$md_src")}|" |  | ||||||
| 
 | 
 | ||||||
|     sed -i "$TEMP_MD_FILE" \ |     sed -i "$TEMP_MD_FILE" \ | ||||||
|         -e "s|^\!\[.*\]($md_src)\$|\`\`\`\\{.include shift-heading-level-by=1\\}\n$(basename "$md_src")\n\`\`\`|" |         -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" | download_images "$TEMP_MD_FILE" | ||||||
| 
 | 
 | ||||||
| sed -i "$TEMP_MD_FILE" \ | sed -i "$TEMP_MD_FILE" \ | ||||||
|     -e 's|\[toc\]|\\tableofcontents|' \ |     -e "s|\`\`\`mermaid|\`\`\`{.mermaid loc=${BASE_DIR}/pdf/images/$(basename "$MD_FILE")}|" | ||||||
|     -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|```\([^ \t]\)=|```\1 {linenumbers}|' | mkdir -p ${BASE_DIR}/pdf/images/$(basename "$MD_FILE") | ||||||
| 
 |  | ||||||
| mkdir -p ${BASE_DIR}/latex/images/$(basename "$MD_FILE") |  | ||||||
| cd "$BUILD_DIR" | cd "$BUILD_DIR" | ||||||
| pandoc \ | pandoc --standalone \ | ||||||
|     --lua-filter=../../converters/include-files.lua \ |     --lua-filter=../../converters/include-files.lua \ | ||||||
|     --lua-filter=../../converters/headers.lua \ |     --lua-filter=../../converters/headers.lua \ | ||||||
|     --to=latex \ |     -t latex --pdf-engine=xelatex \ | ||||||
|     --from=markdown+abbreviations \ |     --from=markdown+abbreviations \ | ||||||
|     --template "${BASE_DIR}/converters/template.latex" \ |     --template "${BASE_DIR}/converters/template.latex" \ | ||||||
|     -o "$TEX_FILE" \ |     -o "$PDF_FILE" \ | ||||||
|     --dpi 300 \ |  | ||||||
|     "$(basename "$TEMP_MD_FILE")" |     "$(basename "$TEMP_MD_FILE")" | ||||||
| cd "$BASE_DIR" | cd "$BASE_DIR" | ||||||
|  | |||||||
| @ -1,7 +1,7 @@ | |||||||
| \documentclass[11pt]{article} | \documentclass[11pt]{article} | ||||||
| \usepackage[a4paper, portrait, includehead, includefoot, margin=1.5cm]{geometry} | \usepackage[a4paper, portrait, includehead, includefoot, margin=1.5cm]{geometry} | ||||||
| 
 | 
 | ||||||
| \usepackage[english]{babel} | \usepackage[$if(lang)$$lang$$else$dutch$endif$]{babel} | ||||||
| 
 | 
 | ||||||
| \usepackage{pdfpages} | \usepackage{pdfpages} | ||||||
| 
 | 
 | ||||||
| @ -85,11 +85,12 @@ $endif$ | |||||||
|         \large |         \large | ||||||
|         \lineskip .75em |         \lineskip .75em | ||||||
|         \begin{tabular}{r l} |         \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$\\ |                          $endfor$\\ | ||||||
|              Class code: & $class_code$ \\\\ | $if(class_code)$ | ||||||
|             Exported on: & \today | $if(lang)$Class code$else$Vak code$endif$: & $class_code$ \\\\ | ||||||
| 
 | $endif$ | ||||||
|  | $if(lang)$Exported on$else$Ge\"exporteerd op$endif$: & \today | ||||||
|         \end{tabular} |         \end{tabular} | ||||||
|     } |     } | ||||||
| \end{titlepage} | \end{titlepage} | ||||||
| @ -103,40 +104,38 @@ $endif$ | |||||||
| \fancyfoot[CO]{\color{gray}\fontUbuntu } | \fancyfoot[CO]{\color{gray}\fontUbuntu } | ||||||
| \fancyfoot[RO]{\color{gray}\fontUbuntu \thepage} | \fancyfoot[RO]{\color{gray}\fontUbuntu \thepage} | ||||||
| 
 | 
 | ||||||
| 
 | $if(toc)$ | ||||||
|  | \tableofcontents | ||||||
|  | $endif$ | ||||||
| $if(lof)$ | $if(lof)$ | ||||||
| \listoffigures | \listoffigures | ||||||
| $endif$ | $endif$ | ||||||
| $if(lot)$ | $if(lot)$ | ||||||
| \listoftables | \listoftables | ||||||
| $endif$ | $endif$ | ||||||
| $if(linestretch)$ |  | ||||||
| \setstretch{$linestretch$} |  | ||||||
| $endif$ |  | ||||||
| 
 |  | ||||||
| 
 | 
 | ||||||
| $body$ | $body$ | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| $if(nocite-ids)$ | % $if(nocite-ids)$ | ||||||
| \nocite{$for(nocite-ids)$$it$$sep$, $endfor$} | % \nocite{$for(nocite-ids)$$it$$sep$, $endfor$} | ||||||
| $endif$ | % $endif$ | ||||||
| $if(natbib)$ | % $if(natbib)$ | ||||||
| $if(bibliography)$ | % $if(bibliography)$ | ||||||
| $if(biblio-title)$ | % $if(biblio-title)$ | ||||||
| $if(has-chapters)$ | % $if(has-chapters)$ | ||||||
| \renewcommand\bibname{$biblio-title$} | % \renewcommand\bibname{$biblio-title$} | ||||||
| $else$ | % $else$ | ||||||
| \renewcommand\refname{$biblio-title$} | % \renewcommand\refname{$biblio-title$} | ||||||
| $endif$ | % $endif$ | ||||||
| $endif$ | % $endif$ | ||||||
| \bibliography{$for(bibliography)$$bibliography$$sep$,$endfor$} | % \bibliography{$for(bibliography)$$bibliography$$sep$,$endfor$} | ||||||
| 
 | 
 | ||||||
| $endif$ | % $endif$ | ||||||
| $endif$ | % $endif$ | ||||||
| $if(biblatex)$ | % $if(biblatex)$ | ||||||
| \printbibliography$if(biblio-title)$[title=$biblio-title$]$endif$ | % \printbibliography$if(biblio-title)$[title=$biblio-title$]$endif$ | ||||||
| 
 | 
 | ||||||
| $endif$ | % $endif$ | ||||||
| 
 | 
 | ||||||
| \end{document} | \end{document} | ||||||
|  | |||||||
							
								
								
									
										34
									
								
								makefile
									
									
									
									
									
								
							
							
						
						
									
										34
									
								
								makefile
									
									
									
									
									
								
							| @ -4,13 +4,13 @@ all: all_booklets all_docduments | |||||||
| all_docduments: prepare pdf/assambly_report.pdf pdf/c_report.pdf | all_docduments: prepare pdf/assambly_report.pdf pdf/c_report.pdf | ||||||
| all_booklets: prepare pdf/assambly_report.booklet.pdf pdf/c_report.booklet.pdf | all_booklets: prepare pdf/assambly_report.booklet.pdf pdf/c_report.booklet.pdf | ||||||
| prepare: | prepare: | ||||||
| 	mkdir -p latex pdf | 	mkdir -p pdf | ||||||
| 
 | 
 | ||||||
| clean: | clean: | ||||||
| 	rm -r build latex | 	rm -r build | ||||||
| 
 | 
 | ||||||
| clean_all: | clean_all: | ||||||
| 	rm -r build latex pdf | 	rm -r build pdf | ||||||
| 
 | 
 | ||||||
| install_arch: | install_arch: | ||||||
| 	mkdir -p build/install | 	mkdir -p build/install | ||||||
| @ -58,27 +58,13 @@ install_ubuntu: | |||||||
| 	chmod 0775 /usr/share/fonts/roboto | 	chmod 0775 /usr/share/fonts/roboto | ||||||
| 	chmod 0664 /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 generation ====================
 | ||||||
| # =======================================
 | # =======================================
 | ||||||
| 
 | 
 | ||||||
| pdf/assambly_report.pdf: latex/assambly_report.latex | pdf/assambly_report.pdf: converters/* report-1/*.md | ||||||
| 	cd build/assambly_report && xelatex ../../latex/assambly_report.latex | 	mkdir -p build/assambly_report | ||||||
| 	cd build/assambly_report && xelatex ../../latex/assambly_report.latex | 	bash converters/mdToLatex.sh report-1/assambly_report.md | ||||||
| 	cd build/assambly_report && xelatex ../../latex/assambly_report.latex |  | ||||||
| 	mv build/assambly_report/assambly_report.pdf pdf/assambly_report.pdf |  | ||||||
| 
 | 
 | ||||||
| pdf/assambly_report.booklet.pdf: converters/bookletify.latex pdf/assambly_report.pdf | pdf/assambly_report.booklet.pdf: converters/bookletify.latex pdf/assambly_report.pdf | ||||||
| 	mkdir -p build/assambly_report.booklet | 	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" | 	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 | 	mv build/assambly_report.booklet/bookletify.pdf pdf/assambly_report.booklet.pdf | ||||||
| 
 | 
 | ||||||
| pdf/c_report.pdf: latex/c_report.latex | pdf/c_report.pdf: converters/* report-2/*.md | ||||||
| 	cd build/c_report && xelatex ../../latex/c_report.latex | 	mkdir -p build/c_report | ||||||
| 	cd build/c_report && xelatex ../../latex/c_report.latex | 	bash converters/mdToLatex.sh report-2/c_report.md | ||||||
| 	cd build/c_report && xelatex ../../latex/c_report.latex |  | ||||||
| 	mv build/c_report/c_report.pdf pdf/c_report.pdf |  | ||||||
| 
 | 
 | ||||||
| pdf/c_report.booklet.pdf: converters/bookletify.latex pdf/c_report.pdf | pdf/c_report.booklet.pdf: converters/bookletify.latex pdf/c_report.pdf | ||||||
| 	mkdir -p build/c_report.booklet | 	mkdir -p build/c_report.booklet | ||||||
|  | |||||||
| @ -1,6 +1,8 @@ | |||||||
| --- | --- | ||||||
| sub_title: "Real Time Systems 10" | sub_title: "Real Time Systems 10" | ||||||
| class_code: "ELERTS10" | class_code: "ELERTS10" | ||||||
|  | toc: true | ||||||
|  | lang: english | ||||||
| auther:  | auther:  | ||||||
|   - name: "Finley van Reenen (0964590)" |   - name: "Finley van Reenen (0964590)" | ||||||
|     email: "mail@lailatheelf.nl" |     email: "mail@lailatheelf.nl" | ||||||
| @ -9,8 +11,6 @@ auther: | |||||||
| 
 | 
 | ||||||
| # Assambly Report | # Assambly Report | ||||||
| 
 | 
 | ||||||
| [toc] |  | ||||||
| 
 |  | ||||||
|  |  | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | |||||||
| @ -1,6 +1,8 @@ | |||||||
| --- | --- | ||||||
| sub_title: "Real Time Systems 10" | sub_title: "Real Time Systems 10" | ||||||
| class_code: "ELERTS10" | class_code: "ELERTS10" | ||||||
|  | toc: true | ||||||
|  | lang: english | ||||||
| auther:  | auther:  | ||||||
|   - name: "Finley van Reenen (0964590)" |   - name: "Finley van Reenen (0964590)" | ||||||
|     email: "mail@lailatheelf.nl" |     email: "mail@lailatheelf.nl" | ||||||
| @ -9,8 +11,6 @@ auther: | |||||||
| 
 | 
 | ||||||
| # C Report | # C Report | ||||||
| 
 | 
 | ||||||
| [toc] |  | ||||||
| 
 |  | ||||||
|  |  | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | |||||||
| @ -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. | > 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 | ```c | ||||||
| bool addTask(void  (*fn)(void), uint32_t counter) | bool addTask(void  (*fn)(void), uint32_t counter) | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user