File tree Expand file tree Collapse file tree 5 files changed +11
-7
lines changed Expand file tree Collapse file tree 5 files changed +11
-7
lines changed File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change 1
1
# -*- coding: utf-8 -*-
2
+
3
+ """
4
+ This inefficient module would parse the README.md in the initial version of
5
+ WTFPython, and enabl me to categorize and reorder a hell lot of examples with
6
+ the help of the file `add_categories` (part of which is automatically
7
+ generated).
8
+
9
+ After the refactor, this module would not work now with necessary updates in
10
+ the code.
11
+ """
12
+
2
13
fname = "README.md"
3
14
snippets = []
4
15
11
22
# check if it's a H3
12
23
if line .startswith ("### " ):
13
24
title = line .replace ("### " , "" )
14
- # print(title, "found")
15
25
description = []
16
26
next_line = lines .next ()
17
27
20
30
description .append (next_line )
21
31
next_line = lines .next ()
22
32
23
- # print("Description captured", description[:10])
24
-
25
33
explanation = []
26
34
# store lines again until --- or another H3 is encountered
27
35
while not (next_line .startswith ("---" ) or
28
36
next_line .startswith ("### " )):
29
37
explanation .append (next_line )
30
38
next_line = lines .next ()
31
39
32
- # print("explanation captured", explanation[:10])
33
-
34
-
35
40
# Store the results finally
36
41
snippets .append ({
37
42
"title" : title ,
75
80
}
76
81
content .next ()
77
82
except StopIteration :
78
- print ("Done!" )
79
83
80
84
for idx , snip in enumerate (snippets ):
81
85
snippets [idx ]["category" ] = snips_by_title [snip ["title" ]]["category" ]
You can’t perform that action at this time.
0 commit comments