Compare commits
2 commits
8b237a7038
...
1ab20058c2
Author | SHA1 | Date | |
---|---|---|---|
1ab20058c2 | |||
ff3d7baf92 |
1 changed files with 9 additions and 3 deletions
|
@ -7,6 +7,7 @@ def rewrite_file(filepath):
|
||||||
newfilepath = base + ".md"
|
newfilepath = base + ".md"
|
||||||
with open(newfilepath, 'w') as w:
|
with open(newfilepath, 'w') as w:
|
||||||
in_block = False
|
in_block = False
|
||||||
|
frontmatter = False
|
||||||
for i, line in enumerate(f):
|
for i, line in enumerate(f):
|
||||||
if ( (i == 0 and line == "Content-Type: text/x-zim-wiki\n")
|
if ( (i == 0 and line == "Content-Type: text/x-zim-wiki\n")
|
||||||
or (i == 1 and line == "Wiki-Format: zim 0.26\n")
|
or (i == 1 and line == "Wiki-Format: zim 0.26\n")
|
||||||
|
@ -16,6 +17,8 @@ def rewrite_file(filepath):
|
||||||
):
|
):
|
||||||
continue
|
continue
|
||||||
if (i == 5):
|
if (i == 5):
|
||||||
|
# Set to always true when we have a type to write below
|
||||||
|
# frontmatter = True
|
||||||
title_pieces = line.split("======")
|
title_pieces = line.split("======")
|
||||||
if len(title_pieces) == 3:
|
if len(title_pieces) == 3:
|
||||||
title = title_pieces[1].strip()
|
title = title_pieces[1].strip()
|
||||||
|
@ -28,11 +31,14 @@ def rewrite_file(filepath):
|
||||||
if (title == base):
|
if (title == base):
|
||||||
continue
|
continue
|
||||||
w.write("title:: " + title + "\n")
|
w.write("title:: " + title + "\n")
|
||||||
w.write("\n")
|
if (frontmatter == False):
|
||||||
continue
|
w.write("\n")
|
||||||
if (i == 5):
|
if (frontmatter == True):
|
||||||
# Types of postable-posted, email-draft, email-sent set when running this for each subdirectory
|
# Types of postable-posted, email-draft, email-sent set when running this for each subdirectory
|
||||||
w.write("type:: postable-draft\n")
|
w.write("type:: postable-draft\n")
|
||||||
|
w.write("\n")
|
||||||
|
frontmatter = False
|
||||||
|
continue
|
||||||
if (i > 5 and line == "\"\"\"\n"):
|
if (i > 5 and line == "\"\"\"\n"):
|
||||||
if (in_block == False):
|
if (in_block == False):
|
||||||
# Start our self-styled quotation block with a bullet.
|
# Start our self-styled quotation block with a bullet.
|
||||||
|
|
Loading…
Reference in a new issue