Show More
@@ -1,39 +1,39 b'' | |||
|
1 | 1 | """ |
|
2 | 2 | This tool is used during CI testing to make sure sphinx raise no error. |
|
3 | 3 | |
|
4 | 4 | During development, we like to have whatsnew/pr/*.rst documents to track |
|
5 | 5 | individual new features. Unfortunately they other either: |
|
6 | 6 | - have no title (sphinx complains) |
|
7 | 7 | - are not included in any toctree (sphinx complain) |
|
8 | 8 | |
|
9 | 9 | This fix-them up by "inventing" a title, before building the docs. At release |
|
10 | 10 | time, these title and files will anyway be rewritten into the actual release |
|
11 | 11 | notes. |
|
12 | 12 | """ |
|
13 | 13 | |
|
14 | 14 | from pathlib import Path |
|
15 | 15 | |
|
16 | 16 | def main(): |
|
17 |
folder = Path( |
|
|
18 |
files = list(folder.glob( |
|
|
17 | folder = Path("docs/source/whatsnew/pr/") | |
|
18 | files = list(folder.glob("*.rst")) | |
|
19 | 19 | print(files) |
|
20 | 20 | |
|
21 | 21 | for filepath in files: |
|
22 |
print( |
|
|
23 |
title = filepath.name[:-4].split( |
|
|
22 | print("Adding pseudo-title to:", filepath.name) | |
|
23 | title = filepath.name[:-4].split("/")[-1].replace("-", " ").capitalize() | |
|
24 | 24 | |
|
25 | 25 | data = filepath.read_text() |
|
26 | 26 | try: |
|
27 | 27 | if data and data.splitlines()[1].startswith('='): |
|
28 | 28 | continue |
|
29 | 29 | except IndexError: |
|
30 | 30 | pass |
|
31 | 31 | |
|
32 |
with filepath.open( |
|
|
33 |
f.write(title+ |
|
|
34 |
f.write( |
|
|
32 | with filepath.open("w") as f: | |
|
33 | f.write(title + "\n") | |
|
34 | f.write("=" * len(title) + "\n\n") | |
|
35 | 35 | f.write(data) |
|
36 | 36 | |
|
37 | 37 | if __name__ == '__main__': |
|
38 | 38 | main() |
|
39 | 39 |
General Comments 0
You need to be logged in to leave comments.
Login now