forked from mozilla-necko/meeting-notes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
summary
executable file
·45 lines (37 loc) · 1.2 KB
/
summary
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/env python3
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
# Author: Manuel Bucher <[email protected]>
# Date: 2023-01-09
# https://rust-lang.github.io/mdBook/format/configuration/preprocessors.html
import os
import sys
import json
def main():
if len(sys.argv) > 1 and sys.argv[1] == "supports":
return 0
context, book = json.load(sys.stdin)
files = os.listdir('archive')
files.sort()
files.reverse()
new = []
for file in files:
if not file.startswith('meeting-'):
continue
if not file.endswith('.md'):
continue
name = file.split('.')[0]
new.append( {"Chapter": {
"name": file[:-3],
"content": open(f'archive/{file}').read(),
"number": None,
"sub_items": [],
"path": file,
"source_path": file,
"parent_names": []
}})
book["sections"] = new + book["sections"]
print(json.dumps(book))
if __name__ == '__main__':
sys.exit(main())