reorganization
This commit is contained in:
parent
329f08cb4a
commit
041f951803
20
README.md
20
README.md
@ -1,5 +1,14 @@
|
|||||||
# Open Source Games
|
# Open Source Games
|
||||||
|
|
||||||
|
[comment]: # (start of autogenerated content, do not edit)
|
||||||
|
- **[Adventure games & Visual novels](games/adventure/_toc.md)** (14)
|
||||||
|
- **[Game frameworks](games/framework/_toc.md)** (46)
|
||||||
|
- **[Popular required libraries](games/library/_toc.md)** (23)
|
||||||
|
- **[Role Playing Games](games/rpg/_toc.md)** (44)
|
||||||
|
- **[Simulation games](games/simulation/_toc.md)** (10)
|
||||||
|
- **[Strategy games](games/strategy/_toc.md)** (37)
|
||||||
|
|
||||||
|
[comment]: # (end of autogenerated content)
|
||||||
A collection of open source games sorted by genre. The projects are at least in beta stage with a code basis that builds
|
A collection of open source games sorted by genre. The projects are at least in beta stage with a code basis that builds
|
||||||
into an executable demo. Related infos and tips geared toward building the games are collected here. Emphasis is on
|
into an executable demo. Related infos and tips geared toward building the games are collected here. Emphasis is on
|
||||||
support for Windows, Linux and Android.
|
support for Windows, Linux and Android.
|
||||||
@ -9,17 +18,6 @@ I concentrate on the hardware/software platforms that I have access to.
|
|||||||
|
|
||||||
See also the list of [popular games on Github](https://github.com/leereilly/games) by Lee Reilly.
|
See also the list of [popular games on Github](https://github.com/leereilly/games) by Lee Reilly.
|
||||||
|
|
||||||
## Contents
|
|
||||||
|
|
||||||
[comment]: # (start of autogenerated content, do not edit)
|
|
||||||
- **[Adventure games & Visual novels](adventure/_toc.md)** (14)
|
|
||||||
- **[Game frameworks](framework/_toc.md)** (46)
|
|
||||||
- **[Popular required libraries](library/_toc.md)** (23)
|
|
||||||
- **[Role Playing Games](rpg/_toc.md)** (44)
|
|
||||||
- **[Simulation games](simulation/_toc.md)** (10)
|
|
||||||
- **[Strategy games](strategy/_toc.md)** (37)
|
|
||||||
|
|
||||||
[comment]: # (end of autogenerated content)
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
If you'd like to add something, please [create an Issue](https://github.com/Trilarion/opensourcegames/issues),
|
If you'd like to add something, please [create an Issue](https://github.com/Trilarion/opensourcegames/issues),
|
||||||
|
@ -64,31 +64,27 @@ def update_readme():
|
|||||||
"""
|
"""
|
||||||
print('update readme file')
|
print('update readme file')
|
||||||
|
|
||||||
# load readme
|
|
||||||
readme_path = os.path.join(base_path, 'README.md')
|
|
||||||
|
|
||||||
# read readme
|
# read readme
|
||||||
with open(readme_path) as f:
|
with open(readme_path) as f:
|
||||||
readme_text = f.read()
|
readme_text = f.read()
|
||||||
|
|
||||||
# compile regex for identifying the building blocks
|
# compile regex for identifying the building blocks
|
||||||
regex = re.compile(r"(.*## Contents\n\n)(.*)(\n## Contributing.*)", re.DOTALL)
|
regex = re.compile(r"(# Open Source Games\n\n)(.*)(\nA collection.*)", re.DOTALL)
|
||||||
|
|
||||||
# apply regex
|
# apply regex
|
||||||
matches = regex.findall(readme_text)
|
matches = regex.findall(readme_text)
|
||||||
matches = matches[0]
|
matches = matches[0]
|
||||||
start = matches[0]
|
start = matches[0]
|
||||||
middle = matches[1]
|
|
||||||
end = matches[2]
|
end = matches[2]
|
||||||
|
|
||||||
# get sub folders
|
# get sub folders
|
||||||
subfolders = [x for x in os.listdir(base_path) if x != '.git' and os.path.isdir(os.path.join(base_path, x))]
|
subfolders = [x for x in os.listdir(games_path) if x != '.git' and os.path.isdir(os.path.join(games_path, x))]
|
||||||
|
|
||||||
# get number of files (minus 1) in each sub folder
|
# get number of files (minus 1) in each sub folder
|
||||||
n = [len(os.listdir(os.path.join(base_path, folder))) - 1 for folder in subfolders]
|
n = [len(os.listdir(os.path.join(games_path, folder))) - 1 for folder in subfolders]
|
||||||
|
|
||||||
# assemble paths
|
# assemble paths
|
||||||
paths = [os.path.join(base_path, folder, '_toc.md') for folder in subfolders]
|
paths = [os.path.join(games_path, folder, '_toc.md') for folder in subfolders]
|
||||||
|
|
||||||
# get titles (discarding first two ("# ") and last ("\n") characters)
|
# get titles (discarding first two ("# ") and last ("\n") characters)
|
||||||
titles = [read_first_line_from_file(path)[2:-1] for path in paths]
|
titles = [read_first_line_from_file(path)[2:-1] for path in paths]
|
||||||
@ -100,7 +96,7 @@ def update_readme():
|
|||||||
info = sorted(info, key=lambda x:x[0])
|
info = sorted(info, key=lambda x:x[0])
|
||||||
|
|
||||||
# assemble output
|
# assemble output
|
||||||
update = ['- **[{}]({}/_toc.md)** ({})\n'.format(*entry) for entry in info]
|
update = ['- **[{}](games/{}/_toc.md)** ({})\n'.format(*entry) for entry in info]
|
||||||
update = "".join(update)
|
update = "".join(update)
|
||||||
|
|
||||||
# insert new text in the middle
|
# insert new text in the middle
|
||||||
@ -115,14 +111,14 @@ def update_category_tocs():
|
|||||||
Lists all entries in all sub folders and generates the list in the toc file
|
Lists all entries in all sub folders and generates the list in the toc file
|
||||||
"""
|
"""
|
||||||
# get sub folders
|
# get sub folders
|
||||||
subfolders = [x for x in os.listdir(base_path) if x != '.git' and os.path.isdir(os.path.join(base_path, x))]
|
subfolders = [x for x in os.listdir(games_path) if x != '.git' and os.path.isdir(os.path.join(games_path, x))]
|
||||||
|
|
||||||
# for each subfolder
|
# for each subfolder
|
||||||
for folder in subfolders:
|
for folder in subfolders:
|
||||||
print('generate toc for {}'.format(folder))
|
print('generate toc for {}'.format(folder))
|
||||||
|
|
||||||
# read toc header line
|
# read toc header line
|
||||||
toc_folder = os.path.join(base_path, folder)
|
toc_folder = os.path.join(games_path, folder)
|
||||||
toc_file = os.path.join(toc_folder, '_toc.md')
|
toc_file = os.path.join(toc_folder, '_toc.md')
|
||||||
toc_header = read_first_line_from_file(toc_file)
|
toc_header = read_first_line_from_file(toc_file)
|
||||||
|
|
||||||
@ -155,8 +151,9 @@ def update_category_tocs():
|
|||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
||||||
# base path
|
# paths
|
||||||
base_path = os.path.abspath(os.path.dirname(__file__))
|
games_path = os.path.abspath(os.path.dirname(__file__))
|
||||||
|
readme_path = os.path.join(games_path, os.pardir, 'README.md')
|
||||||
|
|
||||||
# recount and write to readme
|
# recount and write to readme
|
||||||
update_readme()
|
update_readme()
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user