Compare commits
No commits in common. "c05161eb4a36796afa26b1c49c0beedb1dda2af4" and "839c87fd44c55c283e1e3c68052e46f7f340f211" have entirely different histories.
c05161eb4a
...
839c87fd44
2 changed files with 10 additions and 23 deletions
10
zimwiki-txt-to-logseq-md.py
Normal file
10
zimwiki-txt-to-logseq-md.py
Normal file
|
@ -0,0 +1,10 @@
|
|||
import os
|
||||
|
||||
def rewrite_file(filepath):
|
||||
with open(filepath, 'r') as f:
|
||||
contents = f.read()
|
||||
|
||||
|
||||
for filepath in os.listdir():
|
||||
if file.endswith(".txt"):
|
||||
rewrite_file(filepath)
|
|
@ -1,23 +0,0 @@
|
|||
import os
|
||||
|
||||
def rewrite_file(filepath):
|
||||
with open(filepath, 'r') as f:
|
||||
base = filepath[:-4]
|
||||
newfilepath = base + ".md"
|
||||
with open(newfilepath, 'w') as w:
|
||||
for i, line in enumerate(f):
|
||||
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 == 2 and line == "Creation-Date: Not found\n")
|
||||
or (i == 3 and line == "Modification-Date: Not found\n")
|
||||
or (i == 4 and line == "\n")
|
||||
):
|
||||
continue
|
||||
|
||||
w.write(line)
|
||||
|
||||
|
||||
|
||||
# for filepath in os.listdir():
|
||||
# if file.endswith(".txt"):
|
||||
# rewrite_file(filepath)
|
Loading…
Reference in a new issue