handle nested lists
This commit is contained in:
parent
bbb1fa88e9
commit
1a0e3a8bb6
|
@ -94,7 +94,7 @@ def hugo(hugo_site_path, dest, hugo_environment='gitea', base_url=None):
|
||||||
hugo_output = cmd([HUGO_PATH, '-e', hugo_environment, '-d', dest, '--noTimes'], cwd=hugo_site_path, env=env)
|
hugo_output = cmd([HUGO_PATH, '-e', hugo_environment, '-d', dest, '--noTimes'], cwd=hugo_site_path, env=env)
|
||||||
|
|
||||||
|
|
||||||
def get_record_text(post):
|
def get_record_text(post, level=0):
|
||||||
""" Generates the markdown text of a Notion page
|
""" Generates the markdown text of a Notion page
|
||||||
see: # https://github.com/brentbaum/brentbaum-notion-publishing/blob/master/notion/get_posts.py """
|
see: # https://github.com/brentbaum/brentbaum-notion-publishing/blob/master/notion/get_posts.py """
|
||||||
text = ""
|
text = ""
|
||||||
|
@ -111,6 +111,11 @@ def get_record_text(post):
|
||||||
text += f"![{caption}]({child.source})\n"
|
text += f"![{caption}]({child.source})\n"
|
||||||
elif child.type == "divider":
|
elif child.type == "divider":
|
||||||
text += "---"
|
text += "---"
|
||||||
|
elif child.type == "bulleted_list":
|
||||||
|
prefix = prefixes.get(child.type, "")
|
||||||
|
text += ' ' * (level * 4) + prefix + child.title.encode('utf-8').decode('utf-8') + "\n\n"
|
||||||
|
if len(child.children):
|
||||||
|
text += get_record_text(child, level + 1)
|
||||||
else:
|
else:
|
||||||
prefix = prefixes.get(child.type, "")
|
prefix = prefixes.get(child.type, "")
|
||||||
text += prefix + child.title.encode('utf-8').decode('utf-8') + "\n\n"
|
text += prefix + child.title.encode('utf-8').decode('utf-8') + "\n\n"
|
||||||
|
|
Loading…
Reference in New Issue