Initial commit
commit
73e3532c35
@ -0,0 +1 @@
|
|||||||
|
*.sh eol=lf
|
@ -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
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
@ -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
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
@ -0,0 +1,3 @@
|
|||||||
|
for %%j in (.\*.pptx) do (
|
||||||
|
pptx2md --disable-color "%%j" -o "%%~pj%%~nj.md"
|
||||||
|
)
|
@ -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()
|
@ -0,0 +1,5 @@
|
|||||||
|
for /D %%i in (.\*) do (
|
||||||
|
for %%j in (%%i\*.md) do (
|
||||||
|
del %%~pj%%~nj.html
|
||||||
|
)
|
||||||
|
)
|
@ -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."
|
@ -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
|
@ -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."
|
@ -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);
|
||||||
|
}
|
@ -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",
|
||||||
|
"<!-- _class: \"extra invert\" -->",
|
||||||
|
],
|
||||||
|
"description": "Extra slide colors"
|
||||||
|
},
|
||||||
|
"exercise slide" : {
|
||||||
|
"scope": "markdown",
|
||||||
|
"prefix": "exercise",
|
||||||
|
"body": [
|
||||||
|
"## Exercise $0.",
|
||||||
|
"<!--_class: \"exercise invert\" -->",
|
||||||
|
],
|
||||||
|
"description": "Exercise slide colors"
|
||||||
|
},
|
||||||
|
"marp front matter" : {
|
||||||
|
"scope": "markdown",
|
||||||
|
"prefix": "marp",
|
||||||
|
"body" : [
|
||||||
|
"---",
|
||||||
|
"marp: true",
|
||||||
|
"paginate: true",
|
||||||
|
"math: mathjax",
|
||||||
|
"theme: buutti",
|
||||||
|
"title: N. $0",
|
||||||
|
"---",
|
||||||
|
"",
|
||||||
|
"# $0",
|
||||||
|
"",
|
||||||
|
"<!-- headingDivider: 5 -->",
|
||||||
|
"<!-- class: invert -->"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"marp columns" : {
|
||||||
|
"scope": "markdown",
|
||||||
|
"prefix": "column",
|
||||||
|
"body" : [
|
||||||
|
"<div class='columns' markdown='1'>",
|
||||||
|
"<div markdown='1'>",
|
||||||
|
"$0",
|
||||||
|
"</div>",
|
||||||
|
"<div markdown='1'>",
|
||||||
|
"",
|
||||||
|
"</div>",
|
||||||
|
"</div>",
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"marp columns start" : {
|
||||||
|
"scope": "markdown",
|
||||||
|
"prefix": "startcol",
|
||||||
|
"body" : [
|
||||||
|
"<div class='columns' markdown='1'>",
|
||||||
|
"<div markdown='1'>",
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"marp columns middle" : {
|
||||||
|
"scope": "markdown",
|
||||||
|
"prefix": "midcol",
|
||||||
|
"body" : [
|
||||||
|
"</div>",
|
||||||
|
"<div markdown='1'>",
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"marp columns end" : {
|
||||||
|
"scope": "markdown",
|
||||||
|
"prefix": "endcol",
|
||||||
|
"body" : [
|
||||||
|
"</div>",
|
||||||
|
"</div>",
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"marp centered" : {
|
||||||
|
"scope": "markdown",
|
||||||
|
"prefix": "centered",
|
||||||
|
"body" : [
|
||||||
|
"<div class='centered'>",
|
||||||
|
"$0",
|
||||||
|
"</div>",
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"em dash" : {
|
||||||
|
"scope": "markdown",
|
||||||
|
"prefix": "em",
|
||||||
|
"body" : [
|
||||||
|
"—",
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"marp footer" : {
|
||||||
|
"scope": "markdown",
|
||||||
|
"prefix": "footer",
|
||||||
|
"body" : [
|
||||||
|
"<!-- _footer: $0 -->"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"markdown.marp.themes": ["./.themes/buutti.css"],
|
||||||
|
"saveAndRun": {
|
||||||
|
"commands": [
|
||||||
|
{
|
||||||
|
"match": "\\.md$",
|
||||||
|
"notMatch": "README\\.md$",
|
||||||
|
"cmd": "marp \"${fileDirname}\\${fileBasename}\" -o \"${fileDirname}\\${fileBasenameNoExt}-slides.html\" --html true --theme \"${fileDirname}\\.themes\\buutti.css\"",
|
||||||
|
"useShortcut": false,
|
||||||
|
"silent": false
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,26 @@
|
|||||||
|
# Contents
|
||||||
|
|
||||||
|
Material completion denoted with 🌑🌘🌗🌖🌕 .
|
||||||
|
|
||||||
|
| # | Lecture | Materials | Exercises |
|
||||||
|
| ---: | ------------------------------------- | --------: | --------: |
|
||||||
|
| 1 | [Example Lecture](example-lecture.md) | 🌕 | 🌕 |
|
||||||
|
|
||||||
|
|
||||||
|
## Repository notes (remove before publishing)
|
||||||
|
|
||||||
|
- After reading, remove [example-lecture.md](./example-lecture.md), [example-lecture-slides.html](./example-lecture-slides.html) and [buuttilogo.png](./imgs/buuttilogo.png)
|
||||||
|
- See [Markdown code snippets](.vscode/markdown.code-snippets) for autocomplete stuff.
|
||||||
|
- Remove the .gitkeep files from imgs and solutions folders after adding new files to those folders.
|
||||||
|
|
||||||
|
## Running scripts to convert lectures to MD
|
||||||
|
|
||||||
|
Note: These instructions are for a Windows PC with WSL installed
|
||||||
|
|
||||||
|
1) Install `pptx2md`: in an admin powershell, run `pip install pptx2md`
|
||||||
|
2) copy `.pptx` lecture slides to `.scripts` folder
|
||||||
|
3) In the `.scripts` folder, run `.\convertAndReplaceAll.bat`
|
||||||
|
4) If everything went ok, move the generated `.md` files and the `imgs` folder to the root folder
|
||||||
|
5) Remove .pptx files and the example lecture and its slides html
|
||||||
|
7) In the `.scripts` folder, run `python generateREADME.py`
|
||||||
|
8) Remove everything else from README than the generated table
|
File diff suppressed because one or more lines are too long
@ -0,0 +1,85 @@
|
|||||||
|
---
|
||||||
|
marp: true
|
||||||
|
paginate: true
|
||||||
|
math: mathjax
|
||||||
|
theme: buutti
|
||||||
|
title: N. Example Lecture
|
||||||
|
---
|
||||||
|
|
||||||
|
# Example Lecture
|
||||||
|
|
||||||
|
<!-- headingDivider: 5 -->
|
||||||
|
<!-- class: invert -->
|
||||||
|
|
||||||
|
## Section
|
||||||
|
|
||||||
|
- This line appears instantly
|
||||||
|
* This line appears by pressing spacebar (preferred)
|
||||||
|
* This line has an inline code `variable`
|
||||||
|
1. This line appears instantly
|
||||||
|
2) This line appears by pressing spacebar
|
||||||
|
|
||||||
|
## Code and maths
|
||||||
|
|
||||||
|
* code code code:
|
||||||
|
```js
|
||||||
|
console.log("Here's a syntax-highlighted JavaScript code block");
|
||||||
|
console.log("Remember indentation so it's revealed after the bullet point.");
|
||||||
|
```
|
||||||
|
* This line has an inline LaTeX maths equation $c = \frac{a^2}{\sqrt{b}}$
|
||||||
|
* Here's a maths block:
|
||||||
|
|
||||||
|
$$
|
||||||
|
F(x) = \int_a^b f(x) dx
|
||||||
|
$$
|
||||||
|
|
||||||
|
<!-- _footer: Footers are exclusive to presentation; they are not shown in the webpage markdown document -->
|
||||||
|
|
||||||
|
## Columns
|
||||||
|
|
||||||
|
<div class='columns' markdown='1'>
|
||||||
|
<div markdown='1'>
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
* Basic image example
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div markdown='1'>
|
||||||
|
|
||||||
|

|
||||||
|
* Wider image
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
* This line is outside the columns and goes from left all the way to the right
|
||||||
|
|
||||||
|
## Columns 2
|
||||||
|
|
||||||
|
<div class='columns21' markdown='1'>
|
||||||
|
<div markdown='1'>
|
||||||
|
|
||||||
|
* Another column example with a wider left panel
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div markdown='1'>
|
||||||
|
|
||||||
|
* Change `class` name to change proportions
|
||||||
|
* If suitable proportions not available, add to `buutti.css`
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
## Setup
|
||||||
|
|
||||||
|
* In VS Code, install the extensions
|
||||||
|
* [Marp for VS code](https://marketplace.visualstudio.com/items?itemName=marp-team.marp-vscode)
|
||||||
|
* So you can see the slideshow preview when editing.
|
||||||
|
* [Markdown all in one](https://marketplace.visualstudio.com/items?itemName=yzhang.markdown-all-in-one)
|
||||||
|
* [Markdown table formatter](https://marketplace.visualstudio.com/items?itemName=fcrespo82.markdown-table-formatter)
|
||||||
|
* *Right click > Format document* makes tables pretty
|
||||||
|
* [Save and run](https://marketplace.visualstudio.com/items?itemName=wk-j.save-and-run)
|
||||||
|
* An HTML version of the lecture is created on save
|
||||||
|
* See [settings.json](./.vscode/settings.json)
|
||||||
|
* Add filenames to `notMatch` if a HTML on save is not needed
|
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
Loading…
Reference in New Issue