From 417f3a909b5bfc8cb0a63bdc7613daf5fdf517e9 Mon Sep 17 00:00:00 2001 From: waldek Date: Tue, 3 May 2022 11:45:42 +0200 Subject: [PATCH] betters titles in readme and toc generator --- generate_toc.py | 4 ++ readme.md | 150 +----------------------------------------------- 2 files changed, 7 insertions(+), 147 deletions(-) diff --git a/generate_toc.py b/generate_toc.py index 5507ef5..21937ea 100644 --- a/generate_toc.py +++ b/generate_toc.py @@ -11,6 +11,7 @@ INPUT = [ ] CMD = "gh-md-toc" FILTER = "(#" +TITLE = "Table of Contents" if __name__ == "__main__": @@ -28,6 +29,9 @@ if __name__ == "__main__": for line in output: if FILTER in line: line = line.replace(FILTER, "(./{}#".format(f)) + if TITLE in line: + title = " ".join(f.replace(".md", "").split("_")).capitalize() + line = title CONTENT.append(line) p = subprocess.Popen(["cp", OUTLINE, OUTPUT], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) p.wait() diff --git a/readme.md b/readme.md index a3fd179..cf78c2a 100644 --- a/readme.md +++ b/readme.md @@ -19,7 +19,7 @@ | 15 | | -Table of Contents +Learning python3 ================= * [What we'll learn](./learning_python3.md#what-well-learn) @@ -122,7 +122,7 @@ Table of Contents Created by [gh-md-toc](https://github.com/ekalinin/github-markdown-toc) -Table of Contents +Learning python3 gui ================= * [tkinter](./learning_python3_gui.md#tkinter) @@ -143,151 +143,7 @@ Table of Contents Created by [gh-md-toc](https://github.com/ekalinin/github-markdown-toc) -Table of Contents -================= - -* [About](./learning_git.md#about) -* [Git via bash](./learning_git.md#git-via-bash) - * [Initialing a git repo](./learning_git.md#initialing-a-git-repo) - * [What's in this repo](./learning_git.md#whats-in-this-repo) - * [Adding and tracking content](./learning_git.md#adding-and-tracking-content) - * [The main workflow](./learning_git.md#the-main-workflow) -* [Git via Atom](./learning_git.md#git-via-atom) -* [Git via Pycharm](./learning_git.md#git-via-pycharm) - * [Starting a version controlled project](./learning_git.md#starting-a-version-controlled-project) - * [Creating an online repository](./learning_git.md#creating-an-online-repository) - * [Adding some changes to our local code](./learning_git.md#adding-some-changes-to-our-local-code) - * [Cloning the remote project into a new project](./learning_git.md#cloning-the-remote-project-into-a-new-project) - * [Updating the original project](./learning_git.md#updating-the-original-project) - -Created by [gh-md-toc](https://github.com/ekalinin/github-markdown-toc) - - -Table of Contents -================= - -* [What we'll learn](./learning_python3.md#what-well-learn) - * [Concepts](./learning_python3.md#concepts) - * [Syntax](./learning_python3.md#syntax) - * [Tools](./learning_python3.md#tools) - * [Writing code](./learning_python3.md#writing-code) - * [Running code](./learning_python3.md#running-code) -* [The python3 shell](./learning_python3.md#the-python3-shell) -* [Installing pycharm](./learning_python3.md#installing-pycharm) - * [Virtual environments](./learning_python3.md#virtual-environments) -* [Your first project](./learning_python3.md#your-first-project) - * [How to execute](./learning_python3.md#how-to-execute) - * [Simple printing](./learning_python3.md#simple-printing) - * [Try it](./learning_python3.md#-try-it) - * [Try it](./learning_python3.md#-try-it-1) - * [String replacement](./learning_python3.md#string-replacement) - * [String formatting](./learning_python3.md#string-formatting) - * [Some links to read up](./learning_python3.md#some-links-to-read-up) -* [Taking input](./learning_python3.md#taking-input) - * [Some functions are blocking](./learning_python3.md#some-functions-are-blocking) - * [Functions can return something](./learning_python3.md#functions-can-return-something) - * [Try it](./learning_python3.md#-try-it-2) - * [Functions can take arguments](./learning_python3.md#functions-can-take-arguments) - * [Try it](./learning_python3.md#-try-it-3) -* [Taking input and evaluation](./learning_python3.md#taking-input-and-evaluation) - * [Conditional logic](./learning_python3.md#conditional-logic) - * [Class string methods](./learning_python3.md#class-string-methods) - * [Try it](./learning_python3.md#-try-it-4) - * [Some links to read up on](./learning_python3.md#some-links-to-read-up-on) -* [Coding challenge - Currency converter](./learning_python3.md#coding-challenge---currency-converter) -* [Coding challenge - Celsius to Fahrenheit converter](./learning_python3.md#coding-challenge---celsius-to-fahrenheit-converter) - * [Some links to read up on](./learning_python3.md#some-links-to-read-up-on-1) -* [A text based adventure game](./learning_python3.md#a-text-based-adventure-game) -* [Creating your own functions](./learning_python3.md#creating-your-own-functions) - * [Functions that do something](./learning_python3.md#functions-that-do-something) - * [Variable scope](./learning_python3.md#variable-scope) - * [Functions that return something](./learning_python3.md#functions-that-return-something) - * [Try it](./learning_python3.md#-try-it-5) - * [Some links to read up on](./learning_python3.md#some-links-to-read-up-on-2) -* [Coding challenge - Pretty Print](./learning_python3.md#coding-challenge---pretty-print) -* [Using the standard library](./learning_python3.md#using-the-standard-library) -* [Coding challenge - Memento Mori calculator](./learning_python3.md#coding-challenge---memento-mori-calculator) -* [Writing your first library](./learning_python3.md#writing-your-first-library) - * [Try it](./learning_python3.md#-try-it-6) - * [How do we write libraries?](./learning_python3.md#how-do-we-write-libraries) - * [What is __name__ == "__main__"?](./learning_python3.md#what-is-__name__--__main__) - * [Anatomy of a program](./learning_python3.md#anatomy-of-a-program) - * [Try it](./learning_python3.md#-try-it-7) -* [While loop](./learning_python3.md#while-loop) - * [Try it](./learning_python3.md#-try-it-8) -* [Coding challenge - Guess the number](./learning_python3.md#coding-challenge---guess-the-number) - * [Try it](./learning_python3.md#-try-it-9) -* [Logical Operators](./learning_python3.md#logical-operators) -* [Lists](./learning_python3.md#lists) - * [Creating lists](./learning_python3.md#creating-lists) - * [List methods](./learning_python3.md#list-methods) - * [Try it](./learning_python3.md#-try-it-10) - * [Picking elements and slicing lists](./learning_python3.md#picking-elements-and-slicing-lists) - * [Try it](./learning_python3.md#-try-it-11) -* [For loop](./learning_python3.md#for-loop) -* [Coding challenge - Cheerleader chant](./learning_python3.md#coding-challenge---cheerleader-chant) -* [Coding challenge - ROT13](./learning_python3.md#coding-challenge---rot13) - * [Try it](./learning_python3.md#-try-it-12) -* [Coding challenge - Christmas Tree](./learning_python3.md#coding-challenge---christmas-tree) -* [List comprehension](./learning_python3.md#list-comprehension) -* [Handling files](./learning_python3.md#handling-files) - * [Reading from a file](./learning_python3.md#reading-from-a-file) - * [In-line way](./learning_python3.md#in-line-way) - * [Pythonic way](./learning_python3.md#pythonic-way) - * [Writing to a file](./learning_python3.md#writing-to-a-file) -* [Coding challenge - Login generator](./learning_python3.md#coding-challenge---login-generator) -* [Dictionaries as data containers](./learning_python3.md#dictionaries-as-data-containers) - * [Two dimensional lists](./learning_python3.md#two-dimensional-lists) - * [Dictionaries](./learning_python3.md#dictionaries) - * [Try it](./learning_python3.md#-try-it-13) -* [Coding challenge - Task manager](./learning_python3.md#coding-challenge---task-manager) - * [CSV based task manager](./learning_python3.md#csv-based-task-manager) -* [Text based databases](./learning_python3.md#text-based-databases) - * [Try it](./learning_python3.md#-try-it-14) -* [Now for some useful scripting](./learning_python3.md#now-for-some-useful-scripting) -* [Creating our own objects](./learning_python3.md#creating-our-own-objects) - * [First some abstract examples](./learning_python3.md#first-some-abstract-examples) - * [Try it](./learning_python3.md#-try-it-15) - * [Magic methods](./learning_python3.md#magic-methods) - * [Class inheritance](./learning_python3.md#class-inheritance) - * [Try it](./learning_python3.md#-try-it-16) -* [Coding challenge - Chalet floor](./learning_python3.md#coding-challenge---chalet-floor) - * [Now some practical improvements](./learning_python3.md#now-some-practical-improvements) - * [Improve the login generator](./learning_python3.md#improve-the-login-generator) - * [Improve the task manager](./learning_python3.md#improve-the-task-manager) -* [Infinite programs](./learning_python3.md#infinite-programs) - * [Logic breakdown of a simple game](./learning_python3.md#logic-breakdown-of-a-simple-game) - * [A non object orientated solution](./learning_python3.md#a-non-object-orientated-solution) - * [An object orientated solution](./learning_python3.md#an-object-orientated-solution) - * [Trivial pursuit multiple choice game](./learning_python3.md#trivial-pursuit-multiple-choice-game) - * [Introduction to the requests library](./learning_python3.md#introduction-to-the-requests-library) - * [Threading](./learning_python3.md#threading) - -Created by [gh-md-toc](https://github.com/ekalinin/github-markdown-toc) - - -Table of Contents -================= - -* [tkinter](./learning_python3_gui.md#tkinter) - * [Tkinter helloworld](./learning_python3_gui.md#tkinter-helloworld) - * [Adding widgets](./learning_python3_gui.md#adding-widgets) - * [Try it](./learning_python3_gui.md#-try-it) -* [Coding challenge - Guess the number](./learning_python3_gui.md#coding-challenge---guess-the-number) - * [MVC design pattern](./learning_python3_gui.md#mvc-design-pattern) - * [Coding challenge - Login generator with GUI](./learning_python3_gui.md#coding-challenge---login-generator-with-gui) - * [Coding challenge - Trivial pursuit with GUI](./learning_python3_gui.md#coding-challenge---trivial-pursuit-with-gui) -* [WXpython](./learning_python3_gui.md#wxpython) - * [wxpython helloworld](./learning_python3_gui.md#wxpython-helloworld) - * [wxpython guess the number](./learning_python3_gui.md#wxpython-guess-the-number) - * [MVC design pattern](./learning_python3_gui.md#mvc-design-pattern-1) - * [Coding challenge - Login generator with GUI](./learning_python3_gui.md#coding-challenge---login-generator-with-gui-1) - * [Coding challenge - Trivial pursuit with GUI](./learning_python3_gui.md#coding-challenge---trivial-pursuit-with-gui-1) - -Created by [gh-md-toc](https://github.com/ekalinin/github-markdown-toc) - - -Table of Contents +Learning git ================= * [About](./learning_git.md#about)