|
17 | 17 | E-Mail: joram.soch@bccn-berlin.de |
18 | 18 |
|
19 | 19 | First edit: 2019-09-27 12:55:00 |
20 | | - Last edit: 2020-08-26 18:51:00 |
| 20 | + Last edit: 2021-11-05 07:12:00 |
21 | 21 | """ |
22 | 22 |
|
23 | 23 |
|
|
57 | 57 | if line.find('shortcut:') == 0: |
58 | 58 | shortcut = re.sub('"', '', line[10:-1]) |
59 | 59 | if line.find('title:') == 0: |
60 | | - title = re.sub('"', '', line[7:-1]) |
| 60 | + title = re.sub('"', '', line[7:-1]) |
| 61 | + title_edit = re.sub('[^a-zA-Z- ]', '', title) |
| 62 | + title_sort = title_edit[0].upper() + title_edit[1:] |
61 | 63 | if line.find('author:') == 0: |
62 | 64 | author = re.sub('"', '', line[8:-1]) |
63 | 65 | if line.find('username:') == 0: |
|
78 | 80 | 'username': username, 'date': date, 'source': source} |
79 | 81 | pr_ids.append(proof_id) |
80 | 82 | pr_nos.append(int(proof_id[1:])) |
81 | | - pr_titles.append(title) |
| 83 | + pr_titles.append(title_sort) |
82 | 84 | pr_users.append(username) |
83 | 85 |
|
84 | 86 | # List files in definition directory |
|
110 | 112 | if line.find('shortcut:') == 0: |
111 | 113 | shortcut = re.sub('"', '', line[10:-1]) |
112 | 114 | if line.find('title:') == 0: |
113 | | - title = re.sub('"', '', line[7:-1]) |
| 115 | + title = re.sub('"', '', line[7:-1]) |
| 116 | + title_edit = re.sub('[^a-zA-Z- ]', '', title) |
| 117 | + title_sort = title_edit[0].upper() + title_edit[1:] |
114 | 118 | if line.find('author:') == 0: |
115 | 119 | author = re.sub('"', '', line[8:-1]) |
116 | 120 | if line.find('username:') == 0: |
|
131 | 135 | 'username': username, 'date': date, 'source': source} |
132 | 136 | def_ids.append(def_id) |
133 | 137 | def_nos.append(int(def_id[1:])) |
134 | | - def_titles.append(title) |
| 138 | + def_titles.append(title_sort) |
135 | 139 | def_users.append(username) |
136 | 140 |
|
137 | 141 | # Output number of proof files |
|
221 | 225 | #-----------------------------------------------------------------------------# |
222 | 226 | sort_ind = [i for (v, i) in sorted([(v, i) for (i, v) in enumerate(pr_titles)])] |
223 | 227 | for i in range(0,len(pr_titles)): |
224 | | - shortcut = proofs[pr_ids[sort_ind[i]]]['shortcut'] |
225 | | - title = proofs[pr_ids[sort_ind[i]]]['title'] |
| 228 | + shortcut = proofs[pr_ids[sort_ind[i]]]['shortcut'] |
| 229 | + title = proofs[pr_ids[sort_ind[i]]]['title'] |
| 230 | + title_sort = pr_titles[sort_ind[i]] |
226 | 231 | if i == 0: |
227 | | - ind3a.write('### ' + title[0] + '\n\n') |
| 232 | + ind3a.write('### ' + title_sort[0] + '\n\n') |
228 | 233 | else: |
229 | | - if title[0] != proofs[pr_ids[sort_ind[i-1]]]['title'][0]: |
230 | | - ind3a.write('\n### ' + title[0] + '\n\n') |
| 234 | + if title_sort[0] != pr_titles[sort_ind[i-1]][0]: |
| 235 | + ind3a.write('\n### ' + title_sort[0] + '\n\n') |
231 | 236 | ind3a.write('- [' + title + '](/P/' + shortcut + ')\n') |
232 | 237 | ind3a.close() |
233 | 238 | print(' - successfully written to disk!') |
|
243 | 248 | #-----------------------------------------------------------------------------# |
244 | 249 | sort_ind = [i for (v, i) in sorted([(v, i) for (i, v) in enumerate(def_titles)])] |
245 | 250 | for i in range(0,len(def_titles)): |
246 | | - shortcut = definitions[def_ids[sort_ind[i]]]['shortcut'] |
247 | | - title = definitions[def_ids[sort_ind[i]]]['title'] |
| 251 | + shortcut = definitions[def_ids[sort_ind[i]]]['shortcut'] |
| 252 | + title = definitions[def_ids[sort_ind[i]]]['title'] |
| 253 | + title_sort = def_titles[sort_ind[i]] |
248 | 254 | if i == 0: |
249 | | - ind3b.write('### ' + title[0] + '\n\n') |
| 255 | + ind3b.write('### ' + title_sort[0] + '\n\n') |
250 | 256 | else: |
251 | | - if title[0] != definitions[def_ids[sort_ind[i-1]]]['title'][0]: |
252 | | - ind3b.write('\n### ' + title[0] + '\n\n') |
| 257 | + if title_sort[0] != def_titles[sort_ind[i-1]][0]: |
| 258 | + ind3b.write('\n### ' + title_sort[0] + '\n\n') |
253 | 259 | ind3b.write('- [' + title + '](/D/' + shortcut + ')\n') |
254 | 260 | ind3b.close() |
255 | 261 | print(' - successfully written to disk!') |
|
0 commit comments