File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree 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 11# -*- 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+
213fname = "README.md"
314snippets = []
415
1122 # check if it's a H3
1223 if line .startswith ("### " ):
1324 title = line .replace ("### " , "" )
14- # print(title, "found")
1525 description = []
1626 next_line = lines .next ()
1727
2030 description .append (next_line )
2131 next_line = lines .next ()
2232
23- # print("Description captured", description[:10])
24-
2533 explanation = []
2634 # store lines again until --- or another H3 is encountered
2735 while not (next_line .startswith ("---" ) or
2836 next_line .startswith ("### " )):
2937 explanation .append (next_line )
3038 next_line = lines .next ()
3139
32- # print("explanation captured", explanation[:10])
33-
34-
3540 # Store the results finally
3641 snippets .append ({
3742 "title" : title ,
7580 }
7681 content .next ()
7782 except StopIteration :
78- print ("Done!" )
7983
8084for idx , snip in enumerate (snippets ):
8185 snippets [idx ]["category" ] = snips_by_title [snip ["title" ]]["category" ]
You can’t perform that action at this time.
0 commit comments