1
mirror of https://github.com/public-apis/public-apis synced 2025-03-14 03:54:30 +01:00

Update Category split logic

This commit is contained in:
Dave Machado 2017-12-22 20:10:19 -05:00
parent 46e2c4c9e1
commit 0184842ee8
No known key found for this signature in database
GPG Key ID: 948D4778D01A7B3F

View File

@ -14,7 +14,7 @@ def markdown_to_json(filename, anchor):
and line.startswith(anchor) or line.startswith('| '))
for line in lines:
if line.startswith(anchor):
category = line.split()[1]
category = line.split(anchor)[1].strip()
continue
chunks = [x.strip() for x in line.split('|')[1:-1]]
entry = {
@ -26,7 +26,11 @@ def markdown_to_json(filename, anchor):
'Category': category,
}
entries.append(entry)
return json.dumps(entries)
final = {
'count': len(entries),
'entries': entries,
}
return json.dumps(final)
def main():