|
@@ -6,9 +6,10 @@ import json
|
|
|
|
|
|
|
|
|
def parse_line(line, category):
|
|
|
+ print(line)
|
|
|
name = line.split('](')[0][3:]
|
|
|
- description = line.split(') ')[1][2:]
|
|
|
- url = line.split('](')[1].split(') ')[0]
|
|
|
+ url = line.split('](')[1].split(')')[0]
|
|
|
+ description = '' if line[-1] == ')' else line.split(') ')[1][2:]
|
|
|
|
|
|
return {
|
|
|
'name': name,
|
|
@@ -47,6 +48,23 @@ def parse_tools(readme):
|
|
|
return tools
|
|
|
|
|
|
|
|
|
+def parse_resources(readme):
|
|
|
+ section = readme.split('## Resources\n\n')[1].split('\n\n## Community')[0]
|
|
|
+ subsections = section.split('### ')[1:]
|
|
|
+
|
|
|
+ resources = []
|
|
|
+
|
|
|
+ for subsection in subsections:
|
|
|
+ split_section = subsection.split('\n\n')
|
|
|
+ section_title = split_section[0]
|
|
|
+
|
|
|
+ for line in split_section[1].split('\n'):
|
|
|
+ resource = parse_line(line, section_title)
|
|
|
+ resources.append(resource)
|
|
|
+
|
|
|
+ return resources
|
|
|
+
|
|
|
+
|
|
|
def parse_sites(readme):
|
|
|
section = readme.split('## Open-source sites\n\n')[1].split('\n\n## Contribute')[0]
|
|
|
|
|
@@ -54,7 +72,6 @@ def parse_sites(readme):
|
|
|
|
|
|
for line in section.split('\n'):
|
|
|
site = parse_line(line, '')
|
|
|
- print(site)
|
|
|
sites.append(site)
|
|
|
|
|
|
return sites
|
|
@@ -64,6 +81,7 @@ def parse_readme(readme):
|
|
|
return {
|
|
|
'apps': parse_apps(readme),
|
|
|
'tools': parse_tools(readme),
|
|
|
+ 'resources': parse_resources(readme),
|
|
|
'sites': parse_sites(readme),
|
|
|
}
|
|
|
|