parent
96611d1ba9
commit
441a7424cc
@ -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()
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,18 +1,23 @@
|
||||
# Contents
|
||||
|
||||
Material completion denoted with 🌑🌘🌗🌖🌕 .
|
||||
<!-- <a href="/education/csharp-basics/raw/branch/main/5-arrays-and-lists-slides.html" download >Download</a>
|
||||
[Download3b](5-arrays-and-lists-slides.html "juuh")## Contents -->
|
||||
|
||||
| # | Lecture | Materials | Exercises |
|
||||
|---:|------------------------------------------------------------------------|----------:|----------:|
|
||||
| 8 | [Inheritance and Abstract Classes](8-inheritance-and-abstract-classes.md) | 🌕 | 🌕 |
|
||||
| 9 | [Interfaces](9-interfaces.md) | 🌕 | 🌕 |
|
||||
| 10 | [Static Members, Methods, and Classes](10-static-members-methods-and-classes.md) | 🌕 | 🌕 |
|
||||
| 11 | [Delegates and Events](11-delegates-and-events.md) | 🌕 | 🌗 |
|
||||
| 12 | [Files and Streams](12-files-and-streams.md) | 🌕 | 🌕 |
|
||||
| 13 | [Generics, IEnumberable and LINQ](13-generics-ienumerable-and-linq.md) | 🌕 | 🌕 |
|
||||
| 14 | [Exceptions, Threads and Tasks](14-exceptions-threads-and-tasks.md) | 🌕 | 🌕 |
|
||||
| 15 | [Design Patterns in C#](15-design-patterns-in-csharp.md) | 🌗 | 🌑 |
|
||||
# Contents
|
||||
|
||||
<a href="/education/csharp-basics/raw/branch/main/5-arrays-and-lists-slides.html" download >Download</a>
|
||||
[Download2b](/raw/branch/main/5-arrays-and-lists-slides.html "juuh")
|
||||
[Download3b](5-arrays-and-lists-slides.html "juuh")
|
||||
| # | Lecture | Slides |
|
||||
|:---|:--------------------------------------------------------------------------------|:---------------------------------------------------------------------|
|
||||
| 0 | [Introduction to C# and .NET](0-introduction-to-csharp-and-dotnet.md) | [Download slides](0-introduction-to-csharp-and-dotnet-slides.html) |
|
||||
| 1 | [Introduction to Visual Studio](1-introduction-to-visual-studio.md) | [Download slides](1-introduction-to-visual-studio-slides.html) |
|
||||
| 2 | [Variables and Types](2-variables-and-types.md) | [Download slides](2-variables-and-types-slides.html) |
|
||||
| 3 | [Conditionals](3-conditionals.md) | [Download slides](3-conditionals-slides.html) |
|
||||
| 4 | [Loops](4-loops.md) | [Download slides](4-loops-slides.html) |
|
||||
| 5 | [Arrays and Lists](5-arrays-and-lists.md) | [Download slides](5-arrays-and-lists-slides.html) |
|
||||
| 6 | [Methods](6-methods.md) | [Download slides](6-methods-slides.html) |
|
||||
| 7 | [Classes And Objects](7-classes-and-objects.md) | [Download slides](7-classes-and-objects-slides.html) |
|
||||
| 8 | [Inheritance & Abstract Classes](8-inheritance-and-abstract-classes.md) | [Download slides](8-inheritance-and-abstract-classes-slides.html) |
|
||||
| 9 | [Interfaces](9-interfaces.md) | [Download slides](9-interfaces-slides.html) |
|
||||
| 10 | [Static Members, Methods and Classes](10-static-members-methods-and-classes.md) | [Download slides](10-static-members-methods-and-classes-slides.html) |
|
||||
| 11 | [Delegates and events](11-delegates-and-events.md) | [Download slides](11-delegates-and-events-slides.html) |
|
||||
| 12 | [Files and Streams](12-files-and-streams.md) | [Download slides](12-files-and-streams-slides.html) |
|
||||
| 13 | [Generics, IEnumerable and LINQ](13-generics-ienumerable-and-linq.md) | [Download slides](13-generics-ienumerable-and-linq-slides.html) |
|
||||
| 14 | [Exceptions, Threads and Tasks](14-exceptions-threads-and-tasks.md) | [Download slides](14-exceptions-threads-and-tasks-slides.html) |
|
||||
| 15 | [Design Patterns in C#](15-design-patterns-in-csharp.md) | [Download slides](15-design-patterns-in-csharp-slides.html) |
|
||||
|
Loading…
Reference in New Issue