commit 73e3532c35267a25873735e14200c2ddc43f983c Author: Buutti Education <> Date: Mon Jul 7 11:50:22 2025 +0000 Initial commit diff --git a/.scripts/.gitattributes b/.scripts/.gitattributes new file mode 100644 index 0000000..8218efd --- /dev/null +++ b/.scripts/.gitattributes @@ -0,0 +1 @@ +*.sh eol=lf \ No newline at end of file diff --git a/.scripts/buildHTMLslides.bat b/.scripts/buildHTMLslides.bat new file mode 100644 index 0000000..c4bfb46 --- /dev/null +++ b/.scripts/buildHTMLslides.bat @@ -0,0 +1,11 @@ +for /d %%A in (.\*) do ( + set "except=" + if /i "%%~nxA" == "temp" set "except=1" + if /i "%%~nxA" == "_site" set "except=1" + if /i "%%~nxA" == ".jekyll-cache" set "except=1" + if not defined except ( + for %%j in (%%A\*.md) do ( + marp %%j -o %%~pj%%~nj-slides.html --html true + ) + ) +) diff --git a/.scripts/buildPDFslides.bat b/.scripts/buildPDFslides.bat new file mode 100644 index 0000000..545efa3 --- /dev/null +++ b/.scripts/buildPDFslides.bat @@ -0,0 +1,11 @@ +for /d %%A in (.\*) do ( + set "except=" + if /i "%%~nxA" == "temp" set "except=1" + if /i "%%~nxA" == "_site" set "except=1" + if /i "%%~nxA" == ".jekyll-cache" set "except=1" + if not defined except ( + for %%j in (%%A\*.md) do ( + marp %%j -o %%~pj%%~nj.pdf --html true + ) + ) +) diff --git a/.scripts/convertAndReplaceAll.bat b/.scripts/convertAndReplaceAll.bat new file mode 100644 index 0000000..a455c59 --- /dev/null +++ b/.scripts/convertAndReplaceAll.bat @@ -0,0 +1,32 @@ +wsl bash renamePptx.sh +call convertPptxToMd.bat +REN img imgs + +chcp 65001 + +wsl bash replace.sh "" ")" +wsl bash replace.sh "\{" "{" +wsl bash replace.sh "\}" "}" +wsl bash replace.sh "\[" "[" +wsl bash replace.sh "\]" "]" +wsl bash replace.sh "_[" "[" +wsl bash replace.sh ")_" ")" +wsl bash replace.sh "”" "\"" +wsl bash replace.sh "“" "\"" +wsl bash replace.sh "’" "'" +wsl bash replace.sh "‘" "'" + +wsl bash replace.sh "\\\\" "\\" +wsl bash replace.sh "\<" "<" + +wsl bash removeLinebreaks.sh \ No newline at end of file diff --git a/.scripts/convertPptxToMd.bat b/.scripts/convertPptxToMd.bat new file mode 100644 index 0000000..f2e50e2 --- /dev/null +++ b/.scripts/convertPptxToMd.bat @@ -0,0 +1,3 @@ +for %%j in (.\*.pptx) do ( + pptx2md --disable-color "%%j" -o "%%~pj%%~nj.md" +) \ No newline at end of file diff --git a/.scripts/generateREADME.py b/.scripts/generateREADME.py new file mode 100644 index 0000000..ca07ea9 --- /dev/null +++ b/.scripts/generateREADME.py @@ -0,0 +1,49 @@ +import os +import re +from pathlib import Path + +def get_first_title(md_path): + with open(md_path, 'r', encoding='utf-8') as file: + for line in file: + match = re.match(r'^#\s+(.*)', line.strip()) + if match: + return match.group(1) + return "Untitled" + +def extract_leading_number(filename): + match = re.match(r'^(\d{1,2})[_\- ]', filename) + return match.group(1) if match else None + +def generate_markdown_table(directory): + entries = [] + for filename in os.listdir(directory): + if filename.endswith('.md'): + number = extract_leading_number(filename) + if number is None: + continue # Skip files without leading number + filepath = os.path.join(directory, filename) + title = get_first_title(filepath) + entries.append((int(number), number, title, filename)) + + entries.sort(key=lambda x: x[0]) + + table = ["| # | Lecture | Slides |", "|:------|:-----|:------|"] + for _, number, title, filename in entries: + table.append(f"| {number} | [{title}]({filename}) | [Download slides]({Path(filename).stem}-slides.html) |") + + return '\n'.join(table) + +def main(): + directory = "./../" # current directory, or change to any other path + output_file = directory + "README.md" + table_md = generate_markdown_table(directory) + + with open(output_file, 'a', encoding='utf-8') as f: + f.write("# Contents\n\n") + f.write(table_md) + f.write("\n") + + print(f"Index written to {output_file}") + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/.scripts/removeHtmls.bat b/.scripts/removeHtmls.bat new file mode 100644 index 0000000..63d5351 --- /dev/null +++ b/.scripts/removeHtmls.bat @@ -0,0 +1,5 @@ +for /D %%i in (.\*) do ( + for %%j in (%%i\*.md) do ( + del %%~pj%%~nj.html + ) +) diff --git a/.scripts/removeLinebreaks.sh b/.scripts/removeLinebreaks.sh new file mode 100644 index 0000000..4cbe3a3 --- /dev/null +++ b/.scripts/removeLinebreaks.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +for file in *.md; do + perl -0777 -i -pe ' + s/\r\n/\n/g; # Normalize Windows line endings to Unix + s/(?:[ \t]*\n){2,}/\n\n/g; # Collapse multiple blank lines (even with whitespace) + ' "$file" +done + +echo "Collapsed extra blank lines." \ No newline at end of file diff --git a/.scripts/renamePptx.sh b/.scripts/renamePptx.sh new file mode 100644 index 0000000..3c1f736 --- /dev/null +++ b/.scripts/renamePptx.sh @@ -0,0 +1,11 @@ +for f in *.pptx; do + name="${f%.*}" # strip extension + ext="${f##*.}" # get extension + newname=$(echo "$name" \ + | tr '[:upper:]' '[:lower:]' \ + | tr ' ' '-' \ + | sed 's/&/and/g' \ + | tr -d '.,()' # remove dots, commas, and parentheses + ) + mv -- "$f" "$newname.$ext" +done \ No newline at end of file diff --git a/.scripts/replace.sh b/.scripts/replace.sh new file mode 100644 index 0000000..2d8538f --- /dev/null +++ b/.scripts/replace.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +SEARCH="$1" +REPLACE="$2" + +for file in *.md; do + SEARCH="$SEARCH" REPLACE="$REPLACE" perl -i -pe ' + BEGIN { + $search = quotemeta($ENV{"SEARCH"}); + $replace = $ENV{"REPLACE"}; + $replace =~ s/\\/\\\\/g; # escape backslashes in replacement + $replace =~ s/\$/\\\$/g; # escape $ in replacement + } + s/$search/$replace/g; + ' "$file" +done + +echo "Literal replacement complete." \ No newline at end of file diff --git a/.themes/buutti.css b/.themes/buutti.css new file mode 100644 index 0000000..b4e1310 --- /dev/null +++ b/.themes/buutti.css @@ -0,0 +1,63 @@ +/* buutti.css */ +/* @theme buutti */ + +@import "default"; + +.columns { + display: grid; + grid-template-columns: repeat(2, minmax(0, 1fr)); + gap: 1rem; +} +.columns12 { + display: grid; + grid-template-columns: 1fr 2fr; + gap: 1rem; +} +.columns21 { + display: grid; + grid-template-columns: 2fr 1fr; + gap: 1rem; +} +.columns32 { + display: grid; + grid-template-columns: 3fr 2fr; + gap: 1rem; +} +.columns23 { + display: grid; + grid-template-columns: 2fr 3fr; + gap: 1rem; +} +.columns111 { + display: grid; + grid-template-columns: 1fr 1fr 1fr; + gap: 1rem; +} +.centered { + display: flex; + flex-direction: column; + justify-content: center; + text-align: center; +} +.tableborderless td, th { + border: none!important; + border-collapse: collapse; +} + +section.extra { + background-color: #5d275d; + background-image: linear-gradient(to bottom, #401a40, #1d0c1d); + color: white; +} +section.extra a { + color: rgb(145, 255, 209); +} + +section.exercise { + background-color: #29366f; + background-image: linear-gradient(to bottom, #20636a, #173742); + color: white; +} +section.exercise a { + color: rgb(211, 173, 255); +} diff --git a/.vscode/markdown.code-snippets b/.vscode/markdown.code-snippets new file mode 100644 index 0000000..ea039a6 --- /dev/null +++ b/.vscode/markdown.code-snippets @@ -0,0 +1,157 @@ +{ + "python code block" : { + "scope": "markdown", + "prefix": "py", + "body": [ + "```python", + "$0", + "```" + ], + "description": "Python code block" + }, + "cpp code block" : { + "scope": "markdown", + "prefix": "cpp", + "body": [ + "```cpp", + "$0", + "```" + ], + "description": "C++ code block" + }, + "csharp code block" : { + "scope": "markdown", + "prefix": "cs", + "body": [ + "```csharp", + "$0", + "```" + ], + "description": "C# code block" + }, + "js code block" : { + "scope": "markdown", + "prefix": "js", + "body": [ + "```js", + "$0", + "```" + ], + "description": "JavaScript code block" + }, + "ts code block" : { + "scope": "markdown", + "prefix": "ts", + "body": [ + "```ts", + "$0", + "```" + ], + "description": "TypeScript code block" + }, + "inline code" : { + "scope": "markdown", + "prefix": "c", + "body": [ + "`$0`", + ], + "description": "Inline code block" + }, + "extra slide" : { + "scope": "markdown", + "prefix": "extra", + "body": [ + "## Extra: $0", + "", + ], + "description": "Extra slide colors" + }, + "exercise slide" : { + "scope": "markdown", + "prefix": "exercise", + "body": [ + "## Exercise $0.", + "", + ], + "description": "Exercise slide colors" + }, + "marp front matter" : { + "scope": "markdown", + "prefix": "marp", + "body" : [ + "---", + "marp: true", + "paginate: true", + "math: mathjax", + "theme: buutti", + "title: N. $0", + "---", + "", + "# $0", + "", + "", + "" + ] + }, + "marp columns" : { + "scope": "markdown", + "prefix": "column", + "body" : [ + "
class
name to change proportionsbuutti.css
notMatch
if a HTML on save is not needed