adds an automated TOC script
This commit is contained in:
parent
e3b2a98376
commit
b6ce0eaf47
|
@ -0,0 +1,34 @@
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
|
||||||
|
LINK = "https://github.com/ekalinin/github-markdown-toc"
|
||||||
|
OUTPUT = "readme.md"
|
||||||
|
INPUT = [
|
||||||
|
"learning_python3.md",
|
||||||
|
"learning_python3_gui.md",
|
||||||
|
"learning_git.md",
|
||||||
|
]
|
||||||
|
CMD = "gh-md-toc"
|
||||||
|
FILTER = "(#"
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
try:
|
||||||
|
p = subprocess.Popen([CMD], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
|
output, err = p.communicate()
|
||||||
|
except Exception as e:
|
||||||
|
print("please install {}".format(LINK))
|
||||||
|
exit()
|
||||||
|
CONTENT = []
|
||||||
|
for f in INPUT:
|
||||||
|
p = subprocess.Popen([CMD, f], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
|
output, err = p.communicate()
|
||||||
|
output = output.decode().split("\n")
|
||||||
|
for line in output:
|
||||||
|
if FILTER in line:
|
||||||
|
line = line.replace(FILTER, "(./{}#".format(f))
|
||||||
|
CONTENT.append(line)
|
||||||
|
with open(OUTPUT, "w") as fp:
|
||||||
|
for line in CONTENT:
|
||||||
|
fp.write("{}\n".format(line))
|
||||||
|
print("done...")
|
18
readme.md
18
readme.md
|
@ -103,6 +103,8 @@ Table of Contents
|
||||||
* [Introduction to the requests library](./learning_python3.md#introduction-to-the-requests-library)
|
* [Introduction to the requests library](./learning_python3.md#introduction-to-the-requests-library)
|
||||||
* [Threading](./learning_python3.md#threading)
|
* [Threading](./learning_python3.md#threading)
|
||||||
|
|
||||||
|
Created by [gh-md-toc](https://github.com/ekalinin/github-markdown-toc)
|
||||||
|
|
||||||
|
|
||||||
Table of Contents
|
Table of Contents
|
||||||
=================
|
=================
|
||||||
|
@ -121,13 +123,25 @@ Table of Contents
|
||||||
* [Coding challenge - Login generator with GUI](./learning_python3_gui.md#coding-challenge---login-generator-with-gui-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)
|
* [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
|
Table of Contents
|
||||||
=================
|
=================
|
||||||
|
|
||||||
* [Git](./learning_git.md#git)
|
* [About](./learning_git.md#about)
|
||||||
* [Git in Pycharm](./learning_git.md#git-in-pycharm)
|
* [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)
|
* [Starting a version controlled project](./learning_git.md#starting-a-version-controlled-project)
|
||||||
* [Creating an online repository](./learning_git.md#creating-an-online-repository)
|
* [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)
|
* [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)
|
* [Updating the original project](./learning_git.md#updating-the-original-project)
|
||||||
|
|
||||||
|
Created by [gh-md-toc](https://github.com/ekalinin/github-markdown-toc)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue