commit d7e426e114c1f361181f8fee339ca6a065617d22
parent f43c8c1fd49eb64520d51fe1a21f1bad22a58894
Author: Ed van Bruggen <edvb@uw.edu>
Date: Sun, 28 Mar 2021 16:09:57 -0700
mk-content: Create projects directory
Use language page for tisp readme
Diffstat:
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/mk-content.py b/mk-content.py
@@ -4,6 +4,7 @@ import yaml
import urllib.request
import requests
import shutil
+import os
# TODO flag -v for verbose printing
# TODO flag -d for destination
@@ -12,6 +13,7 @@ import shutil
with open('data/projects.yaml') as d:
data = yaml.load(d, Loader=yaml.FullLoader)
# print(data['scripts'])
+ os.mkdir('content/projects')
for gist in data['scripts']:
gid = gist['id']
r = requests.get('https://api.github.com/gists/' + gid)
@@ -39,7 +41,7 @@ with open('data/projects.yaml') as d:
f.write(f'---\ntitle: {name}\ndescription: {desc}\n---\n')
url = f'https://raw.githubusercontent.com/edvb/{name}/master/README.md'
if name == 'tisp':
- url = 'https://raw.githubusercontent.com/edvb/tisp/master/doc/tisp.1.md'
+ url = 'https://raw.githubusercontent.com/edvb/tisp/master/doc/tisp.7.md'
with urllib.request.urlopen(url) as response, open(f'content/projects/{name}.md', 'ab') as f:
for chunk in iter(lambda: response.read(1), ''):
if chunk == b'':