add published status; handle internal session/ topic links
This commit is contained in:
parent
1a0e3a8bb6
commit
b0dc74872d
|
@ -120,7 +120,7 @@ def get_record_text(post, level=0):
|
||||||
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"
|
||||||
|
|
||||||
text = re.sub('`bib:([a-zA-Z0-9-]+)`', r'![](bib:\1)', text)
|
text = re.sub('`(bib|session|topic):([a-zA-Z0-9-]+)`', r'![](\1:\2)', text)
|
||||||
return text
|
return text
|
||||||
|
|
||||||
|
|
||||||
|
@ -130,9 +130,11 @@ def yaml_home(record):
|
||||||
return """---
|
return """---
|
||||||
title: >
|
title: >
|
||||||
%s
|
%s
|
||||||
|
draft: %s
|
||||||
has_topics: %s
|
has_topics: %s
|
||||||
---\n\n""" % (
|
---\n\n""" % (
|
||||||
record["name"],
|
record["name"],
|
||||||
|
"false" if record.get("published", True) else "true",
|
||||||
"[ %s ]" % ', '.join(topics),
|
"[ %s ]" % ', '.join(topics),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -143,9 +145,11 @@ def yaml_topic(record):
|
||||||
return """---
|
return """---
|
||||||
title: >
|
title: >
|
||||||
%s
|
%s
|
||||||
|
draft: %s
|
||||||
has_sessions: %s
|
has_sessions: %s
|
||||||
---\n\n""" % (
|
---\n\n""" % (
|
||||||
record["name"],
|
record["name"],
|
||||||
|
"false" if record.get("published", True) else "true",
|
||||||
"[ %s ]" % ', '.join(sessions),
|
"[ %s ]" % ', '.join(sessions),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -155,8 +159,10 @@ def yaml_default(record):
|
||||||
return """---
|
return """---
|
||||||
title: >
|
title: >
|
||||||
%s
|
%s
|
||||||
|
draft: %s
|
||||||
---\n\n""" % (
|
---\n\n""" % (
|
||||||
record["name"]
|
record["name"],
|
||||||
|
"false" if record.get("published", True) else "true"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -184,7 +190,7 @@ def notion_to_md(id, filepath=None, yaml_func=None):
|
||||||
# print(page_data)
|
# print(page_data)
|
||||||
if filepath:
|
if filepath:
|
||||||
os.umask(0)
|
os.umask(0)
|
||||||
with open(os.open(filepath, os.O_CREAT | os.O_WRONLY, 0o777), 'w', encoding="utf-8") as f:
|
with open(os.open(filepath, os.O_CREAT | os.O_WRONLY, 0o777), 'w') as f:
|
||||||
f.write(page_content)
|
f.write(page_content)
|
||||||
return page_data
|
return page_data
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue