Unverified Commit 0184842e authored by Dave Machado's avatar Dave Machado
Browse files

Update Category split logic

parent 46e2c4c9
...@@ -14,7 +14,7 @@ def markdown_to_json(filename, anchor): ...@@ -14,7 +14,7 @@ def markdown_to_json(filename, anchor):
and line.startswith(anchor) or line.startswith('| ')) and line.startswith(anchor) or line.startswith('| '))
for line in lines: for line in lines:
if line.startswith(anchor): if line.startswith(anchor):
category = line.split()[1] category = line.split(anchor)[1].strip()
continue continue
chunks = [x.strip() for x in line.split('|')[1:-1]] chunks = [x.strip() for x in line.split('|')[1:-1]]
entry = { entry = {
...@@ -26,7 +26,11 @@ def markdown_to_json(filename, anchor): ...@@ -26,7 +26,11 @@ def markdown_to_json(filename, anchor):
'Category': category, 'Category': category,
} }
entries.append(entry) entries.append(entry)
return json.dumps(entries) final = {
'count': len(entries),
'entries': entries,
}
return json.dumps(final)
def main(): def main():
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment